1 // Copyright (C) 2011-2013 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 "HomardDriver.hxx"
35 #include "SALOME_Component_i.hxx"
36 #include "SALOME_NamingService.hxx"
37 #include "Utils_CorbaException.hxx"
44 public virtual Engines_Component_i,
45 public virtual POA_HOMARD::HOMARD_Gen
48 HOMARD_Gen_i( CORBA::ORB_ptr orb,
49 PortableServer::POA_ptr poa,
50 PortableServer::ObjectId* contId,
51 const char* instanceName,
52 const char* interfaceName );
53 virtual ~HOMARD_Gen_i();
59 HOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary);
60 HOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary,
61 const char* MeshName, const char* FileName);
62 HOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder (const char* nomBoundary,
63 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
64 CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
66 HOMARD::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary,
67 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
69 HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeR (const char* nomBoundary,
70 CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1,
71 CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2);
72 HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeA (const char* nomBoundary,
73 CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, CORBA::Double Angle,
74 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre);
76 HOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas,
77 const char* MeshName, const char* FileName);
79 HOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis);
81 HOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent);
83 HOMARD::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone);
84 HOMARD::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone,
85 CORBA::Double Xmini, CORBA::Double Xmaxi,
86 CORBA::Double Ymini, CORBA::Double Ymaxi,
87 CORBA::Double Zmini, CORBA::Double Zmaxi);
88 HOMARD::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone,
89 CORBA::Double Umini, CORBA::Double Umaxi,
90 CORBA::Double Vmini, CORBA::Double Vmaxi,
92 HOMARD::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone,
93 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
94 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
95 CORBA::Double Rayon, CORBA::Double Haut);
96 HOMARD::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone,
97 CORBA::Double Ucentre, CORBA::Double Vcentre,
100 HOMARD::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone,
101 CORBA::Double Ucentre, CORBA::Double Vcentre,
102 CORBA::Double Rayon, CORBA::Double Rayonint,
104 HOMARD::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone,
105 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
106 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
107 CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint);
108 HOMARD::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone,
109 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon);
112 HOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary);
113 HOMARD::HOMARD_Cas_ptr GetCase (const char* nomCas);
114 HOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis);
115 HOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration);
116 HOMARD::HOMARD_Zone_ptr GetZone (const char* nomZone);
118 HOMARD::listeBoundarys* GetAllBoundarysName();
119 HOMARD::listeCases* GetAllCasesName();
120 HOMARD::listeHypotheses* GetAllHypothesesName();
121 HOMARD::listeIterations* GetAllIterationsName();
122 HOMARD::listeZones* GetAllZonesName();
124 void MeshInfo (const char* nomCas,
125 const char* MeshName, const char* FileName, const char* DirName,
126 CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte);
128 HOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas);
131 SALOMEDS::Study_ptr GetCurrentStudy();
132 void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
133 CORBA::Long GetCurrentStudyID();
135 // Liens entre structures
136 void InvalideBoundary(const char* nomBoundary);
137 void InvalideHypo(const char* nomHypo);
138 void InvalideIter(const char* nomIter);
139 void InvalideIterOption(const char* nomIter, CORBA::Long Option);
140 void InvalideIterInfo(const char* nomIter);
141 void InvalideZone(const char* nomZone);
143 CORBA::Long DeleteBoundary(const char* nomBoundary);
144 CORBA::Long DeleteCase(const char* nomCas);
145 CORBA::Long DeleteHypo(const char* nomHypothesis);
146 CORBA::Long DeleteIteration(const char* nomIter, CORBA::Long Option);
147 CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2);
148 CORBA::Long DeleteZone(const char* nomZone);
150 void AssociateIterHypo(const char* nomIter, const char* nomHypothesis);
152 void AssociateHypoZone(const char* nomHypothesis, const char* nomZone, CORBA::Long TypeUse);
153 void DissociateHypoZone(const char* nomHypothesis, const char* nomZone);
155 void AssociateCaseIter(const char* nomCas, const char* nomIter,
156 const char* labelIter);
158 void SetEtatIter(const char* nomIter,const CORBA::Boolean EtatCalcul);
160 CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option);
161 CORBA::Long ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option);
162 char* ComputeDir(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage);
163 char* ComputeDirPa(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration);
164 void DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
165 void DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
166 void DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver);
167 void DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
169 CORBA::Boolean VerifieDir(const char* nomDir);
171 void PublishResultInSmesh(const char* NomFich, CORBA::Long Option);
172 void DeleteResultInSmesh(const char* NomFich, const char* MeshName);
173 void PublishFileUnderIteration(const char* NomIter, const char* NomFich,
174 const char* Commentaire);
175 void PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName);
179 // ---------------------------------------------------------------
180 // next functions are inherited from SALOMEDS::Driver interface
181 // ---------------------------------------------------------------
184 virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
186 CORBA::Boolean isMultiFile);
188 virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
190 CORBA::Boolean isMultiFile);
192 virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
193 const SALOMEDS::TMPFile& theStream,
195 CORBA::Boolean isMultiFile);
197 virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
198 const SALOMEDS::TMPFile& theStream,
200 CORBA::Boolean isMultiFile);
202 virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
204 virtual char* ComponentDataType();
206 virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
207 const char* IORString,
208 CORBA::Boolean isMultiFile,
209 CORBA::Boolean isASCII);
211 virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
212 const char* aLocalPersistentID,
213 CORBA::Boolean isMultiFile,
214 CORBA::Boolean isASCII);
216 // --> Data publishing
217 virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR);
219 virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
220 SALOMEDS::SObject_ptr theSObject,
221 CORBA::Object_ptr theObject,
222 const char* theName);
225 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
227 virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject,
228 CORBA::Long& theObjectID);
230 virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
232 virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
233 CORBA::Long theObjectID,
234 SALOMEDS::SObject_ptr theObject);
236 // virtual void SALOMEException( std::string message );
239 void addInStudy(SALOMEDS::Study_ptr theStudy);
240 SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
241 HOMARD::HOMARD_Cas_ptr theObject, const char* theName);
243 SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
244 HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName);
246 SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
247 HOMARD::HOMARD_Zone_ptr theObject, const char* theName);
248 SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
249 HOMARD::HOMARD_Boundary_ptr theObject, const char* theName);
250 virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder,
251 SALOMEDS::SObject_var aResultSO,
252 const char* theName, const char* value, const char* icone, const char* ior);
254 PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
256 HOMARD::HOMARD_Cas_ptr newCase();
257 HOMARD::HOMARD_Hypothesis_ptr newHypothesis();
258 HOMARD::HOMARD_Iteration_ptr newIteration();
259 HOMARD::HOMARD_Zone_ptr newZone();
260 HOMARD::HOMARD_Boundary_ptr newBoundary();
263 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
264 CORBA::Boolean isPublished,
265 CORBA::Boolean isMultiFile,
266 CORBA::Boolean& isValidScript);
268 virtual char* getVersion();
273 std::map<std::string, HOMARD::HOMARD_Cas_var> _mesCas;
274 std::map<std::string, HOMARD::HOMARD_Hypothesis_var> _mesHypotheses;
275 std::map<std::string, HOMARD::HOMARD_Iteration_var> _mesIterations;
276 std::map<std::string, HOMARD::HOMARD_Zone_var> _mesZones;
277 std::map<std::string, HOMARD::HOMARD_Boundary_var> _mesBoundarys;
278 std::map<int, PortableServer::ServantBase*> _idmap;
280 typedef std::map<int, StudyContext> ContextMap;
282 ::HOMARD_Gen* myHomard;
283 SALOMEDS::Study_var myCurrentStudy;
284 ContextMap myContextMap;
285 SALOME_NamingService* _NS;