1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2011-2012 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"
33 //=============================================================================
35 * default constructor:
36 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
38 //=============================================================================
39 HOMARD_Cas::HOMARD_Cas():
40 _NomCas(""), _NomDir("/tmp"), _ConfType(1)
42 MESSAGE("HOMARD_Cas");
44 //=============================================================================
45 HOMARD_Cas::~HOMARD_Cas()
46 //=============================================================================
48 MESSAGE("~HOMARD_Cas");
51 //=============================================================================
52 void HOMARD_Cas::SetDirName( const char* NomDir )
53 //=============================================================================
55 MESSAGE("SetDirName, NomDir : "<<NomDir);
56 if (chdir(NomDir) == 0)
58 _NomDir = std::string( NomDir );
62 // GERALD -- QMESSAGE BOX
63 // std::cerr << "Pb pour entrer dans le repertoire : "<<NomDir << std::endl;
68 //=============================================================================
69 std::string HOMARD_Cas::GetDirName() const
70 //=============================================================================
75 //=============================================================================
76 void HOMARD_Cas::SetName( const char* NomCas )
77 //=============================================================================
79 _NomCas = std::string( NomCas );
82 //=============================================================================
83 std::string HOMARD_Cas::GetName() const
84 //=============================================================================
90 //=============================================================================
91 std::string HOMARD_Cas::GetDumpPython() const
92 //=============================================================================
94 std::ostringstream aScript;
95 aScript << "\t" <<_NomCas << ".SetDirName(\"";
96 aScript << _NomDir << "\")\n";
97 aScript << "\t" <<_NomCas << ".SetConfType(";
98 aScript << _ConfType << ")\n";
99 // Suivi de frontieres
100 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
101 while(it != _ListBoundaryGroup.end())
103 aScript << "\t" <<_NomCas << ".AddBoundaryGroup(\"";
104 aScript << *it << "\", \"";
106 aScript << *it << "\")\n";
111 aScript << "\t" <<_NomCas << ".SetPyram(";
112 aScript << _Pyram << ")\n";
115 return aScript.str();
117 //=============================================================================
118 void HOMARD_Cas::AddIteration( const char* NomIteration )
119 //=============================================================================
121 _ListIter.push_back( std::string( NomIteration ) );
124 //=============================================================================
125 const std::list<std::string>& HOMARD_Cas::GetIterations() const
126 //=============================================================================
131 //=============================================================================
132 void HOMARD_Cas::SupprIterations()
133 //=============================================================================
138 //=============================================================================
139 std::string HOMARD_Cas::GetIter0Name() const
140 //=============================================================================
142 // Par construction de la liste, l'iteration a ete mise en tete.
143 return (*(_ListIter.begin()));
146 //=============================================================================
147 void HOMARD_Cas::SetConfType( int Conftype )
148 //=============================================================================
150 _ConfType = Conftype;
152 //=============================================================================
153 const int HOMARD_Cas::GetConfType() const
154 //=============================================================================
158 //=============================================================================
159 int HOMARD_Cas::GetNumber()
160 //=============================================================================
163 return _ListIter.size();
166 // La boite englobante
168 //=============================================================================
169 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
170 //=============================================================================
173 _Boite.resize( extremas.size() );
174 for ( int i = 0; i < extremas.size(); i++ )
175 _Boite[i] = extremas[i];
178 //=============================================================================
179 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
180 //=============================================================================
187 //=============================================================================
188 const std::list<std::string>& HOMARD_Cas::GetGroups() const
189 //=============================================================================
193 //=============================================================================
194 void HOMARD_Cas::SupprGroups()
195 //=============================================================================
199 //=============================================================================
200 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
201 //=============================================================================
204 std::list<std::string>::const_iterator it = ListGroup.begin();
205 while(it != ListGroup.end())
207 _ListGroup.push_back((*it++));
210 //=============================================================================
211 void HOMARD_Cas::AddGroup( const char* Group )
213 _ListGroup.push_back(Group);
218 //=============================================================================
219 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
220 //=============================================================================
222 return _ListBoundaryGroup;
224 //=============================================================================
225 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
227 _ListBoundaryGroup.push_back( Boundary );
228 _ListBoundaryGroup.push_back( Group );
230 //=============================================================================
231 void HOMARD_Cas::SupprBoundaryGroup()
232 //=============================================================================
234 _ListBoundaryGroup.clear();
236 //=============================================================================
237 void HOMARD_Cas::SetPyram( int Pyram )
238 //=============================================================================
240 MESSAGE ("SetPyram, Pyram = " << Pyram );
243 //=============================================================================
244 const int HOMARD_Cas::GetPyram() const
245 //=============================================================================
247 MESSAGE ("GetPyram, Pyram = " << _Pyram );