Salome HOME
Préférences pour le type de test de convergence des schémas YACS
[modules/homard.git] / src / HOMARD_I / HOMARD_YACS_i.cxx
1 // Copyright (C) 2011-2013  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.
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 // Remarques :
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
25 //
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
27 //
28
29 #include "HOMARD_YACS_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_YACS.hxx"
32 #include "HOMARD_DriverTools.hxx"
33
34 #include "SALOMEDS_Tool.hxx"
35
36 #include "utilities.h"
37
38 //=============================================================================
39 /*!
40  *  standard constructor
41  */
42 //=============================================================================
43 HOMARD_YACS_i::HOMARD_YACS_i()
44 {
45   MESSAGE( "Default constructor, not for use" );
46   ASSERT( 0 );
47 }
48 //=============================================================================
49 /*!
50  *  standard constructor
51  */
52 //=============================================================================
53 HOMARD_YACS_i::HOMARD_YACS_i( CORBA::ORB_ptr orb,
54                                         HOMARD::HOMARD_Gen_var engine )
55 {
56   MESSAGE("constructor");
57   _gen_i = engine;
58   _orb = orb;
59   myHomardYACS = new ::HOMARD_YACS();
60   ASSERT( myHomardYACS );
61 }
62 //=============================================================================
63 /*!
64  *  standard destructor
65  */
66 //=============================================================================
67 HOMARD_YACS_i::~HOMARD_YACS_i()
68 {
69 }
70 //=============================================================================
71 //=============================================================================
72 // Generalites
73 //=============================================================================
74 //=============================================================================
75 void HOMARD_YACS_i::SetName( const char* Name )
76 {
77   ASSERT( myHomardYACS );
78   myHomardYACS->SetName( Name );
79 }
80 //=============================================================================
81 char* HOMARD_YACS_i::GetName()
82 {
83   ASSERT( myHomardYACS );
84   return CORBA::string_dup( myHomardYACS->GetName().c_str() );
85 }
86 //=============================================================================
87 CORBA::Long HOMARD_YACS_i::Delete( CORBA::Long Option )
88 {
89   ASSERT( myHomardYACS );
90   char* YACSName = GetName() ;
91   MESSAGE ( "Delete : destruction du schema " << YACSName << ", Option = " << Option );
92   return _gen_i->DeleteYACS(YACSName, Option) ;
93 }
94 //=============================================================================
95 char* HOMARD_YACS_i::GetDumpPython()
96 {
97   ASSERT( myHomardYACS );
98   return CORBA::string_dup( myHomardYACS->GetDumpPython().c_str() );
99 }
100 //=============================================================================
101 std::string HOMARD_YACS_i::Dump() const
102 {
103   return HOMARD::Dump( *myHomardYACS );
104 }
105 //=============================================================================
106 bool HOMARD_YACS_i::Restore( const std::string& stream )
107 {
108   return HOMARD::Restore( *myHomardYACS, stream );
109 }
110 //=============================================================================
111 //=============================================================================
112 // Caracteristiques
113 //=============================================================================
114 //=============================================================================
115 void HOMARD_YACS_i::SetType( CORBA::Long Type )
116 {
117   ASSERT( myHomardYACS );
118   myHomardYACS->SetType( Type );
119 }
120 //=============================================================================
121 CORBA::Long HOMARD_YACS_i::GetType()
122 {
123   ASSERT( myHomardYACS );
124   return  CORBA::Long( myHomardYACS->GetType() );
125 }
126 //=============================================================================
127 //=============================================================================
128 // Caracteristiques de la convergence
129 //=============================================================================
130 //=============================================================================
131 void HOMARD_YACS_i::SetMaxIter( CORBA::Long MaxIter )
132 {
133   ASSERT( myHomardYACS );
134   myHomardYACS->SetMaxIter( MaxIter );
135 }
136 //=============================================================================
137 CORBA::Long HOMARD_YACS_i::GetMaxIter()
138 {
139   ASSERT( myHomardYACS );
140   return  CORBA::Long( myHomardYACS->GetMaxIter() );
141 }
142 //=============================================================================
143 void HOMARD_YACS_i::SetMaxNode( CORBA::Long MaxNode )
144 {
145   ASSERT( myHomardYACS );
146   myHomardYACS->SetMaxNode( MaxNode );
147 }
148 //=============================================================================
149 CORBA::Long HOMARD_YACS_i::GetMaxNode()
150 {
151   ASSERT( myHomardYACS );
152   return  CORBA::Long( myHomardYACS->GetMaxNode() );
153 }
154 //=============================================================================
155 void HOMARD_YACS_i::SetMaxElem( CORBA::Long MaxElem )
156 {
157   ASSERT( myHomardYACS );
158   myHomardYACS->SetMaxElem( MaxElem );
159 }
160 //=============================================================================
161 CORBA::Long HOMARD_YACS_i::GetMaxElem()
162 {
163   ASSERT( myHomardYACS );
164   return  CORBA::Long( myHomardYACS->GetMaxElem() );
165 }
166 //=============================================================================
167 void HOMARD_YACS_i::SetTestConvergence( CORBA::Long TypeTest, CORBA::Double VRef)
168 {
169   ASSERT( myHomardYACS );
170   myHomardYACS->SetTestConvergence( TypeTest, VRef );
171 }
172 //=============================================================================
173 CORBA::Long HOMARD_YACS_i::GetTestConvergenceType()
174 {
175   ASSERT( myHomardYACS );
176   return  CORBA::Long( myHomardYACS->GetTestConvergenceType() );
177 }
178 //=============================================================================
179 CORBA::Double HOMARD_YACS_i::GetTestConvergenceVRef()
180 {
181   ASSERT( myHomardYACS );
182   return  CORBA::Long( myHomardYACS->GetTestConvergenceVRef() );
183 }
184 //=============================================================================
185 //=============================================================================
186 // Repertoire et fichiers
187 //=============================================================================
188 //=============================================================================
189 void HOMARD_YACS_i::SetDirName( const char* NomDir )
190 {
191   ASSERT( myHomardYACS );
192   myHomardYACS->SetDirName( NomDir );
193 }
194 //=============================================================================
195 char* HOMARD_YACS_i::GetDirName()
196 {
197   ASSERT( myHomardYACS );
198   return CORBA::string_dup( myHomardYACS->GetDirName().c_str() );
199 }
200 //=============================================================================
201 void HOMARD_YACS_i::SetMeshFile( const char* MeshFile )
202 {
203   ASSERT( myHomardYACS );
204   myHomardYACS->SetMeshFile( MeshFile );
205 }
206 //=============================================================================
207 char* HOMARD_YACS_i::GetMeshFile()
208 {
209   ASSERT( myHomardYACS );
210   return CORBA::string_dup( myHomardYACS->GetMeshFile().c_str() );
211 }
212 //=============================================================================
213 void HOMARD_YACS_i::SetScriptFile( const char* ScriptFile )
214 {
215   ASSERT( myHomardYACS );
216   myHomardYACS->SetScriptFile( ScriptFile );
217 }
218 //=============================================================================
219 char* HOMARD_YACS_i::GetScriptFile()
220 {
221   ASSERT( myHomardYACS );
222   return CORBA::string_dup( myHomardYACS->GetScriptFile().c_str() );
223 }
224 //=============================================================================
225 void HOMARD_YACS_i::SetXMLFile( const char* XMLFile )
226 {
227   ASSERT( myHomardYACS );
228   MESSAGE ( "SetXMLFile : SetXMLFile = " << XMLFile );
229   myHomardYACS->SetXMLFile( XMLFile );
230 }
231 //=============================================================================
232 char* HOMARD_YACS_i::GetXMLFile()
233 {
234   ASSERT( myHomardYACS );
235   return CORBA::string_dup( myHomardYACS->GetXMLFile().c_str() );
236 }
237 //=============================================================================
238 //=============================================================================
239 // Liens avec les autres structures
240 //=============================================================================
241 //=============================================================================
242 void HOMARD_YACS_i::SetCaseName( const char* NomCas )
243 {
244   ASSERT( myHomardYACS );
245   myHomardYACS->SetCaseName( NomCas );
246 }
247 //=============================================================================
248 char* HOMARD_YACS_i::GetCaseName()
249 {
250   ASSERT( myHomardYACS );
251   return CORBA::string_dup( myHomardYACS->GetCaseName().c_str() );
252 }
253 //=============================================================================
254 CORBA::Long HOMARD_YACS_i::Write()
255 {
256 //
257   char* nomYACS = GetName() ;
258   return _gen_i->YACSWrite(nomYACS) ;
259 }
260 //=============================================================================
261 CORBA::Long HOMARD_YACS_i::WriteOnFile( const char* XMLFile )
262 {
263   MESSAGE ( "WriteOnFile : ecriture du schema sur " << XMLFile );
264   ASSERT( myHomardYACS );
265 //
266 // Memorisation du fichier associe
267   SetXMLFile( XMLFile ) ;
268 //
269 // Nom du schema
270   char* nomYACS = GetName() ;
271   return _gen_i->YACSWriteOnFile(nomYACS, XMLFile) ;
272 }
273 //=============================================================================
274 //=============================================================================
275 //=============================================================================
276 // Divers
277 //=============================================================================
278 //=============================================================================