1 // Copyright (C) 2011 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _HOMARD_GEN_I_HXX_
21 #define _HOMARD_GEN_I_HXX_
23 #include <SALOMEconfig.h>
24 #include CORBA_SERVER_HEADER(HOMARD_Gen)
25 #include CORBA_SERVER_HEADER(HOMARD_Cas)
26 #include CORBA_SERVER_HEADER(HOMARD_Hypothesis)
27 #include CORBA_SERVER_HEADER(HOMARD_Iteration)
28 #include CORBA_SERVER_HEADER(HOMARD_Zone)
29 #include CORBA_SERVER_HEADER(HOMARD_Boundary)
30 #include CORBA_CLIENT_HEADER(SALOMEDS)
31 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
33 #include "HOMARD_Gen.hxx"
34 #include "SALOME_Component_i.hxx"
35 #include "SALOME_NamingService.hxx"
36 #include "Utils_CorbaException.hxx"
43 public virtual Engines_Component_i,
44 public virtual POA_HOMARD::HOMARD_Gen
47 HOMARD_Gen_i( CORBA::ORB_ptr orb,
48 PortableServer::POA_ptr poa,
49 PortableServer::ObjectId* contId,
50 const char* instanceName,
51 const char* interfaceName );
52 virtual ~HOMARD_Gen_i();
55 SALOMEDS::Study_ptr GetCurrentStudy();
56 void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
57 CORBA::Long GetCurrentStudyID();
59 HOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas,
60 const char* MeshName, const char* FileName);
61 HOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis);
62 HOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent);
64 HOMARD::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone);
65 HOMARD::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone,
66 CORBA::Double Xmini, CORBA::Double Xmaxi,
67 CORBA::Double Ymini, CORBA::Double Ymaxi,
68 CORBA::Double Zmini, CORBA::Double Zmaxi);
69 HOMARD::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone,
70 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon);
71 HOMARD::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone,
72 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
73 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
74 CORBA::Double Rayon, CORBA::Double Haut);
75 HOMARD::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone,
76 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
77 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
78 CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint);
79 HOMARD::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone,
80 CORBA::Double Umini, CORBA::Double Umaxi,
81 CORBA::Double Vmini, CORBA::Double Vmaxi,
83 HOMARD::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone,
84 CORBA::Double Ucentre, CORBA::Double Vcentre,
87 HOMARD::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone,
88 CORBA::Double Ucentre, CORBA::Double Vcentre,
89 CORBA::Double Rayon, CORBA::Double Rayonint,
92 HOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary);
93 HOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary,
94 const char* MeshName, const char* FileName);
95 HOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder (const char* nomBoundary,
96 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
97 CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
99 HOMARD::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary,
100 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
101 CORBA::Double Rayon);
103 HOMARD::HOMARD_Cas_ptr GetCas (const char* nomCas);
104 HOMARD::HOMARD_Zone_ptr GetZone (const char* nomZone);
105 HOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis);
106 HOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration);
107 HOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary);
109 void AssociateCaseIter(const char* nomCas, const char* nomIter,
110 const char* labelIter);
111 void AssociateIterIter(const char* nomIterParent, const char* nomIter);
112 void AssociateIterHypo(const char* nomIter, const char* nomHypothesis);
113 void AssociateHypoZone(const char* nomZone, const char* nomHypothesis);
114 void DissociateHypoZone(const char* nomZone, const char* nomHypothesis);
116 void InvalideBoundary(const char* nomBoundary);
117 void InvalideZone(const char* nomZone);
118 void InvalideHypo(const char* nomHypo);
119 void InvalideIter(const char* nomIter);
121 void SetEtatIter(const char* nomIter,const CORBA::Boolean EtatCalcul);
123 HOMARD::listeCases* GetAllCases();
124 HOMARD::listeHypotheses* GetAllHypotheses();
125 HOMARD::listeZones* GetAllZones();
126 HOMARD::listeIterations* GetAllIterations();
127 HOMARD::listeBoundarys* GetAllBoundarys();
129 char* GetCaseName(const char* nomIteration);
131 CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage);
132 CORBA::Boolean VerifieDir(const char* nomDir);
134 void PublishResultInSmesh(const char* NomFich, CORBA::Long IconeType);
135 void DeleteResultInSmesh(const char* NomFich, const char* MeshName);
136 void PublishFileUnderIteration(const char* NomIter, const char* NomFich,
137 const char* Commentaire);
141 // ---------------------------------------------------------------
142 // next functions are inherited from SALOMEDS::Driver interface
143 // ---------------------------------------------------------------
146 virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
148 CORBA::Boolean isMultiFile);
150 virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
152 CORBA::Boolean isMultiFile);
154 virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
155 const SALOMEDS::TMPFile& theStream,
157 CORBA::Boolean isMultiFile);
159 virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
160 const SALOMEDS::TMPFile& theStream,
162 CORBA::Boolean isMultiFile);
164 virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
166 virtual char* ComponentDataType();
168 virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
169 const char* IORString,
170 CORBA::Boolean isMultiFile,
171 CORBA::Boolean isASCII);
173 virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
174 const char* aLocalPersistentID,
175 CORBA::Boolean isMultiFile,
176 CORBA::Boolean isASCII);
178 // --> Data publishing
179 virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR);
181 virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
182 SALOMEDS::SObject_ptr theSObject,
183 CORBA::Object_ptr theObject,
184 const char* theName);
187 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
189 virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject,
190 CORBA::Long& theObjectID);
192 virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
194 virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
195 CORBA::Long theObjectID,
196 SALOMEDS::SObject_ptr theObject);
200 void addInStudy(SALOMEDS::Study_ptr theStudy);
201 SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
202 HOMARD::HOMARD_Cas_ptr theObject, const char* theName);
204 SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
205 HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName);
207 SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
208 HOMARD::HOMARD_Zone_ptr theObject, const char* theName);
209 SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
210 HOMARD::HOMARD_Boundary_ptr theObject, const char* theName);
211 virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder,
212 SALOMEDS::SObject_var aResultSO,
213 const char* theName, const char* value, const char* icone, const char* ior);
214 PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
216 HOMARD::HOMARD_Cas_ptr newCase();
217 HOMARD::HOMARD_Hypothesis_ptr newHypothesis();
218 HOMARD::HOMARD_Iteration_ptr newIteration();
219 HOMARD::HOMARD_Zone_ptr newZone();
220 HOMARD::HOMARD_Boundary_ptr newBoundary();
223 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
224 CORBA::Boolean isPublished,
225 CORBA::Boolean isMultiFile,
226 CORBA::Boolean& isValidScript);
232 std::map<std::string, HOMARD::HOMARD_Cas_var> _mesCas;
233 std::map<std::string, HOMARD::HOMARD_Hypothesis_var> _mesHypotheses;
234 std::map<std::string, HOMARD::HOMARD_Iteration_var> _mesIterations;
235 std::map<std::string, HOMARD::HOMARD_Zone_var> _mesZones;
236 std::map<std::string, HOMARD::HOMARD_Boundary_var> _mesBoundarys;
237 std::map<int, PortableServer::ServantBase*> _idmap;
239 typedef std::map<int, StudyContext> ContextMap;
241 ::HOMARD_Gen* myHomard;
242 SALOMEDS::Study_var myCurrentStudy;
243 ContextMap myContextMap;
244 SALOME_NamingService* _NS;