1 // Copyright (C) 2011-2020 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
21 // L'ordre de description des fonctions est le meme dans tous les fichiers
22 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
23 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
24 // 2. Les caracteristiques
25 // 3. Le lien avec les autres structures
27 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
29 #include "HOMARD_Boundary_i.hxx"
30 #include "ADAPT_Gen_i.hxx"
31 #include "HOMARD_Boundary.hxx"
32 #include "HOMARD_DriverTools.hxx"
34 #include "utilities.h"
36 //=============================================================================
38 * standard constructor
40 //=============================================================================
41 HOMARD_Boundary_i::HOMARD_Boundary_i()
43 MESSAGE( "Default constructor, not for use" );
46 //=============================================================================
48 * standard constructor
50 //=============================================================================
51 HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb,
52 ADAPT::ADAPT_Gen_var engine )
54 MESSAGE( "HOMARD_Boundary_i" );
57 myHomardBoundary = new ::HOMARD_Boundary();
58 ASSERT( myHomardBoundary );
60 //=============================================================================
64 //=============================================================================
65 HOMARD_Boundary_i::~HOMARD_Boundary_i()
68 //=============================================================================
69 //=============================================================================
71 //=============================================================================
72 //=============================================================================
73 void HOMARD_Boundary_i::SetName( const char* Name )
75 ASSERT( myHomardBoundary );
76 myHomardBoundary->SetName( Name );
78 //=============================================================================
79 char* HOMARD_Boundary_i::GetName()
81 ASSERT( myHomardBoundary );
82 return CORBA::string_dup( myHomardBoundary->GetName().c_str() );
84 //=============================================================================
85 CORBA::Long HOMARD_Boundary_i::Delete()
87 ASSERT( myHomardBoundary );
88 char* BoundaryName = GetName() ;
89 MESSAGE ( "Delete : destruction de la frontiere " << BoundaryName );
90 return _gen_i->DeleteBoundary(BoundaryName) ;
92 //=============================================================================
93 char* HOMARD_Boundary_i::GetDumpPython()
95 ASSERT( myHomardBoundary );
96 return CORBA::string_dup( myHomardBoundary->GetDumpPython().c_str() );
98 //=============================================================================
99 std::string HOMARD_Boundary_i::Dump() const
101 return ADAPT::Dump( *myHomardBoundary );
103 //=============================================================================
104 bool HOMARD_Boundary_i::Restore( const std::string& stream )
106 return ADAPT::Restore( *myHomardBoundary, stream );
108 //=============================================================================
109 //=============================================================================
111 //=============================================================================
112 //=============================================================================
113 void HOMARD_Boundary_i::SetType( CORBA::Long Type )
115 ASSERT( myHomardBoundary );
116 myHomardBoundary->SetType( Type );
118 //=============================================================================
119 CORBA::Long HOMARD_Boundary_i::GetType()
121 ASSERT( myHomardBoundary );
122 return CORBA::Long( myHomardBoundary->GetType() );
124 //=============================================================================
125 void HOMARD_Boundary_i::SetMeshName( const char* MeshName )
127 ASSERT( myHomardBoundary );
128 myHomardBoundary->SetMeshName( MeshName );
130 //=============================================================================
131 char* HOMARD_Boundary_i::GetMeshName()
133 ASSERT( myHomardBoundary );
134 return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() );
136 //=============================================================================
137 void HOMARD_Boundary_i::SetDataFile( const char* DataFile )
139 ASSERT( myHomardBoundary );
140 myHomardBoundary->SetDataFile( DataFile );
141 int PublisMeshIN = _gen_i->GetPublisMeshIN () ;
142 if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(DataFile, 0); }
144 //=============================================================================
145 char* HOMARD_Boundary_i::GetDataFile()
147 ASSERT( myHomardBoundary );
148 return CORBA::string_dup( myHomardBoundary->GetDataFile().c_str() );
150 //=============================================================================
151 void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 )
153 ASSERT( myHomardBoundary );
154 myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 );
156 //=============================================================================
157 void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
159 ASSERT( myHomardBoundary );
160 myHomardBoundary->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
162 //=============================================================================
163 void HOMARD_Boundary_i::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
165 ASSERT( myHomardBoundary );
166 myHomardBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 );
168 //=============================================================================
169 void HOMARD_Boundary_i::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double Zcentre)
171 ASSERT( myHomardBoundary );
172 myHomardBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre );
174 //=============================================================================
175 void HOMARD_Boundary_i::SetTorus( double X0, double X1, double X2, double X3, double X4, double X5, double X6, double X7 )
177 ASSERT( myHomardBoundary );
178 myHomardBoundary->SetTorus( X0, X1, X2, X3, X4, X5, X6, X7 );
180 //=============================================================================
181 ADAPT::double_array* HOMARD_Boundary_i::GetCoords()
183 ASSERT( myHomardBoundary );
184 ADAPT::double_array_var aResult = new ADAPT::double_array();
185 std::vector<double> mesCoor = myHomardBoundary->GetCoords();
186 aResult->length( mesCoor .size() );
187 std::vector<double>::const_iterator it;
189 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
190 aResult[i++] = (*it);
191 return aResult._retn();
193 //=============================================================================
194 void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr )
196 ASSERT( myHomardBoundary );
197 myHomardBoundary->SetLimit( Xincr, Yincr, Zincr );
199 //=============================================================================
200 ADAPT::double_array* HOMARD_Boundary_i::GetLimit()
202 ASSERT( myHomardBoundary );
203 ADAPT::double_array_var aResult = new ADAPT::double_array();
204 std::vector<double> mesCoor = myHomardBoundary->GetLimit();
205 aResult->length( mesCoor .size() );
206 std::vector<double>::const_iterator it;
208 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
209 aResult[i++] = (*it);
210 return aResult._retn();
212 //=============================================================================
213 void HOMARD_Boundary_i::AddGroup( const char* Group)
215 ASSERT( myHomardBoundary );
216 myHomardBoundary->AddGroup( Group );
218 //=============================================================================
219 void HOMARD_Boundary_i::SetGroups(const ADAPT::ListGroupType& ListGroup)
221 ASSERT( myHomardBoundary );
222 std::list<std::string> ListString;
223 for ( int i = 0; i < ListGroup.length(); i++ )
225 ListString.push_back(std::string(ListGroup[i]));
227 myHomardBoundary->SetGroups( ListString );
229 //=============================================================================
230 ADAPT::ListGroupType* HOMARD_Boundary_i::GetGroups()
232 ASSERT( myHomardBoundary );
233 const std::list<std::string>& ListString = myHomardBoundary->GetGroups();
234 ADAPT::ListGroupType_var aResult = new ADAPT::ListGroupType;
235 aResult->length( ListString.size() );
236 std::list<std::string>::const_iterator it;
238 for ( it = ListString.begin(); it != ListString.end(); it++ )
240 aResult[i++] = CORBA::string_dup( (*it).c_str() );
242 return aResult._retn();
244 //=============================================================================
245 //=============================================================================
246 // Liens avec les autres structures
247 //=============================================================================
248 //=============================================================================
249 void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation )
251 ASSERT( myHomardBoundary );
252 myHomardBoundary->SetCaseCreation( NomCaseCreation );
254 //=============================================================================
255 char* HOMARD_Boundary_i::GetCaseCreation()
257 ASSERT( myHomardBoundary );
258 return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() );