Salome HOME
MeshFormatWriter and MeshFormaReader are in MEDCOUPLING namespace
[modules/smesh.git] / src / ADAPT_I / HOMARD_Boundary_i.cxx
1 // Copyright (C) 2011-2020  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // Remarques :
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
26 //
27 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
28 //
29 #include "HOMARD_Boundary_i.hxx"
30 #include "ADAPT_Gen_i.hxx"
31 #include "HOMARD_Boundary.hxx"
32 #include "HOMARD_DriverTools.hxx"
33
34 #include "utilities.h"
35
36 //=============================================================================
37 /*!
38  *  standard constructor
39  */
40 //=============================================================================
41 HOMARD_Boundary_i::HOMARD_Boundary_i()
42 {
43   MESSAGE( "Default constructor, not for use" );
44   ASSERT( 0 );
45 }
46 //=============================================================================
47 /*!
48  *  standard constructor
49  */
50 //=============================================================================
51 HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb,
52                               ADAPT::ADAPT_Gen_var engine )
53 {
54   MESSAGE( "HOMARD_Boundary_i" );
55   _gen_i = engine;
56   _orb = orb;
57   myHomardBoundary = new ::HOMARD_Boundary();
58   ASSERT( myHomardBoundary );
59 }
60 //=============================================================================
61 /*!
62  *  standard destructor
63  */
64 //=============================================================================
65 HOMARD_Boundary_i::~HOMARD_Boundary_i()
66 {
67 }
68 //=============================================================================
69 //=============================================================================
70 // Generalites
71 //=============================================================================
72 //=============================================================================
73 void HOMARD_Boundary_i::SetName( const char* Name )
74 {
75   ASSERT( myHomardBoundary );
76   myHomardBoundary->SetName( Name );
77 }
78 //=============================================================================
79 char* HOMARD_Boundary_i::GetName()
80 {
81   ASSERT( myHomardBoundary );
82   return CORBA::string_dup( myHomardBoundary->GetName().c_str() );
83 }
84 //=============================================================================
85 CORBA::Long  HOMARD_Boundary_i::Delete()
86 {
87   ASSERT( myHomardBoundary );
88   char* BoundaryName = GetName() ;
89   MESSAGE ( "Delete : destruction de la frontiere " << BoundaryName );
90   return _gen_i->DeleteBoundary(BoundaryName) ;
91 }
92 //=============================================================================
93 char* HOMARD_Boundary_i::GetDumpPython()
94 {
95   ASSERT( myHomardBoundary );
96   return CORBA::string_dup( myHomardBoundary->GetDumpPython().c_str() );
97 }
98 //=============================================================================
99 std::string HOMARD_Boundary_i::Dump() const
100 {
101   return ADAPT::Dump( *myHomardBoundary );
102 }
103 //=============================================================================
104 bool HOMARD_Boundary_i::Restore( const std::string& stream )
105 {
106   return ADAPT::Restore( *myHomardBoundary, stream );
107 }
108 //=============================================================================
109 //=============================================================================
110 // Caracteristiques
111 //=============================================================================
112 //=============================================================================
113 void HOMARD_Boundary_i::SetType( CORBA::Long Type )
114 {
115   ASSERT( myHomardBoundary );
116   myHomardBoundary->SetType( Type );
117 }
118 //=============================================================================
119 CORBA::Long HOMARD_Boundary_i::GetType()
120 {
121   ASSERT( myHomardBoundary );
122   return  CORBA::Long( myHomardBoundary->GetType() );
123 }
124 //=============================================================================
125 void HOMARD_Boundary_i::SetMeshName( const char* MeshName )
126 {
127   ASSERT( myHomardBoundary );
128   myHomardBoundary->SetMeshName( MeshName );
129 }
130 //=============================================================================
131 char* HOMARD_Boundary_i::GetMeshName()
132 {
133   ASSERT( myHomardBoundary );
134   return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() );
135 }
136 //=============================================================================
137 void HOMARD_Boundary_i::SetDataFile( const char* DataFile )
138 {
139   ASSERT( myHomardBoundary );
140   myHomardBoundary->SetDataFile( DataFile );
141   int PublisMeshIN = _gen_i->GetPublisMeshIN () ;
142   if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(DataFile, 0); }
143 }
144 //=============================================================================
145 char* HOMARD_Boundary_i::GetDataFile()
146 {
147   ASSERT( myHomardBoundary );
148   return CORBA::string_dup( myHomardBoundary->GetDataFile().c_str() );
149 }
150 //=============================================================================
151 void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 )
152 {
153   ASSERT( myHomardBoundary );
154   myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 );
155 }
156 //=============================================================================
157 void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
158 {
159   ASSERT( myHomardBoundary );
160   myHomardBoundary->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
161 }
162 //=============================================================================
163 void HOMARD_Boundary_i::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
164 {
165   ASSERT( myHomardBoundary );
166   myHomardBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 );
167 }
168 //=============================================================================
169 void HOMARD_Boundary_i::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double Zcentre)
170 {
171   ASSERT( myHomardBoundary );
172   myHomardBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre );
173 }
174 //=============================================================================
175 void HOMARD_Boundary_i::SetTorus( double X0, double X1, double X2, double X3, double X4, double X5, double X6, double X7 )
176 {
177   ASSERT( myHomardBoundary );
178   myHomardBoundary->SetTorus( X0, X1, X2, X3, X4, X5, X6, X7 );
179 }
180 //=============================================================================
181 ADAPT::double_array* HOMARD_Boundary_i::GetCoords()
182 {
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;
188   int i = 0;
189   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
190     aResult[i++] = (*it);
191   return aResult._retn();
192 }
193 //=============================================================================
194 void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr )
195 {
196   ASSERT( myHomardBoundary );
197   myHomardBoundary->SetLimit( Xincr, Yincr, Zincr );
198 }
199 //=============================================================================
200 ADAPT::double_array* HOMARD_Boundary_i::GetLimit()
201 {
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;
207   int i = 0;
208   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
209     aResult[i++] = (*it);
210   return aResult._retn();
211 }
212 //=============================================================================
213 void HOMARD_Boundary_i::AddGroup( const char* Group)
214 {
215   ASSERT( myHomardBoundary );
216   myHomardBoundary->AddGroup( Group );
217 }
218 //=============================================================================
219 void HOMARD_Boundary_i::SetGroups(const ADAPT::ListGroupType& ListGroup)
220 {
221   ASSERT( myHomardBoundary );
222   std::list<std::string> ListString;
223   for ( int i = 0; i < ListGroup.length(); i++ )
224   {
225       ListString.push_back(std::string(ListGroup[i]));
226   }
227   myHomardBoundary->SetGroups( ListString );
228 }
229 //=============================================================================
230 ADAPT::ListGroupType*  HOMARD_Boundary_i::GetGroups()
231 {
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;
237   int i = 0;
238   for ( it = ListString.begin(); it != ListString.end(); it++ )
239   {
240     aResult[i++] = CORBA::string_dup( (*it).c_str() );
241   }
242   return aResult._retn();
243 }
244 //=============================================================================
245 //=============================================================================
246 // Liens avec les autres structures
247 //=============================================================================
248 //=============================================================================
249 void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation )
250 {
251   ASSERT( myHomardBoundary );
252   myHomardBoundary->SetCaseCreation( NomCaseCreation );
253 }
254 //=============================================================================
255 char* HOMARD_Boundary_i::GetCaseCreation()
256 {
257   ASSERT( myHomardBoundary );
258   return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() );
259 }
260
261
262