1 // Copyright (C) 2011-2016 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, or (at your option) any later version.
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_SERVER_HEADER(HOMARD_YACS)
31 #include CORBA_CLIENT_HEADER(SALOMEDS)
32 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
34 #include "HOMARD_i.hxx"
35 #include "HOMARD_Gen.hxx"
36 #include "HomardDriver.hxx"
37 #include "YACSDriver.hxx"
38 #include "FrontTrack.hxx"
39 #include "SALOME_Component_i.hxx"
40 #include "SALOME_NamingService.hxx"
41 #include "Utils_CorbaException.hxx"
46 class HOMARDENGINE_EXPORT HOMARD_Gen_i:
47 public virtual Engines_Component_i,
48 public virtual POA_HOMARD::HOMARD_Gen
51 HOMARD_Gen_i( CORBA::ORB_ptr orb,
52 PortableServer::POA_ptr poa,
53 PortableServer::ObjectId* contId,
54 const char* instanceName,
55 const char* interfaceName );
56 virtual ~HOMARD_Gen_i();
62 HOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary);
63 HOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO(const char* nomBoundary,
64 const char* DataFile);
65 HOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary,
66 const char* MeshName, const char* DataFile);
67 HOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder (const char* nomBoundary,
68 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
69 CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
71 HOMARD::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary,
72 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
74 HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeR (const char* nomBoundary,
75 CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1,
76 CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2);
77 HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeA (const char* nomBoundary,
78 CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, CORBA::Double Angle,
79 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre);
80 HOMARD::HOMARD_Boundary_ptr CreateBoundaryTorus (const char* nomBoundary,
81 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
82 CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
83 CORBA::Double RayonRev, CORBA::Double RayonPri);
85 HOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas, const char* MeshName, const char* FileName);
86 HOMARD::HOMARD_Cas_ptr CreateCaseFromIteration (const char* nomCas, const char* DirNameStart);
87 HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseLastIteration (const char* nomCas, const char* DirNameStart);
88 HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseIteration (const char* nomCas, const char* DirNameStart, CORBA::Long Number);
89 HOMARD::HOMARD_Cas_ptr CreateCase0 (const char* nomCas, const char* MeshName, const char* FileName, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option);
90 std::string CreateCase1 (const char* DirNameStart, CORBA::Long Number);
92 HOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis);
94 HOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent);
96 HOMARD::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone);
97 HOMARD::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone,
98 CORBA::Double Xmini, CORBA::Double Xmaxi,
99 CORBA::Double Ymini, CORBA::Double Ymaxi,
100 CORBA::Double Zmini, CORBA::Double Zmaxi);
101 HOMARD::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone,
102 CORBA::Double Umini, CORBA::Double Umaxi,
103 CORBA::Double Vmini, CORBA::Double Vmaxi,
105 HOMARD::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone,
106 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
107 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
108 CORBA::Double Rayon, CORBA::Double Haut);
109 HOMARD::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone,
110 CORBA::Double Ucentre, CORBA::Double Vcentre,
113 HOMARD::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone,
114 CORBA::Double Ucentre, CORBA::Double Vcentre,
115 CORBA::Double Rayon, CORBA::Double Rayonint,
117 HOMARD::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone,
118 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
119 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
120 CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint);
121 HOMARD::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone,
122 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon);
125 HOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary);
126 HOMARD::HOMARD_Cas_ptr GetCase (const char* nomCas);
127 HOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis);
128 HOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration);
129 HOMARD::HOMARD_YACS_ptr GetYACS (const char* nomYACS);
130 HOMARD::HOMARD_Zone_ptr GetZone (const char* nomZone);
132 HOMARD::listeBoundarys* GetAllBoundarysName();
133 HOMARD::listeCases* GetAllCasesName();
134 HOMARD::listeHypotheses* GetAllHypothesesName();
135 HOMARD::listeIterations* GetAllIterationsName();
136 HOMARD::listeYACSs* GetAllYACSsName();
137 HOMARD::listeZones* GetAllZonesName();
139 void MeshInfo (const char* nomCas,
140 const char* MeshName, const char* FileName, const char* DirName,
141 CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte);
143 HOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas);
146 SALOMEDS::Study_ptr GetCurrentStudy();
147 void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
148 CORBA::Long GetCurrentStudyID();
151 // Liens entre structures
152 void InvalideBoundary(const char* nomBoundary);
153 void InvalideHypo(const char* nomHypo);
154 void InvalideIter(const char* nomIter);
155 void InvalideIterOption(const char* nomIter, CORBA::Long Option);
156 void InvalideIterInfo(const char* nomIter);
157 void InvalideYACS(const char* nomYACS);
158 void InvalideZone(const char* nomZone);
160 CORBA::Long DeleteBoundary(const char* nomBoundary);
161 CORBA::Long DeleteCase(const char* nomCas, CORBA::Long Option);
162 CORBA::Long DeleteHypo(const char* nomHypothesis);
163 CORBA::Long DeleteIteration(const char* nomIter, CORBA::Long Option);
164 CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2);
165 CORBA::Long DeleteYACS(const char* nomYACS, CORBA::Long Option);
166 CORBA::Long DeleteZone(const char* nomZone);
168 void AssociateIterHypo(const char* nomIter, const char* nomHypothesis);
170 void AssociateHypoZone(const char* nomHypothesis, const char* nomZone, CORBA::Long TypeUse);
171 void DissociateHypoZone(const char* nomHypothesis, const char* nomZone);
173 void AssociateCaseIter(const char* nomCas, const char* nomIter,
174 const char* labelIter);
177 void SetEtatIter(const char* nomIter,const CORBA::Long Etat);
178 char* CreateDirNameIter(const char* nomrep, CORBA::Long num );
180 CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2);
181 CORBA::Long ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2);
182 CORBA::Long ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2);
183 CORBA::Long ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2);
184 char* ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage);
185 char* ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration);
186 void DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
187 void DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
188 int DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver);
189 void DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
191 char* VerifieDir(const char* nomDir);
193 void PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire);
194 void PublishFileUnderYACS(const char* NomYACS, const char* NomFich, const char* Commentaire);
195 void PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName);
196 void PublishCaseUnderYACS(const char* YACSName, const char* CaseName);
197 void PublishResultInSmesh(const char* NomFich, CORBA::Long Option);
198 void DeleteResultInSmesh(std::string NomFich, std::string MeshName);
199 void PublishMeshIterInSmesh(const char* NomIter);
202 HOMARD::HOMARD_YACS_ptr CreateYACSSchema (const char* YACSName, const char* nomCas, const char* ScriptFile, const char* DirName, const char* MeshFile);
203 CORBA::Long YACSWrite(const char* nomYACS);
204 CORBA::Long YACSWriteOnFile(const char* nomYACS, const char* XMLFile);
205 std::string YACSDriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, YACSDriver* myDriver);
206 std::string YACSDriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, YACSDriver* myDriver);
209 void SetPreferences() ;
210 void SetLanguageShort(const char* LanguageShort);
211 char* GetLanguageShort();
212 void SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT);
213 CORBA::Long GetPublisMeshIN();
214 CORBA::Long GetPublisMeshOUT();
215 void SetYACSMaximum(CORBA::Long YACSMaxIter, CORBA::Long YACSMaxNode, CORBA::Long YACSMaxElem);
216 CORBA::Long GetYACSMaxIter();
217 CORBA::Long GetYACSMaxNode();
218 CORBA::Long GetYACSMaxElem();
219 void SetYACSConvergenceType(CORBA::Long YACSTypeTest);
220 CORBA::Long GetYACSConvergenceType();
223 // ---------------------------------------------------------------
224 // next functions are inherited from SALOMEDS::Driver interface
225 // ---------------------------------------------------------------
228 virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
230 CORBA::Boolean isMultiFile);
232 virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
234 CORBA::Boolean isMultiFile);
236 virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
237 const SALOMEDS::TMPFile& theStream,
239 CORBA::Boolean isMultiFile);
241 virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
242 const SALOMEDS::TMPFile& theStream,
244 CORBA::Boolean isMultiFile);
246 virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
248 virtual char* ComponentDataType();
250 virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
251 const char* IORString,
252 CORBA::Boolean isMultiFile,
253 CORBA::Boolean isASCII);
255 virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
256 const char* aLocalPersistentID,
257 CORBA::Boolean isMultiFile,
258 CORBA::Boolean isASCII);
260 // --> Data publishing
261 virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR);
263 virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
264 SALOMEDS::SObject_ptr theSObject,
265 CORBA::Object_ptr theObject,
266 const char* theName);
269 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
271 virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject,
272 CORBA::Long& theObjectID);
274 virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
276 virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
277 CORBA::Long theObjectID,
278 SALOMEDS::SObject_ptr theObject);
280 // virtual void SALOMEException( std::string message );
283 void addInStudy(SALOMEDS::Study_ptr theStudy);
284 SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
285 HOMARD::HOMARD_Boundary_ptr theObject, const char* theName);
286 SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
287 HOMARD::HOMARD_Cas_ptr theObject, const char* theName);
288 SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
289 HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName);
290 SALOMEDS::SObject_ptr PublishYACSInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
291 HOMARD::HOMARD_YACS_ptr theObject, const char* theName);
292 SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
293 HOMARD::HOMARD_Zone_ptr theObject, const char* theName);
294 virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder,
295 SALOMEDS::SObject_var aResultSO,
296 const char* theName, const char* comment, const char* icone, const char* ior);
298 PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
300 HOMARD::HOMARD_Boundary_ptr newBoundary();
301 HOMARD::HOMARD_Cas_ptr newCase();
302 HOMARD::HOMARD_Hypothesis_ptr newHypothesis();
303 HOMARD::HOMARD_Iteration_ptr newIteration();
304 HOMARD::HOMARD_YACS_ptr newYACS();
305 HOMARD::HOMARD_Zone_ptr newZone();
308 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
309 CORBA::Boolean isPublished,
310 CORBA::Boolean isMultiFile,
311 CORBA::Boolean& isValidScript);
313 virtual char* getVersion();
314 std::string GetStringInTexte( const std::string Texte, const std::string String, int option ) ;
319 std::map<std::string, HOMARD::HOMARD_Boundary_var> _mesBoundarys;
320 std::map<std::string, HOMARD::HOMARD_Cas_var> _mesCas;
321 std::map<std::string, HOMARD::HOMARD_Hypothesis_var> _mesHypotheses;
322 std::map<std::string, HOMARD::HOMARD_Iteration_var> _mesIterations;
323 std::map<std::string, HOMARD::HOMARD_YACS_var> _mesYACSs;
324 std::map<std::string, HOMARD::HOMARD_Zone_var> _mesZones;
325 std::map<int, PortableServer::ServantBase*> _idmap;
327 typedef std::map<int, StudyContext> ContextMap;
329 ::HOMARD_Gen* myHomard;
330 SALOMEDS::Study_var myCurrentStudy;
331 ContextMap myContextMap;
332 SALOME_NamingService* _NS;
341 std::string _Langue ;
342 std::string _LangueShort ;