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 // L'ordre de description des fonctions est le meme dans tous les fichiers
21 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
22 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
23 // 2. Les caracteristiques
24 // 3. Le lien avec les autres structures
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
28 #include "HOMARD_Boundary_i.hxx"
29 #include "HOMARD_Gen_i.hxx"
30 #include "HOMARD_Boundary.hxx"
31 #include "HOMARD_DriverTools.hxx"
33 #include "utilities.h"
35 //=============================================================================
37 * standard constructor
39 //=============================================================================
40 HOMARD_Boundary_i::HOMARD_Boundary_i()
42 MESSAGE( "Default constructor, not for use" );
45 //=============================================================================
47 * standard constructor
49 //=============================================================================
50 HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb,
51 HOMARD::HOMARD_Gen_var engine )
53 MESSAGE( "HOMARD_Boundary_i" );
56 myHomardBoundary = new ::HOMARD_Boundary();
57 ASSERT( myHomardBoundary );
59 //=============================================================================
63 //=============================================================================
64 HOMARD_Boundary_i::~HOMARD_Boundary_i()
67 //=============================================================================
68 //=============================================================================
70 //=============================================================================
71 //=============================================================================
72 void HOMARD_Boundary_i::SetName( const char* Name )
74 ASSERT( myHomardBoundary );
75 myHomardBoundary->SetName( Name );
77 //=============================================================================
78 char* HOMARD_Boundary_i::GetName()
80 ASSERT( myHomardBoundary );
81 return CORBA::string_dup( myHomardBoundary->GetName().c_str() );
83 //=============================================================================
84 CORBA::Long HOMARD_Boundary_i::Delete()
86 ASSERT( myHomardBoundary );
87 char* BoundaryName = GetName() ;
88 MESSAGE ( "Delete : destruction de la frontiere " << BoundaryName );
89 return _gen_i->DeleteBoundary(BoundaryName) ;
91 //=============================================================================
92 char* HOMARD_Boundary_i::GetDumpPython()
94 ASSERT( myHomardBoundary );
95 return CORBA::string_dup( myHomardBoundary->GetDumpPython().c_str() );
97 //=============================================================================
98 std::string HOMARD_Boundary_i::Dump() const
100 return HOMARD::Dump( *myHomardBoundary );
102 //=============================================================================
103 bool HOMARD_Boundary_i::Restore( const std::string& stream )
105 return HOMARD::Restore( *myHomardBoundary, stream );
107 //=============================================================================
108 //=============================================================================
110 //=============================================================================
111 //=============================================================================
112 void HOMARD_Boundary_i::SetType( CORBA::Long Type )
114 ASSERT( myHomardBoundary );
115 myHomardBoundary->SetType( Type );
117 //=============================================================================
118 CORBA::Long HOMARD_Boundary_i::GetType()
120 ASSERT( myHomardBoundary );
121 return CORBA::Long( myHomardBoundary->GetType() );
123 //=============================================================================
124 void HOMARD_Boundary_i::SetMeshName( const char* MeshName )
126 ASSERT( myHomardBoundary );
127 myHomardBoundary->SetMeshName( MeshName );
129 //=============================================================================
130 char* HOMARD_Boundary_i::GetMeshName()
132 ASSERT( myHomardBoundary );
133 return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() );
135 //=============================================================================
136 void HOMARD_Boundary_i::SetMeshFile( const char* MeshFile )
138 ASSERT( myHomardBoundary );
139 myHomardBoundary->SetMeshFile( MeshFile );
140 int PublisMeshIN = _gen_i->GetPublisMeshIN () ;
141 if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(MeshFile, 0); }
143 //=============================================================================
144 char* HOMARD_Boundary_i::GetMeshFile()
146 ASSERT( myHomardBoundary );
147 return CORBA::string_dup( myHomardBoundary->GetMeshFile().c_str() );
149 //=============================================================================
150 void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 )
152 ASSERT( myHomardBoundary );
153 myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 );
155 //=============================================================================
156 void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
158 ASSERT( myHomardBoundary );
159 myHomardBoundary->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
161 //=============================================================================
162 void HOMARD_Boundary_i::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
164 ASSERT( myHomardBoundary );
165 myHomardBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 );
167 //=============================================================================
168 void HOMARD_Boundary_i::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double Zcentre)
170 ASSERT( myHomardBoundary );
171 myHomardBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre );
173 //=============================================================================
174 HOMARD::double_array* HOMARD_Boundary_i::GetCoords()
176 ASSERT( myHomardBoundary );
177 HOMARD::double_array_var aResult = new HOMARD::double_array();
178 std::vector<double> mesCoor = myHomardBoundary->GetCoords();
179 aResult->length( mesCoor .size() );
180 std::vector<double>::const_iterator it;
182 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
183 aResult[i++] = (*it);
184 return aResult._retn();
186 //=============================================================================
187 void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr )
189 ASSERT( myHomardBoundary );
190 myHomardBoundary->SetLimit( Xincr, Yincr, Zincr );
192 //=============================================================================
193 HOMARD::double_array* HOMARD_Boundary_i::GetLimit()
195 ASSERT( myHomardBoundary );
196 HOMARD::double_array_var aResult = new HOMARD::double_array();
197 std::vector<double> mesCoor = myHomardBoundary->GetLimit();
198 aResult->length( mesCoor .size() );
199 std::vector<double>::const_iterator it;
201 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
202 aResult[i++] = (*it);
203 return aResult._retn();
205 //=============================================================================
206 void HOMARD_Boundary_i::AddGroup( const char* Group)
208 ASSERT( myHomardBoundary );
209 myHomardBoundary->AddGroup( Group );
211 //=============================================================================
212 void HOMARD_Boundary_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
214 ASSERT( myHomardBoundary );
215 std::list<std::string> ListString;
216 for ( int i = 0; i < ListGroup.length(); i++ )
218 ListString.push_back(std::string(ListGroup[i]));
220 myHomardBoundary->SetGroups( ListString );
222 //=============================================================================
223 HOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups()
225 ASSERT( myHomardBoundary );
226 const std::list<std::string>& ListString = myHomardBoundary->GetGroups();
227 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
228 aResult->length( ListString.size() );
229 std::list<std::string>::const_iterator it;
231 for ( it = ListString.begin(); it != ListString.end(); it++ )
233 aResult[i++] = CORBA::string_dup( (*it).c_str() );
235 return aResult._retn();
237 //=============================================================================
238 //=============================================================================
239 // Liens avec les autres structures
240 //=============================================================================
241 //=============================================================================
242 void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation )
244 ASSERT( myHomardBoundary );
245 myHomardBoundary->SetCaseCreation( NomCaseCreation );
247 //=============================================================================
248 char* HOMARD_Boundary_i::GetCaseCreation()
250 ASSERT( myHomardBoundary );
251 return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() );