Salome HOME
updated copyright message
[modules/homard.git] / src / HOMARD / HOMARD_YACS.cxx
1 //  HOMARD HOMARD : implementation of HOMARD idl descriptions
2 //
3 // Copyright (C) 2011-2023  CEA, EDF
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 //  File   : HOMARD_YACS.cxx
22 //  Author : Gerald NICOLAS, EDF
23 //  Module : HOMARD
24 //
25 // Remarques :
26 // L'ordre de description des fonctions est le meme dans tous les fichiers
27 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
28 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
29 // 2. Les caracteristiques
30 // 3. Le lien avec les autres structures
31 //
32 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
33
34 #include "HOMARD_YACS.hxx"
35 #include "utilities.h"
36
37 //=============================================================================
38 /*!
39  *  default constructor:
40  */
41 //=============================================================================
42 HOMARD_YACS::HOMARD_YACS():
43   _Name( "" ),
44   _NomCas( "" ),
45   _NomDir( "" ),
46   _MeshFile( "" ),
47   _ScriptFile( "" )
48 {
49   MESSAGE("HOMARD_YACS");
50 }
51 //=============================================================================
52 /*!
53  *
54  */
55 //=============================================================================
56 HOMARD_YACS::~HOMARD_YACS()
57 {
58   MESSAGE("~HOMARD_YACS");
59 }
60 //=============================================================================
61 //=============================================================================
62 // Generalites
63 //=============================================================================
64 //=============================================================================
65 void HOMARD_YACS::SetName( const char* Name )
66 {
67   _Name = std::string( Name );
68 }
69 //=============================================================================
70 std::string HOMARD_YACS::GetName() const
71 {
72   return _Name;
73 }
74 //=============================================================================
75 std::string HOMARD_YACS::GetDumpPython() const
76 {
77   MESSAGE (". Ecriture du schema " << _Name );
78   std::ostringstream aScript;
79   aScript << "\n# Creation of the schema " << _Name << "\n";
80 // Creation du schema
81   aScript << "\t" << _Name << " = " << _NomCas << ".CreateYACSSchema(\"" << _Name << "\", \"" << _ScriptFile << "\", \"" << _NomDir << "\", \"" << _MeshFile << "\")\n";
82 // Le type de schema
83   aScript << "\t" << _Name << ".SetType(" << _Type << ")\n";
84 // Les controles de convergences
85   if ( _MaxIter > 0 ) { aScript << "\t" << _Name << ".SetMaxIter(" << _MaxIter << ")\n"; }
86   if ( _MaxNode > 0 ) { aScript << "\t" << _Name << ".SetMaxNode(" << _MaxNode << ")\n"; }
87   if ( _MaxElem > 0 ) { aScript << "\t" << _Name << ".SetMaxElem(" << _MaxElem << ")\n"; }
88
89 // L'ecriture du schema
90   aScript << "\tcodret = " << _Name << ".Write()\n";
91
92   MESSAGE (". Fin de l ecriture du schema " << _Name );
93
94   return aScript.str();
95 }
96 //=============================================================================
97 //=============================================================================
98 // Caracteristiques de la convergence
99 //=============================================================================
100 //=============================================================================
101 void HOMARD_YACS::SetType( int Type )
102 {
103   _Type = Type;
104 }
105 //=============================================================================
106 int HOMARD_YACS::GetType() const
107 {
108   return _Type;
109 }
110 //=============================================================================
111 void HOMARD_YACS::SetMaxIter( int MaxIter )
112 {
113   _MaxIter = MaxIter;
114 }
115 //=============================================================================
116 int HOMARD_YACS::GetMaxIter() const
117 {
118   return _MaxIter;
119 }
120 //=============================================================================
121 void HOMARD_YACS::SetMaxNode( int MaxNode )
122 {
123   _MaxNode = MaxNode;
124 }
125 //=============================================================================
126 int HOMARD_YACS::GetMaxNode() const
127 {
128   return _MaxNode;
129 }
130 //=============================================================================
131 void HOMARD_YACS::SetMaxElem( int MaxElem )
132 {
133   _MaxElem = MaxElem;
134 }
135 //=============================================================================
136 int HOMARD_YACS::GetMaxElem() const
137 {
138   return _MaxElem;
139 }
140 //=============================================================================
141 void HOMARD_YACS::SetTestConvergence( int TypeTest, double VRef )
142 {
143   _TypeTest = TypeTest;
144   _VRef = VRef;
145 }
146 //=============================================================================
147 int HOMARD_YACS::GetTestConvergenceType() const
148 {
149   return _TypeTest;
150 }
151 //=============================================================================
152 double HOMARD_YACS::GetTestConvergenceVRef() const
153 {
154   return _VRef;
155 }
156 //=============================================================================
157 //=============================================================================
158 // Repertoire et fichiers
159 //=============================================================================
160 //=============================================================================
161 //=============================================================================
162 void HOMARD_YACS::SetDirName( const char* NomDir )
163 {
164   _NomDir = std::string( NomDir );
165 }
166 //=============================================================================
167 std::string HOMARD_YACS::GetDirName() const
168 {
169    return _NomDir;
170 }
171 //=============================================================================
172 void HOMARD_YACS::SetMeshFile( const char* MeshFile )
173 {
174   _MeshFile = std::string( MeshFile );
175 }
176 //=============================================================================
177 std::string HOMARD_YACS::GetMeshFile() const
178 {
179   return _MeshFile;
180 }
181 //=============================================================================
182 void HOMARD_YACS::SetScriptFile( const char* ScriptFile )
183 {
184   _ScriptFile = std::string( ScriptFile );
185 }
186 //=============================================================================
187 std::string HOMARD_YACS::GetScriptFile() const
188 {
189   return _ScriptFile;
190 }
191 //=============================================================================
192 void HOMARD_YACS::SetXMLFile( const char* XMLFile )
193 {
194   _XMLFile = std::string( XMLFile );
195 }
196 //=============================================================================
197 std::string HOMARD_YACS::GetXMLFile() const
198 {
199   return _XMLFile;
200 }
201 //=============================================================================
202 //=============================================================================
203 // Liens avec les autres structures
204 //=============================================================================
205 //=============================================================================
206 void HOMARD_YACS::SetCaseName( const char* NomCas )
207 {
208   _NomCas = std::string( NomCas );
209 }
210 //=============================================================================
211 std::string HOMARD_YACS::GetCaseName() const
212 {
213   return _NomCas;
214 }
215 //=============================================================================
216 //=============================================================================
217 // Divers
218 //=============================================================================
219 //=============================================================================