1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : HOMARD_Cas.cxx
25 // Author : Paul RASCLE, EDF
28 #include "HOMARD_Cas.hxx"
29 #include "utilities.h"
32 //=============================================================================
34 * default constructor:
35 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
37 //=============================================================================
38 HOMARD_Cas::HOMARD_Cas():
39 _NomCas(""), _NomDir("/tmp"), _ConfType(1)
41 MESSAGE("HOMARD_Cas");
43 //=============================================================================
44 HOMARD_Cas::~HOMARD_Cas()
45 //=============================================================================
47 MESSAGE("~HOMARD_Cas");
50 //=============================================================================
51 void HOMARD_Cas::SetDirName( const char* NomDir )
52 //=============================================================================
54 MESSAGE("SetDirName, NomDir : "<<NomDir);
55 if (chdir(NomDir) == 0)
57 _NomDir = std::string( NomDir );
61 // GERALD -- QMESSAGE BOX
62 // std::cerr << "Pb pour entrer dans le repertoire : "<<NomDir << std::endl;
67 //=============================================================================
68 std::string HOMARD_Cas::GetDirName() const
69 //=============================================================================
74 //=============================================================================
75 void HOMARD_Cas::SetName( const char* NomCas )
76 //=============================================================================
78 _NomCas = std::string( NomCas );
81 //=============================================================================
82 std::string HOMARD_Cas::GetName() const
83 //=============================================================================
89 //=============================================================================
90 std::string HOMARD_Cas::GetDumpPython() const
91 //=============================================================================
93 std::ostringstream aScript;
94 aScript << "\t" <<_NomCas << ".SetDirName('";
95 aScript << _NomDir << "')\n";
96 aScript << "\t" <<_NomCas << ".SetConfType(";
97 aScript << _ConfType << ")\n";
98 // Suivi de frontieres
99 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
100 while(it != _ListBoundaryGroup.end())
102 aScript << "\t" <<_NomCas << ".AddBoundaryGroup('";
103 aScript << *it << "', '";
105 aScript << *it << "')\n";
108 return aScript.str();
110 //AddBoundaryGroup( 'cyl_4', 'T2_INT' )
111 //=============================================================================
112 void HOMARD_Cas::AddIteration( const char* NomIteration )
113 //=============================================================================
115 _ListIter.push_back( std::string( NomIteration ) );
118 //=============================================================================
119 const std::list<std::string>& HOMARD_Cas::GetIterations() const
120 //=============================================================================
125 //=============================================================================
126 void HOMARD_Cas::SupprIterations()
127 //=============================================================================
132 //=============================================================================
133 std::string HOMARD_Cas::GetIter0Name() const
134 //=============================================================================
136 // Par construction de la liste, l'iteration a ete mise en tete.
137 return (*(_ListIter.begin()));
140 //=============================================================================
141 void HOMARD_Cas::SetConfType( int Conftype )
142 //=============================================================================
144 _ConfType = Conftype;
146 //=============================================================================
147 const int HOMARD_Cas::GetConfType() const
148 //=============================================================================
152 //=============================================================================
153 int HOMARD_Cas::GetNumber()
154 //=============================================================================
157 return _ListIter.size();
160 // La boite englobante
162 //=============================================================================
163 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
164 //=============================================================================
167 _Boite.resize( extremas.size() );
168 for ( int i = 0; i < extremas.size(); i++ )
169 _Boite[i] = extremas[i];
172 //=============================================================================
173 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
174 //=============================================================================
181 //=============================================================================
182 const std::list<std::string>& HOMARD_Cas::GetGroups() const
183 //=============================================================================
187 //=============================================================================
188 void HOMARD_Cas::SupprGroups()
189 //=============================================================================
193 //=============================================================================
194 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
195 //=============================================================================
198 std::list<std::string>::const_iterator it = ListGroup.begin();
199 while(it != ListGroup.end())
201 _ListGroup.push_back((*it++));
204 //=============================================================================
205 void HOMARD_Cas::AddGroup( const char* Group )
207 _ListGroup.push_back(Group);
212 //=============================================================================
213 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
214 //=============================================================================
216 return _ListBoundaryGroup;
218 //=============================================================================
219 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
221 _ListBoundaryGroup.push_back( Boundary );
222 _ListBoundaryGroup.push_back( Group );
224 //=============================================================================
225 void HOMARD_Cas::SupprBoundaryGroup()
226 //=============================================================================
228 _ListBoundaryGroup.clear();