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 "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();
58 HOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary);
59 HOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary,
60 const char* MeshName, const char* FileName);
61 HOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder (const char* nomBoundary,
62 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
63 CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
65 HOMARD::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary,
66 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
69 HOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas,
70 const char* MeshName, const char* FileName);
72 HOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis);
74 HOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent);
76 HOMARD::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone);
77 HOMARD::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone,
78 CORBA::Double Xmini, CORBA::Double Xmaxi,
79 CORBA::Double Ymini, CORBA::Double Ymaxi,
80 CORBA::Double Zmini, CORBA::Double Zmaxi);
81 HOMARD::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone,
82 CORBA::Double Umini, CORBA::Double Umaxi,
83 CORBA::Double Vmini, CORBA::Double Vmaxi,
85 HOMARD::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone,
86 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
87 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
88 CORBA::Double Rayon, CORBA::Double Haut);
89 HOMARD::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone,
90 CORBA::Double Ucentre, CORBA::Double Vcentre,
93 HOMARD::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone,
94 CORBA::Double Ucentre, CORBA::Double Vcentre,
95 CORBA::Double Rayon, CORBA::Double Rayonint,
97 HOMARD::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone,
98 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
99 CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe,
100 CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint);
101 HOMARD::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone,
102 CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon);
105 HOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary);
106 HOMARD::HOMARD_Cas_ptr GetCase (const char* nomCas);
107 HOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis);
108 HOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration);
109 HOMARD::HOMARD_Zone_ptr GetZone (const char* nomZone);
111 HOMARD::listeBoundarys* GetAllBoundarysName();
112 HOMARD::listeCases* GetAllCasesName();
113 HOMARD::listeHypotheses* GetAllHypothesesName();
114 HOMARD::listeIterations* GetAllIterationsName();
115 HOMARD::listeZones* GetAllZonesName();
117 HOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas);
120 SALOMEDS::Study_ptr GetCurrentStudy();
121 void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
122 CORBA::Long GetCurrentStudyID();
124 // Liens entre structures
125 void InvalideBoundary(const char* nomBoundary);
126 void InvalideHypo(const char* nomHypo);
127 void InvalideIter(const char* nomIter);
128 void InvalideZone(const char* nomZone);
130 CORBA::Long DeleteBoundary(const char* nomBoundary);
131 CORBA::Long DeleteCase(const char* nomCas);
132 CORBA::Long DeleteHypo(const char* nomHypothesis);
133 CORBA::Long DeleteIteration(const char* nomIter);
134 CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option);
135 CORBA::Long DeleteZone(const char* nomZone);
137 void AssociateIterHypo(const char* nomIter, const char* nomHypothesis);
139 void AssociateHypoZone(const char* nomHypothesis, const char* nomZone, CORBA::Long TypeUse);
140 void DissociateHypoZone(const char* nomHypothesis, const char* nomZone);
142 void AssociateCaseIter(const char* nomCas, const char* nomIter,
143 const char* labelIter);
145 void SetEtatIter(const char* nomIter,const CORBA::Boolean EtatCalcul);
147 CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage);
148 CORBA::Boolean VerifieDir(const char* nomDir);
150 void PublishResultInSmesh(const char* NomFich, CORBA::Long IconeType);
151 void DeleteResultInSmesh(const char* NomFich, const char* MeshName);
152 void PublishFileUnderIteration(const char* NomIter, const char* NomFich,
153 const char* Commentaire);
154 void PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName);
158 // ---------------------------------------------------------------
159 // next functions are inherited from SALOMEDS::Driver interface
160 // ---------------------------------------------------------------
163 virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
165 CORBA::Boolean isMultiFile);
167 virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
169 CORBA::Boolean isMultiFile);
171 virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
172 const SALOMEDS::TMPFile& theStream,
174 CORBA::Boolean isMultiFile);
176 virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
177 const SALOMEDS::TMPFile& theStream,
179 CORBA::Boolean isMultiFile);
181 virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
183 virtual char* ComponentDataType();
185 virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
186 const char* IORString,
187 CORBA::Boolean isMultiFile,
188 CORBA::Boolean isASCII);
190 virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
191 const char* aLocalPersistentID,
192 CORBA::Boolean isMultiFile,
193 CORBA::Boolean isASCII);
195 // --> Data publishing
196 virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR);
198 virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
199 SALOMEDS::SObject_ptr theSObject,
200 CORBA::Object_ptr theObject,
201 const char* theName);
204 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
206 virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject,
207 CORBA::Long& theObjectID);
209 virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
211 virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
212 CORBA::Long theObjectID,
213 SALOMEDS::SObject_ptr theObject);
215 // virtual void SALOMEException( std::string message );
218 void addInStudy(SALOMEDS::Study_ptr theStudy);
219 SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
220 HOMARD::HOMARD_Cas_ptr theObject, const char* theName);
222 SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
223 HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName);
225 SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
226 HOMARD::HOMARD_Zone_ptr theObject, const char* theName);
227 SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::StudyBuilder_var aStudyBuilder,
228 HOMARD::HOMARD_Boundary_ptr theObject, const char* theName);
229 virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder,
230 SALOMEDS::SObject_var aResultSO,
231 const char* theName, const char* value, const char* icone, const char* ior);
233 PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
235 HOMARD::HOMARD_Cas_ptr newCase();
236 HOMARD::HOMARD_Hypothesis_ptr newHypothesis();
237 HOMARD::HOMARD_Iteration_ptr newIteration();
238 HOMARD::HOMARD_Zone_ptr newZone();
239 HOMARD::HOMARD_Boundary_ptr newBoundary();
242 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
243 CORBA::Boolean isPublished,
244 CORBA::Boolean isMultiFile,
245 CORBA::Boolean& isValidScript);
247 virtual char* getVersion();
252 std::map<std::string, HOMARD::HOMARD_Cas_var> _mesCas;
253 std::map<std::string, HOMARD::HOMARD_Hypothesis_var> _mesHypotheses;
254 std::map<std::string, HOMARD::HOMARD_Iteration_var> _mesIterations;
255 std::map<std::string, HOMARD::HOMARD_Zone_var> _mesZones;
256 std::map<std::string, HOMARD::HOMARD_Boundary_var> _mesBoundarys;
257 std::map<int, PortableServer::ServantBase*> _idmap;
259 typedef std::map<int, StudyContext> ContextMap;
261 ::HOMARD_Gen* myHomard;
262 SALOMEDS::Study_var myCurrentStudy;
263 ContextMap myContextMap;
264 SALOME_NamingService* _NS;