1 // Copyright (C) 2011-2012 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,
70 HOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas,
71 const char* MeshName, const char* FileName);
73 HOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis);
75 HOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent);
77 HOMARD::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone);
78 HOMARD::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone,
79 CORBA::Double Xmini, CORBA::Double Xmaxi,
80 CORBA::Double Ymini, CORBA::Double Ymaxi,
81 CORBA::Double Zmini, CORBA::Double Zmaxi);
82 HOMARD::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone,
83 CORBA::Double Umini, CORBA::Double Umaxi,
84 CORBA::Double Vmini, CORBA::Double Vmaxi,
86 HOMARD::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone,
87 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
88 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
89 CORBA::Double Rayon, CORBA::Double Haut);
90 HOMARD::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone,
91 CORBA::Double Ucentre, CORBA::Double Vcentre,
94 HOMARD::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone,
95 CORBA::Double Ucentre, CORBA::Double Vcentre,
96 CORBA::Double Rayon, CORBA::Double Rayonint,
98 HOMARD::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone,
99 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
100 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
101 CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint);
102 HOMARD::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone,
103 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon);
106 HOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary);
107 HOMARD::HOMARD_Cas_ptr GetCase (const char* nomCas);
108 HOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis);
109 HOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration);
110 HOMARD::HOMARD_Zone_ptr GetZone (const char* nomZone);
112 HOMARD::listeBoundarys* GetAllBoundarysName();
113 HOMARD::listeCases* GetAllCasesName();
114 HOMARD::listeHypotheses* GetAllHypothesesName();
115 HOMARD::listeIterations* GetAllIterationsName();
116 HOMARD::listeZones* GetAllZonesName();
118 void MeshInfo (const char* nomCas,
119 const char* MeshName, const char* FileName, const char* DirName,
120 CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte);
122 HOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas);
125 SALOMEDS::Study_ptr GetCurrentStudy();
126 void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
127 CORBA::Long GetCurrentStudyID();
129 // Liens entre structures
130 void InvalideBoundary(const char* nomBoundary);
131 void InvalideHypo(const char* nomHypo);
132 void InvalideIter(const char* nomIter);
133 void InvalideIterOption(const char* nomIter, CORBA::Long Option);
134 void InvalideIterInfo(const char* nomIter);
135 void InvalideZone(const char* nomZone);
137 CORBA::Long DeleteBoundary(const char* nomBoundary);
138 CORBA::Long DeleteCase(const char* nomCas);
139 CORBA::Long DeleteHypo(const char* nomHypothesis);
140 CORBA::Long DeleteIteration(const char* nomIter, CORBA::Long Option);
141 CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2);
142 CORBA::Long DeleteZone(const char* nomZone);
144 void AssociateIterHypo(const char* nomIter, const char* nomHypothesis);
146 void AssociateHypoZone(const char* nomHypothesis, const char* nomZone, CORBA::Long TypeUse);
147 void DissociateHypoZone(const char* nomHypothesis, const char* nomZone);
149 void AssociateCaseIter(const char* nomCas, const char* nomIter,
150 const char* labelIter);
152 void SetEtatIter(const char* nomIter,const CORBA::Boolean EtatCalcul);
154 CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option);
155 CORBA::Long ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option);
156 char* ComputeDir(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage);
157 char* ComputeDirPa(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration);
158 void DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
159 void DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
160 void DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver);
161 void DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
163 CORBA::Boolean VerifieDir(const char* nomDir);
165 void PublishResultInSmesh(const char* NomFich, CORBA::Long Option);
166 void DeleteResultInSmesh(const char* NomFich, const char* MeshName);
167 void PublishFileUnderIteration(const char* NomIter, const char* NomFich,
168 const char* Commentaire);
169 void PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName);
173 // ---------------------------------------------------------------
174 // next functions are inherited from SALOMEDS::Driver interface
175 // ---------------------------------------------------------------
178 virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
180 CORBA::Boolean isMultiFile);
182 virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
184 CORBA::Boolean isMultiFile);
186 virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
187 const SALOMEDS::TMPFile& theStream,
189 CORBA::Boolean isMultiFile);
191 virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
192 const SALOMEDS::TMPFile& theStream,
194 CORBA::Boolean isMultiFile);
196 virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
198 virtual char* ComponentDataType();
200 virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
201 const char* IORString,
202 CORBA::Boolean isMultiFile,
203 CORBA::Boolean isASCII);
205 virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
206 const char* aLocalPersistentID,
207 CORBA::Boolean isMultiFile,
208 CORBA::Boolean isASCII);
210 // --> Data publishing
211 virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR);
213 virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
214 SALOMEDS::SObject_ptr theSObject,
215 CORBA::Object_ptr theObject,
216 const char* theName);
219 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
221 virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject,
222 CORBA::Long& theObjectID);
224 virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
226 virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
227 CORBA::Long theObjectID,
228 SALOMEDS::SObject_ptr theObject);
230 // virtual void SALOMEException( std::string message );
233 void addInStudy(SALOMEDS::Study_ptr theStudy);
234 SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
235 HOMARD::HOMARD_Cas_ptr theObject, const char* theName);
237 SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
238 HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName);
240 SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
241 HOMARD::HOMARD_Zone_ptr theObject, const char* theName);
242 SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
243 HOMARD::HOMARD_Boundary_ptr theObject, const char* theName);
244 virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder,
245 SALOMEDS::SObject_var aResultSO,
246 const char* theName, const char* value, const char* icone, const char* ior);
248 PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
250 HOMARD::HOMARD_Cas_ptr newCase();
251 HOMARD::HOMARD_Hypothesis_ptr newHypothesis();
252 HOMARD::HOMARD_Iteration_ptr newIteration();
253 HOMARD::HOMARD_Zone_ptr newZone();
254 HOMARD::HOMARD_Boundary_ptr newBoundary();
257 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
258 CORBA::Boolean isPublished,
259 CORBA::Boolean isMultiFile,
260 CORBA::Boolean& isValidScript);
262 virtual char* getVersion();
267 std::map<std::string, HOMARD::HOMARD_Cas_var> _mesCas;
268 std::map<std::string, HOMARD::HOMARD_Hypothesis_var> _mesHypotheses;
269 std::map<std::string, HOMARD::HOMARD_Iteration_var> _mesIterations;
270 std::map<std::string, HOMARD::HOMARD_Zone_var> _mesZones;
271 std::map<std::string, HOMARD::HOMARD_Boundary_var> _mesBoundarys;
272 std::map<int, PortableServer::ServantBase*> _idmap;
274 typedef std::map<int, StudyContext> ContextMap;
276 ::HOMARD_Gen* myHomard;
277 SALOMEDS::Study_var myCurrentStudy;
278 ContextMap myContextMap;
279 SALOME_NamingService* _NS;