1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2011-2013 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
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
32 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
34 #include "HOMARD_Cas.hxx"
35 #include "utilities.h"
42 //=============================================================================
44 * default constructor:
45 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
47 //=============================================================================
48 HOMARD_Cas::HOMARD_Cas():
49 _Name(""), _NomDir("/tmp"), _ConfType(1)
51 MESSAGE("HOMARD_Cas");
53 //=============================================================================
54 HOMARD_Cas::~HOMARD_Cas()
55 //=============================================================================
57 MESSAGE("~HOMARD_Cas");
59 //=============================================================================
60 //=============================================================================
62 //=============================================================================
63 //=============================================================================
64 void HOMARD_Cas::SetName( const char* Name )
66 _Name = std::string( Name );
68 //=============================================================================
69 std::string HOMARD_Cas::GetName() const
73 //=============================================================================
74 std::string HOMARD_Cas::GetDumpPython() const
76 std::ostringstream aScript;
77 aScript << "\t" <<_Name << ".SetDirName(\"";
78 aScript << _NomDir << "\")\n";
79 aScript << "\t" <<_Name << ".SetConfType(";
80 aScript << _ConfType << ")\n";
81 // Suivi de frontieres
82 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
83 while(it != _ListBoundaryGroup.end())
85 aScript << "\t" <<_Name << ".AddBoundaryGroup(\"";
86 aScript << *it << "\", \"";
88 aScript << *it << "\")\n";
93 aScript << "\t" <<_Name << ".SetPyram(";
94 aScript << _Pyram << ")\n";
99 //=============================================================================
100 //=============================================================================
102 //=============================================================================
103 //=============================================================================
104 void HOMARD_Cas::SetDirName( const char* NomDir )
106 MESSAGE("SetDirName, NomDir : "<<NomDir);
107 if (chdir(NomDir) == 0)
109 _NomDir = std::string( NomDir );
113 // GERALD -- QMESSAGE BOX
114 // std::cerr << "Pb pour entrer dans le repertoire : "<<NomDir << std::endl;
118 //=============================================================================
119 std::string HOMARD_Cas::GetDirName() const
123 //=============================================================================
124 int HOMARD_Cas::GetNumber()
126 return _ListIter.size();
128 //=============================================================================
129 void HOMARD_Cas::SetConfType( int Conftype )
131 _ConfType = Conftype;
133 //=============================================================================
134 const int HOMARD_Cas::GetConfType() const
139 // La boite englobante
141 //=============================================================================
142 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
145 _Boite.resize( extremas.size() );
146 for ( int i = 0; i < extremas.size(); i++ )
147 _Boite[i] = extremas[i];
149 //=============================================================================
150 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
157 //=============================================================================
158 void HOMARD_Cas::AddGroup( const char* Group )
160 _ListGroup.push_back(Group);
162 //=============================================================================
163 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
166 std::list<std::string>::const_iterator it = ListGroup.begin();
167 while(it != ListGroup.end())
169 _ListGroup.push_back((*it++));
172 //=============================================================================
173 const std::list<std::string>& HOMARD_Cas::GetGroups() const
177 //=============================================================================
178 void HOMARD_Cas::SupprGroups()
185 //=============================================================================
186 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
188 _ListBoundaryGroup.push_back( Boundary );
189 _ListBoundaryGroup.push_back( Group );
191 //=============================================================================
192 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
194 return _ListBoundaryGroup;
196 //=============================================================================
197 void HOMARD_Cas::SupprBoundaryGroup()
199 _ListBoundaryGroup.clear();
201 //=============================================================================
202 void HOMARD_Cas::SetPyram( int Pyram )
206 //=============================================================================
207 const int HOMARD_Cas::GetPyram() const
211 //=============================================================================
212 //=============================================================================
213 // Liens avec les autres structures
214 //=============================================================================
215 //=============================================================================
216 std::string HOMARD_Cas::GetIter0Name() const
218 // Par construction de la liste, l'iteration a ete mise en tete.
219 return (*(_ListIter.begin()));
221 //=============================================================================
222 void HOMARD_Cas::AddIteration( const char* NomIteration )
224 _ListIter.push_back( std::string( NomIteration ) );
226 //=============================================================================
227 const std::list<std::string>& HOMARD_Cas::GetIterations() const
231 //=============================================================================
232 void HOMARD_Cas::SupprIterations()