1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2011 CEA/DEN, EDF R&D
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.
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.
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
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : HOMARD_Cas.cxx
22 // Author : Paul RASCLE, EDF
25 #include "HOMARD_Cas.hxx"
26 #include "utilities.h"
29 //=============================================================================
31 * default constructor:
32 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
34 //=============================================================================
35 HOMARD_Cas::HOMARD_Cas():
36 _NomCas(""), _NomDir("/tmp"), _ConfType(1)
38 MESSAGE("HOMARD_Cas");
40 //=============================================================================
41 HOMARD_Cas::~HOMARD_Cas()
42 //=============================================================================
44 MESSAGE("~HOMARD_Cas");
47 //=============================================================================
48 void HOMARD_Cas::SetDirName( const char* NomDir )
49 //=============================================================================
51 MESSAGE("SetDirName, NomDir : "<<NomDir);
52 if (chdir(NomDir) == 0)
54 _NomDir = std::string( NomDir );
58 // GERALD -- QMESSAGE BOX
59 // std::cerr << "Pb pour entrer dans le repertoire : "<<NomDir << std::endl;
64 //=============================================================================
65 std::string HOMARD_Cas::GetDirName() const
66 //=============================================================================
71 //=============================================================================
72 void HOMARD_Cas::SetName( const char* NomCas )
73 //=============================================================================
75 _NomCas = std::string( NomCas );
78 //=============================================================================
79 std::string HOMARD_Cas::GetName() const
80 //=============================================================================
86 //=============================================================================
87 std::string HOMARD_Cas::GetDumpPython() const
88 //=============================================================================
90 std::ostringstream aScript;
91 aScript << "\t" <<_NomCas << ".SetDirName(\"";
92 aScript << _NomDir << "\")\n";
93 aScript << "\t" <<_NomCas << ".SetConfType(";
94 aScript << _ConfType << ")\n";
95 // Suivi de frontieres
96 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
97 while(it != _ListBoundaryGroup.end())
99 aScript << "\t" <<_NomCas << ".AddBoundaryGroup(\"";
100 aScript << *it << "\", \"";
102 aScript << *it << "\")\n";
107 aScript << "\t" <<_NomCas << ".SetPyram(";
108 aScript << _Pyram << ")\n";
111 return aScript.str();
113 //=============================================================================
114 void HOMARD_Cas::AddIteration( const char* NomIteration )
115 //=============================================================================
117 _ListIter.push_back( std::string( NomIteration ) );
120 //=============================================================================
121 const std::list<std::string>& HOMARD_Cas::GetIterations() const
122 //=============================================================================
127 //=============================================================================
128 void HOMARD_Cas::SupprIterations()
129 //=============================================================================
134 //=============================================================================
135 std::string HOMARD_Cas::GetIter0Name() const
136 //=============================================================================
138 // Par construction de la liste, l'iteration a ete mise en tete.
139 return (*(_ListIter.begin()));
142 //=============================================================================
143 void HOMARD_Cas::SetConfType( int Conftype )
144 //=============================================================================
146 _ConfType = Conftype;
148 //=============================================================================
149 const int HOMARD_Cas::GetConfType() const
150 //=============================================================================
154 //=============================================================================
155 int HOMARD_Cas::GetNumber()
156 //=============================================================================
159 return _ListIter.size();
162 // La boite englobante
164 //=============================================================================
165 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
166 //=============================================================================
169 _Boite.resize( extremas.size() );
170 for ( int i = 0; i < extremas.size(); i++ )
171 _Boite[i] = extremas[i];
174 //=============================================================================
175 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
176 //=============================================================================
183 //=============================================================================
184 const std::list<std::string>& HOMARD_Cas::GetGroups() const
185 //=============================================================================
189 //=============================================================================
190 void HOMARD_Cas::SupprGroups()
191 //=============================================================================
195 //=============================================================================
196 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
197 //=============================================================================
200 std::list<std::string>::const_iterator it = ListGroup.begin();
201 while(it != ListGroup.end())
203 _ListGroup.push_back((*it++));
206 //=============================================================================
207 void HOMARD_Cas::AddGroup( const char* Group )
209 _ListGroup.push_back(Group);
214 //=============================================================================
215 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
216 //=============================================================================
218 return _ListBoundaryGroup;
220 //=============================================================================
221 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
223 _ListBoundaryGroup.push_back( Boundary );
224 _ListBoundaryGroup.push_back( Group );
226 //=============================================================================
227 void HOMARD_Cas::SupprBoundaryGroup()
228 //=============================================================================
230 _ListBoundaryGroup.clear();
232 //=============================================================================
233 void HOMARD_Cas::SetPyram( int Pyram )
234 //=============================================================================
236 MESSAGE ("SetPyram, Pyram = " << Pyram );
239 //=============================================================================
240 const int HOMARD_Cas::GetPyram() const
241 //=============================================================================
243 MESSAGE ("GetPyram, Pyram = " << _Pyram );