1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2021 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, or (at your option) any later version.
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_Boundary.cxx
22 // Author : Gerald NICOLAS, 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 "SMESH_Homard.hxx"
36 #include <Utils_SALOME_Exception.hxx>
37 #include <utilities.h>
50 namespace SMESHHOMARDImpl
53 std::string SEPARATOR = "|" ;
56 \brief Read next chunk of data from the string
59 The function tries to read next chunk of the data from the input string \a str.
60 The parameter \a start specifies the start position of next chunk. If the operation
61 read the chunk successfully, after its completion this parameter will refer to the
62 start position of the next chunk. The function returns resulting chunk as a string.
63 The status of the operation is returned via \a ok parameter.
65 \param str source data stream string
66 \param start start position to get next chunk
67 \param ok in this variable the status of the chunk reading operation is returned
68 \return next chunk read from the string
70 static std::string getNextChunk( const std::string& str, std::string::size_type& start, bool& ok )
72 std::string chunk = "";
74 if ( start <= str.size() ) {
75 std::string::size_type end = str.find( separator(), start );
76 chunk = str.substr( start, end == std::string::npos ? std::string::npos : end-start );
77 start = end == std::string::npos ? str.size()+1 : end + separator().size();
84 \brief Get persistence signature
85 \param type persistence entity type
86 \return persistence signature
88 std::string GetSignature( SignatureType type )
90 std::string signature = "";
92 case Case: signature = "CASE"; break;
93 case Zone: signature = "ZONE"; break;
94 case Hypothesis: signature = "HYPO"; break;
95 case Iteration: signature = "ITER"; break;
96 case Boundary: signature = "BOUNDARY"; break;
99 signature += separator();
104 \brief Get data separator
105 \return string that is used to separate data entities in the stream
107 std::string separator()
112 // =======================
114 // =======================
116 \brief Dump case to the string
117 \param cas case being dumped
118 \return string representation of the case
120 std::string Dump( const HOMARD_Cas& cas )
122 std::stringstream os;
125 MESSAGE( ". Sauvegarde du cas "<<cas.GetName());
127 os << separator() << cas.GetDirName();
128 os << separator() << cas.GetConfType();
129 os << separator() << cas.GetExtType();
131 std::vector<double> coor = cas.GetBoundingBox();
132 os << separator() << coor.size();
133 for ( int i = 0; i < coor.size(); i++ )
134 os << separator() << coor[i];
136 std::list<std::string> ListString = cas.GetIterations();
137 os << separator() << ListString.size();
138 std::list<std::string>::const_iterator it;
139 for ( it = ListString.begin(); it != ListString.end(); ++it )
140 os << separator() << *it;
142 ListString = cas.GetGroups();
143 os << separator() << ListString.size();
144 for ( it = ListString.begin(); it != ListString.end(); ++it )
145 os << separator() << *it;
146 ListString = cas.GetBoundaryGroup();
147 os << separator() << ListString.size();
148 for ( it = ListString.begin(); it != ListString.end(); ++it )
149 os << separator() << *it;
151 os << separator() << cas.GetPyram();
154 // MESSAGE( ". Fin avec "<<saux);
163 \brief Dump iteration to the string
164 \param iteration iteration being dumped
165 \return string representation of the iteration
167 std::string Dump( const HOMARD_Iteration& iteration )
169 std::stringstream os;
172 MESSAGE( ". Sauvegarde de l'iteration "<<iteration.GetName());
173 os << iteration.GetName();
174 os << separator() << iteration.GetState();
175 os << separator() << iteration.GetNumber();
176 os << separator() << iteration.GetMeshFile();
177 os << separator() << iteration.GetLogFile();
178 os << separator() << iteration.GetMeshName();
179 os << separator() << iteration.GetFieldFile();
180 os << separator() << iteration.GetTimeStep();
181 os << separator() << iteration.GetRank();
182 os << separator() << iteration.GetIterParentName();
184 std::list<std::string> ListString = iteration.GetIterations();
185 os << separator() << ListString.size();
186 std::list<std::string>::const_iterator it;
187 for ( it = ListString.begin(); it != ListString.end(); ++it )
188 os << separator() << *it;
190 os << separator() << iteration.GetHypoName();
191 os << separator() << iteration.GetCaseName();
192 os << separator() << iteration.GetDirNameLoc();
195 // MESSAGE( ". Fin avec "<<saux);
203 \brief Dump hypothesis to the string
204 \param hypothesis hypothesis being dumped
205 \return string representation of the hypothesis
207 std::string Dump( const HOMARD_Hypothesis& hypothesis )
209 std::stringstream os;
212 MESSAGE( ". Sauvegarde de l'hypothese "<<hypothesis.GetName());
213 os << hypothesis.GetName();
214 os << separator() << hypothesis.GetCaseCreation();
215 os << separator() << hypothesis.GetAdapType();
216 os << separator() << hypothesis.GetRefinType();
217 os << separator() << hypothesis.GetUnRefType();
218 os << separator() << hypothesis.GetFieldName();
219 os << separator() << hypothesis.GetRefinThrType();
220 os << separator() << hypothesis.GetThreshR();
221 os << separator() << hypothesis.GetUnRefThrType();
222 os << separator() << hypothesis.GetThreshC();
223 os << separator() << hypothesis.GetUseField();
224 os << separator() << hypothesis.GetUseComp();
225 os << separator() << hypothesis.GetTypeFieldInterp();
227 std::list<std::string> ListString = hypothesis.GetIterations();
228 std::list<std::string>::const_iterator it;
229 os << separator() << ListString.size();
230 for ( it = ListString.begin(); it != ListString.end(); ++it )
231 os << separator() << *it;
233 ListString = hypothesis.GetZones();
234 os << separator() << ListString.size();
235 for ( it = ListString.begin(); it != ListString.end(); ++it )
236 os << separator() << *it;
238 ListString = hypothesis.GetComps();
239 os << separator() << ListString.size();
240 for ( it = ListString.begin(); it != ListString.end(); ++it )
241 os << separator() << *it;
243 ListString = hypothesis.GetGroups();
244 os << separator() << ListString.size();
245 for ( it = ListString.begin(); it != ListString.end(); ++it )
246 os << separator() << *it;
248 ListString = hypothesis.GetFieldInterps();
249 os << separator() << ListString.size();
250 for ( it = ListString.begin(); it != ListString.end(); ++it )
251 os << separator() << *it;
253 os << separator() << hypothesis.GetNivMax();
254 os << separator() << hypothesis.GetDiamMin();
255 os << separator() << hypothesis.GetAdapInit();
256 os << separator() << hypothesis.GetExtraOutput();
259 // MESSAGE( ". Fin avec "<<saux);
263 // ==============================
264 // 1.5. Archivage d'une frontiere
265 // ==============================
268 \brief Dump boundary to the string
269 \param boundary boundary being dumped
270 \return string representation of the boundary
272 std::string Dump( const HOMARD_Boundary& boundary )
274 std::stringstream os;
276 MESSAGE( ". Sauvegarde de la frontiere "<<boundary.GetName());
278 int BoundaryType = boundary.GetType() ;
280 os << boundary.GetName() ;
281 os << separator() << BoundaryType ;
282 os << separator() << boundary.GetCaseCreation() ;
284 if ( BoundaryType == -1 )
286 os << separator() << boundary.GetDataFile();
288 else if ( BoundaryType == 0 )
290 os << separator() << boundary.GetMeshName();
291 os << separator() << boundary.GetDataFile();
294 std::vector<double> coor = boundary.GetCoords() ;
295 for ( int i = 0; i < coor.size(); i++ )
296 os << separator() << coor[i];
297 std::vector<double> limit = boundary.GetLimit();
298 for ( int i = 0; i < limit.size(); i++ )
299 os << separator() << limit[i];
302 std::list<std::string> ListString = boundary.GetGroups();
303 std::list<std::string>::const_iterator it;
304 os << separator() << ListString.size();
305 for ( it = ListString.begin(); it != ListString.end(); ++it )
306 os << separator() << *it;
309 // MESSAGE( ". Fin avec "<<saux);
314 // 2. Restauration des objets
315 // ==========================
317 // ==========================
320 \brief Restore case from the string
321 \param cas case being restored
322 \param stream string representation of the case
323 \return \c true if case is correctly restored or \c false otherwise
325 bool Restore( HOMARD_Cas& cas, const std::string& stream )
327 MESSAGE( ". Restoration du cas ");
328 std::string::size_type start = 0;
329 std::string chunk, chunkNext;
332 chunk = getNextChunk( stream, start, ok );
333 if ( !ok ) return false;
334 cas.SetName( chunk.c_str() );
336 chunk = getNextChunk( stream, start, ok );
337 if ( !ok ) return false;
338 cas.SetDirName( chunk.c_str() );
340 chunk = getNextChunk( stream, start, ok );
341 if ( !ok ) return false;
342 cas.SetConfType( atoi( chunk.c_str() ) );
344 chunk = getNextChunk( stream, start, ok );
345 if ( !ok ) return false;
346 cas.SetExtType( atoi( chunk.c_str() ) );
348 chunk = getNextChunk( stream, start, ok );
349 if ( !ok ) return false;
351 int size = atoi( chunk.c_str() );
352 std::vector<double> boite;
353 boite.resize( size );
354 for ( int i = 0; i < size; i++ ) {
355 chunk = getNextChunk( stream, start, ok );
356 if ( !ok ) return false;
357 boite[i] = strtod( chunk.c_str(), 0 );
359 cas.SetBoundingBox( boite );
361 chunk = getNextChunk( stream, start, ok );
362 if ( !ok ) return false;
364 size = atoi( chunk.c_str() );
365 for ( int i = 0; i < size; i++ ) {
366 chunk = getNextChunk( stream, start, ok );
367 if ( !ok ) return false;
368 cas.AddIteration( chunk.c_str() );
371 chunk = getNextChunk( stream, start, ok );
372 if ( !ok ) return false;
373 size = atoi( chunk.c_str() );
374 for ( int i = 0; i < size; i++ )
376 chunk = getNextChunk( stream, start, ok );
377 if ( !ok ) return false;
378 cas.AddGroup( chunk.c_str() );
381 chunk = getNextChunk( stream, start, ok );
382 if ( !ok ) return false;
383 size = atoi( chunk.c_str() );
384 for ( int i = 0; i < size; i++ ) {
385 chunk = getNextChunk( stream, start, ok );
386 if ( !ok ) return false;
388 chunkNext = getNextChunk( stream, start, ok );
389 if ( !ok ) return false;
390 cas.AddBoundaryGroup( chunk.c_str(), chunkNext.c_str() );
393 chunk = getNextChunk( stream, start, ok );
394 if ( !ok ) return false;
395 cas.SetPyram( atoi( chunk.c_str() ) );
404 \brief Restore iteration from the string
405 \param iteration iteration being restored
406 \param stream string representation of the iteration
407 \return \c true if iteration is correctly restored or \c false otherwise
409 bool Restore( HOMARD_Iteration& iteration, const std::string& stream )
411 std::string::size_type start = 0;
414 chunk = getNextChunk( stream, start, ok );
415 if ( !ok ) return false;
417 iteration.SetName( chunk.c_str() );
418 chunk = getNextChunk( stream, start, ok );
419 if ( !ok ) return false;
420 iteration.SetState( atoi( chunk.c_str() ) );
421 chunk = getNextChunk( stream, start, ok );
422 if ( !ok ) return false;
423 iteration.SetNumber( atoi( chunk.c_str() ) );
424 chunk = getNextChunk( stream, start, ok );
425 if ( !ok ) return false;
426 iteration.SetMeshFile( chunk.c_str() );
427 chunk = getNextChunk( stream, start, ok );
428 if ( !ok ) return false;
429 iteration.SetLogFile( chunk.c_str() );
430 chunk = getNextChunk( stream, start, ok );
431 if ( !ok ) return false;
432 iteration.SetMeshName( chunk.c_str() );
433 chunk = getNextChunk( stream, start, ok );
434 if ( !ok ) return false;
435 iteration.SetFieldFile( chunk.c_str() );
438 chunk = getNextChunk( stream, start, ok );
439 if ( !ok ) return false;
440 timestep = atoi( chunk.c_str() );
441 chunk = getNextChunk( stream, start, ok );
442 if ( !ok ) return false;
443 rank = atoi( chunk.c_str() );
444 iteration.SetTimeStepRank( timestep, rank );
445 chunk = getNextChunk( stream, start, ok );
446 if ( !ok ) return false;
447 iteration.SetIterParentName( chunk.c_str() );
449 chunk = getNextChunk( stream, start, ok );
450 if ( !ok ) return false;
451 int size = atoi( chunk.c_str() );
452 for ( int i = 0; i < size; i++ ) {
453 chunk = getNextChunk( stream, start, ok );
454 if ( !ok ) return false;
455 iteration.LinkNextIteration( chunk.c_str() );
458 chunk = getNextChunk( stream, start, ok );
459 if ( !ok ) return false;
460 iteration.SetHypoName( chunk.c_str() );
461 chunk = getNextChunk( stream, start, ok );
462 if ( !ok ) return false;
463 iteration.SetCaseName( chunk.c_str() );
464 chunk = getNextChunk( stream, start, ok );
465 if ( !ok ) return false;
466 iteration.SetDirNameLoc( chunk.c_str() );
475 \brief Restore hypothesis from the string
476 \param hypothesis hypothesis being restored
477 \param stream string representation of the hypothesis
478 \return \c true if hypothesis is correctly restored or \c false otherwise
480 bool Restore( HOMARD_Hypothesis& hypothesis, const std::string& stream )
482 std::string::size_type start = 0;
483 std::string chunk, chunkNext;
486 chunk = getNextChunk( stream, start, ok );
487 if ( !ok ) return false;
488 hypothesis.SetName( chunk.c_str() );
490 chunk = getNextChunk( stream, start, ok );
491 if ( !ok ) return false;
492 hypothesis.SetCaseCreation( chunk.c_str() );
494 chunk = getNextChunk( stream, start, ok );
495 if ( !ok ) return false;
496 hypothesis.SetAdapType( atoi( chunk.c_str() ) );
498 chunk = getNextChunk( stream, start, ok );
499 if ( !ok ) return false;
500 int typeraff = atoi( chunk.c_str() );
501 chunk = getNextChunk( stream, start, ok );
502 if ( !ok ) return false;
503 int typedera = atoi( chunk.c_str() );
504 hypothesis.SetRefinTypeDera( typeraff, typedera );
506 chunk = getNextChunk( stream, start, ok );
507 if ( !ok ) return false;
508 hypothesis.SetField( chunk.c_str() );
510 chunk = getNextChunk( stream, start, ok );
511 if ( !ok ) return false;
512 int typethr = atoi( chunk.c_str() );
513 chunk = getNextChunk( stream, start, ok );
514 if ( !ok ) return false;
515 double threshr = strtod( chunk.c_str(), 0 );
516 hypothesis.SetRefinThr( typethr, threshr );
518 chunk = getNextChunk( stream, start, ok );
519 if ( !ok ) return false;
520 int typethc = atoi( chunk.c_str() );
521 chunk = getNextChunk( stream, start, ok );
522 if ( !ok ) return false;
523 double threshc = strtod( chunk.c_str(), 0 );
524 hypothesis.SetUnRefThr( typethc, threshc );
526 chunk = getNextChunk( stream, start, ok );
527 if ( !ok ) return false;
528 hypothesis.SetUseField(atoi(chunk.c_str()));
530 chunk = getNextChunk( stream, start, ok );
531 if ( !ok ) return false;
532 hypothesis.SetUseComp(atoi(chunk.c_str()));
534 chunk = getNextChunk( stream, start, ok );
535 if ( !ok ) return false;
536 hypothesis.SetTypeFieldInterp(atoi(chunk.c_str()));
538 chunk = getNextChunk( stream, start, ok );
539 if ( !ok ) return false;
540 int size = atoi( chunk.c_str() );
541 for ( int i = 0; i < size; i++ ) {
542 chunk = getNextChunk( stream, start, ok );
543 if ( !ok ) return false;
544 hypothesis.LinkIteration( chunk.c_str() );
547 chunk = getNextChunk( stream, start, ok );
548 if ( !ok ) return false;
549 size = atoi( chunk.c_str() );
550 for ( int i = 0; i < size; i++ ) {
551 chunk = getNextChunk( stream, start, ok );
552 if ( !ok ) return false;
554 chunkNext = getNextChunk( stream, start, ok );
555 int typeuse = atoi( chunkNext.c_str() );
556 if ( !ok ) return false;
557 hypothesis.AddZone( chunk.c_str(), typeuse );
560 chunk = getNextChunk( stream, start, ok );
561 if ( !ok ) return false;
562 size = atoi( chunk.c_str() );
563 for ( int i = 0; i < size; i++ ) {
564 chunk = getNextChunk( stream, start, ok );
565 if ( !ok ) return false;
566 hypothesis.AddComp( chunk.c_str() );
569 chunk = getNextChunk( stream, start, ok );
570 if ( !ok ) return false;
571 size = atoi( chunk.c_str() );
572 for ( int i = 0; i < size; i++ ) {
573 chunk = getNextChunk( stream, start, ok );
574 if ( !ok ) return false;
575 hypothesis.AddGroup( chunk.c_str() );
578 chunk = getNextChunk( stream, start, ok );
579 if ( !ok ) return false;
580 size = atoi( chunk.c_str() );
581 for ( int i = 0; i < size; i++ ) {
582 chunk = getNextChunk( stream, start, ok );
583 if ( !ok ) return false;
585 chunkNext = getNextChunk( stream, start, ok );
586 int TypeInterp = atoi( chunkNext.c_str() );
587 if ( !ok ) return false;
588 hypothesis.AddFieldInterpType( chunk.c_str(), TypeInterp );
591 chunk = getNextChunk( stream, start, ok );
592 if ( !ok ) return false;
593 hypothesis.SetNivMax( atoi( chunk.c_str() ) );
595 chunk = getNextChunk( stream, start, ok );
596 if ( !ok ) return false;
597 hypothesis.SetDiamMin( strtod( chunk.c_str(), 0 ) );
599 chunk = getNextChunk( stream, start, ok );
600 if ( !ok ) return false;
601 hypothesis.SetAdapInit( strtod( chunk.c_str(), 0 ) );
603 chunk = getNextChunk( stream, start, ok );
604 if ( !ok ) return false;
605 hypothesis.SetExtraOutput( strtod( chunk.c_str(), 0 ) );
611 // =================================
612 // 2.5. Restauration d'une frontiere
613 // =================================
616 \brief Restore boundary from the string
617 \param boundary boundary being restored
618 \param stream string representation of the boundary
619 \return \c true if the boundary is correctly restored or \c false otherwise
621 bool Restore( HOMARD_Boundary& boundary, const std::string& stream )
623 std::string::size_type start = 0;
627 chunk = getNextChunk( stream, start, ok );
628 if ( !ok ) return false;
629 boundary.SetName( chunk.c_str() );
631 chunk = getNextChunk( stream, start, ok );
632 if ( !ok ) return false;
633 int BoundaryType = atoi( chunk.c_str() ) ;
634 boundary.SetType( BoundaryType );
636 chunk = getNextChunk( stream, start, ok );
637 if ( !ok ) return false;
638 boundary.SetCaseCreation( chunk.c_str() );
640 // Si analytique, les coordonnees des frontieres : le nombre depend du type
641 // Si discret, le maillage
642 // Si CAO, la géométrie
644 if ( BoundaryType == -1 ) { lgcoords = -1 ; }
645 else if ( BoundaryType == 1 ) { lgcoords = 7 ; }
646 else if ( BoundaryType == 2 ) { lgcoords = 4 ; }
647 else { lgcoords = 0 ; }
649 if ( lgcoords == -1 )
651 chunk = getNextChunk( stream, start, ok );
652 if ( !ok ) return false;
653 boundary.SetDataFile( chunk.c_str() );
655 else if ( lgcoords == 0 )
657 chunk = getNextChunk( stream, start, ok );
658 if ( !ok ) return false;
659 boundary.SetMeshName( chunk.c_str() );
661 chunk = getNextChunk( stream, start, ok );
662 if ( !ok ) return false;
663 boundary.SetDataFile( chunk.c_str() );
666 { std::vector<double> coords;
667 coords.resize( lgcoords );
668 for ( int i = 0; i < lgcoords; i++ ) {
669 chunk = getNextChunk( stream, start, ok );
670 if ( !ok ) return false;
671 coords[i] = strtod( chunk.c_str(), 0 );
673 if ( BoundaryType == 1 )
674 { boundary.SetCylinder(coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],coords[6]); }
675 else if ( BoundaryType == 2 )
676 { boundary.SetSphere( coords[0], coords[1], coords[2], coords[3]); }
677 else if ( BoundaryType == 3 )
678 { boundary.SetConeA( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6]); }
679 else if ( BoundaryType == 4 )
680 { boundary.SetConeR( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7]); }
681 // Remarque : la taille de coords est suffisante pour les limites
682 for ( int i = 0; i < 3; i++ ) {
683 chunk = getNextChunk( stream, start, ok );
684 if ( !ok ) return false;
685 coords[i] = strtod( chunk.c_str(), 0 );
687 boundary.SetLimit( coords[0], coords[1], coords[2]);
690 chunk = getNextChunk( stream, start, ok );
691 if ( !ok ) return false;
692 int size = atoi( chunk.c_str() );
693 for ( int i = 0; i < size; i++ ) {
694 chunk = getNextChunk( stream, start, ok );
695 if ( !ok ) return false;
696 boundary.AddGroup( chunk.c_str() );
702 //=============================================================================
704 * default constructor:
706 //=============================================================================
707 HOMARD_Boundary::HOMARD_Boundary():
708 _Name( "" ),_Type( 1 ),
709 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
710 _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
711 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
712 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
714 MESSAGE("HOMARD_Boundary");
717 //=============================================================================
718 HOMARD_Boundary::~HOMARD_Boundary()
720 MESSAGE("~HOMARD_Boundary");
722 //=============================================================================
723 //=============================================================================
725 //=============================================================================
726 //=============================================================================
727 void HOMARD_Boundary::SetName( const char* Name )
729 _Name = std::string( Name );
731 //=============================================================================
732 std::string HOMARD_Boundary::GetName() const
736 //=============================================================================
737 std::string HOMARD_Boundary::GetDumpPython() const
739 std::ostringstream aScript;
740 aScript << "\n# Creation of the ";
746 aScript << "CAO boundary " << _Name << "\n";
747 aScript << "\t" << _Name << " = homard.CreateBoundaryCAO(\"" << _Name << "\", ";
748 aScript << "\"" << _DataFile << "\")\n";
753 aScript << "discrete boundary " << _Name << "\n";
754 aScript << "\t" << _Name << " = homard.CreateBoundaryDi(\"" << _Name << "\", ";
755 aScript << "\"" << _MeshName << "\", ";
756 aScript << "\"" << _DataFile << "\")\n";
761 aScript << "cylinder " << _Name << "\n";
762 aScript << "\t" << _Name << " = homard.CreateBoundaryCylinder(\"" << _Name << "\", ";
763 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
768 aScript << "sphere " << _Name << "\n";
769 aScript << "\t" << _Name << " = homard.CreateBoundarySphere(\"" << _Name << "\", ";
770 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
775 aScript << "cone " << _Name << "\n";
776 aScript << "\t" << _Name << " = homard.CreateBoundaryConeA(\"" << _Name << "\", ";
777 aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n";
782 aScript << "cone " << _Name << "\n";
783 aScript << "\t" << _Name << " = homard.CreateBoundaryConeR(\"" << _Name << "\", ";
784 aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n";
789 aScript << "tore " << _Name << "\n";
790 aScript << "\t" << _Name << " = homard.CreateBoundaryTorus(\"" << _Name << "\", ";
791 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon1 << ", " << _Rayon2 << ")\n";
796 return aScript.str();
798 //=============================================================================
799 //=============================================================================
801 //=============================================================================
802 //=============================================================================
803 void HOMARD_Boundary::SetType( int Type )
807 //=============================================================================
808 int HOMARD_Boundary::GetType() const
812 //=============================================================================
813 void HOMARD_Boundary::SetMeshName( const char* MeshName )
815 _MeshName = std::string( MeshName );
817 //=============================================================================
818 std::string HOMARD_Boundary::GetMeshName() const
822 //=============================================================================
823 void HOMARD_Boundary::SetDataFile( const char* DataFile )
825 _DataFile = std::string( DataFile );
827 //=============================================================================
828 std::string HOMARD_Boundary::GetDataFile() const
832 //=======================================================================================
833 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
834 double X3, double X4, double X5, double X6 )
836 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
837 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
840 //======================================================================
841 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
843 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
846 //======================================================================
847 void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
848 double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
850 _Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1;
852 _Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2;
855 //======================================================================
856 void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
857 double Xcentre, double Ycentre, double Zcentre)
859 _Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe;
861 _Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre;
863 //=======================================================================================
864 void HOMARD_Boundary::SetTorus( double X0, double X1, double X2,
865 double X3, double X4, double X5, double X6, double X7 )
867 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
868 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
872 //=======================================================================================
873 std::vector<double> HOMARD_Boundary::GetCoords() const
875 std::vector<double> mesCoor;
882 mesCoor.push_back( _Xcentre );
883 mesCoor.push_back( _Ycentre );
884 mesCoor.push_back( _Zcentre );
885 mesCoor.push_back( _Xaxe );
886 mesCoor.push_back( _Yaxe );
887 mesCoor.push_back( _Zaxe );
888 mesCoor.push_back( _rayon );
894 mesCoor.push_back( _Xcentre );
895 mesCoor.push_back( _Ycentre );
896 mesCoor.push_back( _Zcentre );
897 mesCoor.push_back( _rayon );
900 // Cone defini par un axe et un angle
903 mesCoor.push_back( _Xaxe );
904 mesCoor.push_back( _Yaxe );
905 mesCoor.push_back( _Zaxe );
906 mesCoor.push_back( _Angle );
907 mesCoor.push_back( _Xcentre );
908 mesCoor.push_back( _Ycentre );
909 mesCoor.push_back( _Zcentre );
912 // Cone defini par les 2 rayons
915 mesCoor.push_back( _Xcentre1 );
916 mesCoor.push_back( _Ycentre1 );
917 mesCoor.push_back( _Zcentre1 );
918 mesCoor.push_back( _Rayon1 );
919 mesCoor.push_back( _Xcentre2 );
920 mesCoor.push_back( _Ycentre2 );
921 mesCoor.push_back( _Zcentre2 );
922 mesCoor.push_back( _Rayon2 );
928 mesCoor.push_back( _Xcentre );
929 mesCoor.push_back( _Ycentre );
930 mesCoor.push_back( _Zcentre );
931 mesCoor.push_back( _Xaxe );
932 mesCoor.push_back( _Yaxe );
933 mesCoor.push_back( _Zaxe );
934 mesCoor.push_back( _Rayon1 );
935 mesCoor.push_back( _Rayon2 );
938 VERIFICATION( (_Type>=1) && (_Type<=5) ) ;
942 //======================================================================
943 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
945 _Xincr = X0; _Yincr = X1; _Zincr = X2;
947 //=======================================================================================
948 std::vector<double> HOMARD_Boundary::GetLimit() const
950 std::vector<double> mesLimit;
951 mesLimit.push_back( _Xincr );
952 mesLimit.push_back( _Yincr );
953 mesLimit.push_back( _Zincr );
956 //=============================================================================
957 void HOMARD_Boundary::AddGroup( const char* Group)
959 _ListGroupSelected.push_back(Group);
961 //=============================================================================
962 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
964 _ListGroupSelected.clear();
965 std::list<std::string>::const_iterator it = ListGroup.begin();
966 while(it != ListGroup.end())
967 _ListGroupSelected.push_back((*it++));
969 //=============================================================================
970 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
972 return _ListGroupSelected;
974 //=============================================================================
975 //=============================================================================
976 // Liens avec les autres structures
977 //=============================================================================
978 //=============================================================================
979 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
981 _NomCasCreation = std::string( NomCasCreation );
983 //=============================================================================
984 std::string HOMARD_Boundary::GetCaseCreation() const
986 return _NomCasCreation;
988 //=============================================================================
990 //=============================================================================
992 * default constructor:
993 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
995 //=============================================================================
996 HOMARD_Cas::HOMARD_Cas():
997 _Name(""), _NomDir("/tmp"), _ConfType(0), _ExtType(0)
999 MESSAGE("HOMARD_Cas");
1001 //=============================================================================
1002 HOMARD_Cas::~HOMARD_Cas()
1003 //=============================================================================
1005 MESSAGE("~HOMARD_Cas");
1007 //=============================================================================
1008 //=============================================================================
1010 //=============================================================================
1011 //=============================================================================
1012 void HOMARD_Cas::SetName( const char* Name )
1014 _Name = std::string( Name );
1016 //=============================================================================
1017 std::string HOMARD_Cas::GetName() const
1021 //=============================================================================
1022 std::string HOMARD_Cas::GetDumpPython() const
1024 std::ostringstream aScript;
1025 aScript << "\t" <<_Name << ".SetDirName(\"";
1026 aScript << _NomDir << "\")\n";
1027 aScript << "\t" <<_Name << ".SetConfType(";
1028 aScript << _ConfType << ")\n";
1029 aScript << "\t" <<_Name << ".SetExtType(";
1030 aScript << _ExtType << ")\n";
1031 // Suivi de frontieres
1032 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
1033 while(it != _ListBoundaryGroup.end())
1035 aScript << "\t" <<_Name << ".AddBoundaryGroup(\"";
1036 aScript << *it << "\", \"";
1038 aScript << *it << "\")\n";
1043 aScript << "\t" <<_Name << ".SetPyram(";
1044 aScript << _Pyram << ")\n";
1047 return aScript.str();
1049 //=============================================================================
1050 //=============================================================================
1052 //=============================================================================
1053 //=============================================================================
1054 int HOMARD_Cas::SetDirName( const char* NomDir )
1056 // MESSAGE("SetDirName, NomDir : "<<NomDir);
1057 // MESSAGE("SetDirName, _NomDir : "<<_NomDir);
1059 // On vérifie qu'aucun calcul n'a eu lieu pour ce cas
1060 // MESSAGE("SetDirName, _ListIter.size() : "<<_ListIter.size());
1061 if ( _ListIter.size() > 1 ) { erreur = 1 ; }
1063 if ( CHDIR(NomDir) == 0 )
1064 { _NomDir = std::string( NomDir ); }
1069 if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 )
1071 if ( _mkdir(NomDir) == 0 )
1074 if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); }
1075 else { erreur = 2 ; }
1077 else { erreur = 2 ; }
1081 //=============================================================================
1082 std::string HOMARD_Cas::GetDirName() const
1086 //=============================================================================
1087 int HOMARD_Cas::GetNumberofIter()
1089 return _ListIter.size();
1092 // Le type de conformite ou non conformite
1094 //=============================================================================
1095 void HOMARD_Cas::SetConfType( int Conftype )
1097 // VERIFICATION( (Conftype>=-2) && (Conftype<=3) );
1098 _ConfType = Conftype;
1100 //=============================================================================
1101 const int HOMARD_Cas::GetConfType() const
1106 // Le type exterieur
1108 //=============================================================================
1109 void HOMARD_Cas::SetExtType( int ExtType )
1111 // VERIFICATION( (ExtType>=0) && (ExtType<=2) );
1114 //=============================================================================
1115 const int HOMARD_Cas::GetExtType() const
1120 // La boite englobante
1122 //=============================================================================
1123 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
1126 _Boite.resize( extremas.size() );
1127 for ( int i = 0; i < extremas.size(); i++ )
1128 _Boite[i] = extremas[i];
1130 //=============================================================================
1131 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
1138 //=============================================================================
1139 void HOMARD_Cas::AddGroup( const char* Group )
1141 _ListGroup.push_back(Group);
1143 //=============================================================================
1144 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
1147 std::list<std::string>::const_iterator it = ListGroup.begin();
1148 while(it != ListGroup.end())
1150 _ListGroup.push_back((*it++));
1153 //=============================================================================
1154 const std::list<std::string>& HOMARD_Cas::GetGroups() const
1158 //=============================================================================
1159 void HOMARD_Cas::SupprGroups()
1166 //=============================================================================
1167 void HOMARD_Cas::AddBoundary( const char* Boundary )
1169 // MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary );
1170 const char* Group = "";
1171 AddBoundaryGroup( Boundary, Group );
1173 //=============================================================================
1174 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
1176 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary );
1177 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group );
1178 _ListBoundaryGroup.push_back( Boundary );
1179 _ListBoundaryGroup.push_back( Group );
1181 //=============================================================================
1182 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
1184 return _ListBoundaryGroup;
1186 //=============================================================================
1187 void HOMARD_Cas::SupprBoundaryGroup()
1189 _ListBoundaryGroup.clear();
1191 //=============================================================================
1192 void HOMARD_Cas::SetPyram( int Pyram )
1196 //=============================================================================
1197 const int HOMARD_Cas::GetPyram() const
1201 //=============================================================================
1202 //=============================================================================
1203 // Liens avec les autres structures
1204 //=============================================================================
1205 //=============================================================================
1206 std::string HOMARD_Cas::GetIter0Name() const
1208 // Par construction de la liste, l'iteration a ete mise en tete.
1209 return (*(_ListIter.begin()));
1211 //=============================================================================
1212 void HOMARD_Cas::AddIteration( const char* NomIteration )
1214 _ListIter.push_back( std::string( NomIteration ) );
1216 //=============================================================================
1217 const std::list<std::string>& HOMARD_Cas::GetIterations() const
1221 //=============================================================================
1222 void HOMARD_Cas::SupprIterations()
1227 //=============================================================================
1228 //=============================================================================
1229 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
1230 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
1231 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
1232 _Texte( "" ), _bLu( false )
1234 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
1235 // Le repertoire ou se trouve l'executable HOMARD
1237 if ( getenv("HOMARD_REP_EXE_PRIVATE") != NULL ) { dir = getenv("HOMARD_REP_EXE_PRIVATE") ; }
1238 else { dir = getenv("HOMARD_REP_EXE") ; }
1239 MESSAGE("dir ="<<dir);
1240 // L'executable HOMARD
1241 std::string executable ;
1242 if ( getenv("HOMARD_EXE_PRIVATE") != NULL ) { executable = getenv("HOMARD_EXE_PRIVATE") ; }
1243 else { executable = getenv("HOMARD_EXE") ; }
1244 MESSAGE("executable ="<<executable);
1245 // Memorisation du nom complet de l'executable HOMARD
1246 _HOMARD_Exec = dir + "/" + executable ;
1247 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
1250 _siterp1 = siterp1 ;
1252 //=============================================================================
1253 //=============================================================================
1254 HomardDriver::~HomardDriver()
1257 //===============================================================================
1259 //===============================================================================
1260 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
1262 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
1264 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
1265 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
1266 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
1267 _Texte += "Langue \"" + Langue + "\"\n" ;
1270 //===============================================================================
1271 void HomardDriver::TexteAdap( int ExtType )
1273 MESSAGE("TexteAdap");
1275 _Texte += "Action homa\n" ;
1276 if ( ExtType == 0 ) { _Texte += "CCAssoci med\n" ; }
1277 else if ( ExtType == 1 ) { _Texte += "CCAssoci saturne\n" ; }
1278 else { _Texte += "CCAssoci saturne_2d\n" ; }
1279 _Texte += "ModeHOMA 1\n" ;
1280 _Texte += "NumeIter " + _siter + "\n" ;
1284 //===============================================================================
1285 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
1287 MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
1289 _Texte += "ModeHOMA 2\n" ;
1290 std::stringstream saux1 ;
1292 std::string saux2 = saux1.str() ;
1293 _Texte += "TypeBila " + saux2 + "\n" ;
1294 if ( NumeIter == 0 )
1296 _Texte += "NumeIter 0\n" ;
1297 _Texte += "Action info_av\n" ;
1298 _Texte += "CCAssoci med\n" ;
1302 _Texte += "NumeIter " + _siter + "\n" ;
1303 _Texte += "Action info_ap\n" ;
1304 _Texte += "CCAssoci homard\n" ;
1309 //===============================================================================
1310 void HomardDriver::TexteMajCoords( int NumeIter )
1312 MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
1314 _Texte += "ModeHOMA 5\n" ;
1315 _Texte += "NumeIter " + _siterp1 + "\n" ;
1316 _Texte += "Action homa\n" ;
1317 _Texte += "CCAssoci med\n" ;
1318 _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
1322 //===============================================================================
1323 // B. Les maillages en entree et en sortie
1324 //===============================================================================
1325 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
1327 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
1328 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
1329 MESSAGE("TexteMaillage, apres = "<<apres);
1332 if ( apres < 1 ) { saux = "__" ; }
1334 _Texte += "# Maillages Med " + saux + "\n" ;
1335 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
1336 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
1339 //===============================================================================
1340 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
1342 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
1344 if ( apres < 1 ) { saux = "__" ; }
1345 else { saux = "P1" ; }
1347 _Texte += "# Maillage HOMARD " + liter + "\n" ;
1348 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
1351 //===============================================================================
1352 // C. Le pilotage de l'adaptation
1353 //===============================================================================
1354 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
1356 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
1357 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
1359 // Type de conformite
1366 saux = "NON_CONFORME_1_ARETE" ;
1371 saux = "CONFORME_BOITES" ;
1381 saux = "NON_CONFORME" ;
1386 saux = "NON_CONFORME_1_NOEUD" ;
1391 saux = "NON_CONFORME_INDICATEUR" ;
1395 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
1397 // Type de raffinement/deraffinement
1399 if ( TypeAdap == -1 )
1401 if ( TypeRaff == 1 )
1403 saux = "TypeRaff uniforme\n" ;
1407 saux = "TypeRaff non\n" ;
1409 if ( TypeDera == 1 )
1411 saux += "TypeDera uniforme" ;
1415 saux += "TypeDera non" ;
1420 if ( TypeRaff == 1 )
1422 saux = "TypeRaff libre\n" ;
1426 saux = "TypeRaff non\n" ;
1428 if ( TypeDera == 1 )
1430 saux += "TypeDera libre" ;
1434 saux += "TypeDera non" ;
1437 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
1439 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
1441 //===============================================================================
1442 void HomardDriver::TexteCompo( int NumeComp, const std::string NomCompo)
1444 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NomCompo = "<<NomCompo);
1445 _Texte +="CCCoChaI \"" + NomCompo + "\"\n" ;
1447 //===============================================================================
1448 void HomardDriver::TexteZone( int NumeZone, int ZoneType, int TypeUse, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8 )
1450 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
1451 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
1453 std::string saux, saux2 ;
1456 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
1457 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
1458 // Attention a mettre le bon signe a ZoneTypeHOMARD :
1459 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
1460 // <0 signifie que l'on deraffinera
1462 int ZoneTypeHOMARD ;
1463 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
1464 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
1465 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
1466 else { ZoneTypeHOMARD = ZoneType ; }
1468 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
1470 std::stringstream saux1 ;
1472 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
1474 { std::stringstream saux1 ;
1475 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
1476 saux += "ZoRaType " + saux1.str() + "\n" ;
1481 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
1482 // Y Homard <=> Y Salome
1484 saux += "#Rectangle\n" ;
1485 { std::stringstream saux1 ;
1486 saux1 << NumeZone << " " << x0 ;
1487 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1489 { std::stringstream saux1 ;
1490 saux1 << NumeZone << " " << x1 ;
1491 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1493 { std::stringstream saux1 ;
1494 saux1 << NumeZone << " " << x2 ;
1495 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1497 { std::stringstream saux1 ;
1498 saux1 << NumeZone << " " << x3 ;
1499 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1503 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
1504 // Y Homard <=> Z Salome
1506 saux += "#Rectangle\n" ;
1507 { std::stringstream saux1 ;
1508 saux1 << NumeZone << " " << x2 ;
1509 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1511 { std::stringstream saux1 ;
1512 saux1 << NumeZone << " " << x3 ;
1513 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1515 { std::stringstream saux1 ;
1516 saux1 << NumeZone << " " << x4 ;
1517 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1519 { std::stringstream saux1 ;
1520 saux1 << NumeZone << " " << x5 ;
1521 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1525 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
1526 // Y Homard <=> Z Salome
1528 saux += "#Rectangle\n" ;
1529 { std::stringstream saux1 ;
1530 saux1 << NumeZone << " " << x0 ;
1531 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1533 { std::stringstream saux1 ;
1534 saux1 << NumeZone << " " << x1 ;
1535 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1537 { std::stringstream saux1 ;
1538 saux1 << NumeZone << " " << x4 ;
1539 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1541 { std::stringstream saux1 ;
1542 saux1 << NumeZone << " " << x5 ;
1543 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1547 // Cas du parallelepipede
1549 else if ( ZoneType == 2 )
1551 saux += "# Boite\n" ;
1552 { std::stringstream saux1 ;
1553 saux1 << NumeZone << " " << x0 ;
1554 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1556 { std::stringstream saux1 ;
1557 saux1 << NumeZone << " " << x1 ;
1558 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1560 { std::stringstream saux1 ;
1561 saux1 << NumeZone << " " << x2 ;
1562 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1564 { std::stringstream saux1 ;
1565 saux1 << NumeZone << " " << x3 ;
1566 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1568 { std::stringstream saux1 ;
1569 saux1 << NumeZone << " " << x4 ;
1570 saux += "ZoRaZmin " + saux1.str() + "\n" ;
1572 { std::stringstream saux1 ;
1573 saux1 << NumeZone << " " << x5 ;
1574 saux += "ZoRaZmax " + saux1.str() + "\n" ;
1580 else if ( ZoneType == 31 || ZoneType == 61 )
1582 saux += "# Sphere\n" ;
1583 { std::stringstream saux1 ;
1584 saux1 << NumeZone << " " << x0 ;
1585 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1587 { std::stringstream saux1 ;
1588 saux1 << NumeZone << " " << x1 ;
1589 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1591 { std::stringstream saux1 ;
1592 saux1 << NumeZone << " " << x6 ;
1593 saux2 = saux1.str() ;
1594 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1595 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1597 if ( ZoneType == 61 )
1598 { std::stringstream saux1 ;
1599 saux1 << NumeZone << " " << x8 ;
1600 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1603 else if ( ZoneType == 32 || ZoneType == 62 )
1605 saux += "# Sphere\n" ;
1606 { std::stringstream saux1 ;
1607 saux1 << NumeZone << " " << x1 ;
1608 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1610 { std::stringstream saux1 ;
1611 saux1 << NumeZone << " " << x2 ;
1612 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1614 { std::stringstream saux1 ;
1615 saux1 << NumeZone << " " << x6 ;
1616 saux2 = saux1.str() ;
1617 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1618 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1620 if ( ZoneType == 62 )
1621 { std::stringstream saux1 ;
1622 saux1 << NumeZone << " " << x8 ;
1623 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1626 else if ( ZoneType == 33 || ZoneType == 63 )
1628 saux += "# Sphere\n" ;
1629 { std::stringstream saux1 ;
1630 saux1 << NumeZone << " " << x0 ;
1631 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1633 { std::stringstream saux1 ;
1634 saux1 << NumeZone << " " << x2 ;
1635 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1637 { std::stringstream saux1 ;
1638 saux1 << NumeZone << " " << x6 ;
1639 saux2 = saux1.str() ;
1640 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1641 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1643 if ( ZoneType == 63 )
1644 { std::stringstream saux1 ;
1645 saux1 << NumeZone << " " << x8 ;
1646 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1652 else if ( ZoneType == 4 )
1654 saux += "# Sphere\n" ;
1655 { std::stringstream saux1 ;
1656 saux1 << NumeZone << " " << x0 ;
1657 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1659 { std::stringstream saux1 ;
1660 saux1 << NumeZone << " " << x1 ;
1661 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1663 { std::stringstream saux1 ;
1664 saux1 << NumeZone << " " << x2 ;
1665 saux += "ZoRaZCen " + saux1.str() + "\n" ;
1667 { std::stringstream saux1 ;
1668 saux1 << NumeZone << " " << x3 ;
1669 saux += "ZoRaRayo " + saux1.str() + "\n" ;
1673 // Cas du cylindre ou du tuyau
1675 else if ( ZoneType == 5 || ZoneType == 7 )
1677 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
1678 else { saux += "# Tuyau\n" ; }
1679 { std::stringstream saux1 ;
1680 saux1 << NumeZone << " " << x0 ;
1681 saux += "ZoRaXBas " + saux1.str() + "\n" ;
1683 { std::stringstream saux1 ;
1684 saux1 << NumeZone << " " << x1 ;
1685 saux += "ZoRaYBas " + saux1.str() + "\n" ;
1687 { std::stringstream saux1 ;
1688 saux1 << NumeZone << " " << x2 ;
1689 saux += "ZoRaZBas " + saux1.str() + "\n" ;
1691 { std::stringstream saux1 ;
1692 saux1 << NumeZone << " " << x3 ;
1693 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
1695 { std::stringstream saux1 ;
1696 saux1 << NumeZone << " " << x4 ;
1697 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
1699 { std::stringstream saux1 ;
1700 saux1 << NumeZone << " " << x5 ;
1701 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
1703 { std::stringstream saux1 ;
1704 saux1 << NumeZone << " " << x6 ;
1705 saux2 = saux1.str() ;
1706 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
1707 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
1709 { std::stringstream saux1 ;
1710 saux1 << NumeZone << " " << x7 ;
1711 saux += "ZoRaHaut " + saux1.str() + "\n" ;
1713 if ( ZoneType == 7 )
1714 { std::stringstream saux1 ;
1715 saux1 << NumeZone << " " << x8 ;
1716 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1720 _Texte += saux + "#\n" ;
1722 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
1724 //===============================================================================
1725 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
1726 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
1727 int UsField, int UsCmpI )
1729 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
1730 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
1732 std::string saux, saux2 ;
1735 _Texte += "# Champ d'indicateurs\n" ;
1736 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
1737 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
1739 // Cas ou on prend le dernier pas de temps
1740 if ( TimeStep == -2 )
1741 { _Texte += "CCNumPTI Last\n" ; }
1742 // Cas avec pas de temps
1743 else if ( TimeStep >= 0 )
1746 std::stringstream saux1 ;
1748 saux2 = saux1.str() ;
1749 _Texte += "CCNumPTI " + saux2 + "\n" ;
1753 std::stringstream saux1 ;
1755 saux2 = saux1.str() ;
1756 _Texte += "CCNumOrI " + saux2 + "\n" ;
1771 std::stringstream saux1 ;
1773 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
1787 std::stringstream saux1 ;
1789 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
1794 { saux = "MAILLE" ; }
1799 _Texte += "CCModeFI " + saux + "\n" ;
1806 { saux = "INFINI" ; }
1808 { saux = "RELATIF" ; }
1811 _Texte += "CCUsCmpI " + saux + "\n" ;
1814 //===============================================================================
1815 void HomardDriver::TexteGroup( const std::string GroupName )
1817 MESSAGE("TexteGroup, GroupName = "<<GroupName);
1819 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
1822 //===============================================================================
1823 // D. Les frontieres
1824 //===============================================================================
1825 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
1827 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
1829 // Type de suivi de frontiere
1831 std::stringstream saux1 ;
1832 saux1 << BoundaryOption ;
1833 std::string saux = saux1.str() ;
1834 _Texte += "SuivFron " + saux + "\n" ;
1836 }//===============================================================================
1837 void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
1839 MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
1841 _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
1845 //===============================================================================
1846 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
1848 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
1849 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
1851 _Texte += "#\n# Frontiere discrete\n" ;
1852 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
1853 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
1856 //===============================================================================
1857 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
1859 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
1861 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
1864 //===============================================================================
1865 void HomardDriver::TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7 )
1867 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
1868 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
1869 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
1870 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
1872 std::string saux, saux2 ;
1876 std::stringstream saux1 ;
1877 saux1 << NumeBoundary ;
1878 saux2 = saux1.str() ;
1879 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
1880 if ( BoundaryType == 1 )
1881 { saux += "# Cylindre\n" ; }
1882 if ( BoundaryType == 2 )
1883 { saux += "# Sphere\n" ; }
1884 if ( BoundaryType == 3 || BoundaryType == 4 )
1885 { saux += "# Cone\n" ; }
1886 if ( BoundaryType == 5 )
1887 { saux += "# Tore\n" ; }
1889 // Le nom de la frontiere
1891 { std::stringstream saux1 ;
1892 saux1 << NumeBoundary ;
1893 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
1896 // Type de frontiere
1898 { std::stringstream saux1 ;
1899 saux1 << NumeBoundary << " " << BoundaryType ;
1900 saux += "FAType " + saux1.str() + "\n" ;
1905 if ( BoundaryType == 1 )
1907 { std::stringstream saux1 ;
1908 saux1 << NumeBoundary << " " << x0 ;
1909 saux2 = saux1.str() ;
1910 saux += "FAXCen " + saux1.str() + "\n" ;
1912 { std::stringstream saux1 ;
1913 saux1 << NumeBoundary << " " << x1 ;
1914 saux += "FAYCen " + saux1.str() + "\n" ;
1916 { std::stringstream saux1 ;
1917 saux1 << NumeBoundary << " " << x2 ;
1918 saux += "FAZCen " + saux1.str() + "\n" ;
1920 { std::stringstream saux1 ;
1921 saux1 << NumeBoundary << " " << x3 ;
1922 saux += "FAXAxe " + saux1.str() + "\n" ;
1924 { std::stringstream saux1 ;
1925 saux1 << NumeBoundary << " " << x4 ;
1926 saux += "FAYAxe " + saux1.str() + "\n" ;
1928 { std::stringstream saux1 ;
1929 saux1 << NumeBoundary << " " << x5 ;
1930 saux += "FAZAxe " + saux1.str() + "\n" ;
1932 { std::stringstream saux1 ;
1933 saux1 << NumeBoundary << " " << x6 ;
1934 saux += "FARayon " + saux1.str() + "\n" ;
1940 else if ( BoundaryType == 2 )
1942 { std::stringstream saux1 ;
1943 saux1 << NumeBoundary << " " << x0 ;
1944 saux += "FAXCen " + saux1.str() + "\n" ;
1946 { std::stringstream saux1 ;
1947 saux1 << NumeBoundary << " " << x1 ;
1948 saux += "FAYCen " + saux1.str() + "\n" ;
1950 { std::stringstream saux1 ;
1951 saux1 << NumeBoundary << " " << x2 ;
1952 saux += "FAZCen " + saux1.str() + "\n" ;
1954 { std::stringstream saux1 ;
1955 saux1 << NumeBoundary << " " << x3 ;
1956 saux += "FARayon " + saux1.str() + "\n" ;
1960 // Cas du cone defini par un axe et un angle
1962 if ( BoundaryType == 3 )
1964 { std::stringstream saux1 ;
1965 saux1 << NumeBoundary << " " << x0 ;
1966 saux += "FAXAxe " + saux1.str() + "\n" ;
1968 { std::stringstream saux1 ;
1969 saux1 << NumeBoundary << " " << x1 ;
1970 saux += "FAYAxe " + saux1.str() + "\n" ;
1972 { std::stringstream saux1 ;
1973 saux1 << NumeBoundary << " " << x2 ;
1974 saux += "FAZAxe " + saux1.str() + "\n" ;
1976 { std::stringstream saux1 ;
1977 saux1 << NumeBoundary << " " << x3 ;
1978 saux += "FAAngle " + saux1.str() + "\n" ;
1980 { std::stringstream saux1 ;
1981 saux1 << NumeBoundary << " " << x4 ;
1982 saux += "FAXCen " + saux1.str() + "\n" ;
1984 { std::stringstream saux1 ;
1985 saux1 << NumeBoundary << " " << x5 ;
1986 saux += "FAYCen " + saux1.str() + "\n" ;
1988 { std::stringstream saux1 ;
1989 saux1 << NumeBoundary << " " << x6 ;
1990 saux += "FAZCen " + saux1.str() + "\n" ;
1994 // Cas du cone defini par les 2 rayons
1996 if ( BoundaryType == 4 )
1998 { std::stringstream saux1 ;
1999 saux1 << NumeBoundary << " " << x0 ;
2000 saux += "FAXCen " + saux1.str() + "\n" ;
2002 { std::stringstream saux1 ;
2003 saux1 << NumeBoundary << " " << x1 ;
2004 saux += "FAYCen " + saux1.str() + "\n" ;
2006 { std::stringstream saux1 ;
2007 saux1 << NumeBoundary << " " << x2 ;
2008 saux += "FAZCen " + saux1.str() + "\n" ;
2010 { std::stringstream saux1 ;
2011 saux1 << NumeBoundary << " " << x3 ;
2012 saux += "FARayon " + saux1.str() + "\n" ;
2014 { std::stringstream saux1 ;
2015 saux1 << NumeBoundary << " " << x4 ;
2016 saux += "FAXCen2 " + saux1.str() + "\n" ;
2018 { std::stringstream saux1 ;
2019 saux1 << NumeBoundary << " " << x5 ;
2020 saux += "FAYCen2 " + saux1.str() + "\n" ;
2022 { std::stringstream saux1 ;
2023 saux1 << NumeBoundary << " " << x6 ;
2024 saux += "FAZCen2 " + saux1.str() + "\n" ;
2026 { std::stringstream saux1 ;
2027 saux1 << NumeBoundary << " " << x7 ;
2028 saux += "FARayon2 " + saux1.str() + "\n" ;
2034 if ( BoundaryType == 5 )
2036 { std::stringstream saux1 ;
2037 saux1 << NumeBoundary << " " << x0 ;
2038 saux2 = saux1.str() ;
2039 saux += "FAXCen " + saux1.str() + "\n" ;
2041 { std::stringstream saux1 ;
2042 saux1 << NumeBoundary << " " << x1 ;
2043 saux += "FAYCen " + saux1.str() + "\n" ;
2045 { std::stringstream saux1 ;
2046 saux1 << NumeBoundary << " " << x2 ;
2047 saux += "FAZCen " + saux1.str() + "\n" ;
2049 { std::stringstream saux1 ;
2050 saux1 << NumeBoundary << " " << x3 ;
2051 saux += "FAXAxe " + saux1.str() + "\n" ;
2053 { std::stringstream saux1 ;
2054 saux1 << NumeBoundary << " " << x4 ;
2055 saux += "FAYAxe " + saux1.str() + "\n" ;
2057 { std::stringstream saux1 ;
2058 saux1 << NumeBoundary << " " << x5 ;
2059 saux += "FAZAxe " + saux1.str() + "\n" ;
2061 { std::stringstream saux1 ;
2062 saux1 << NumeBoundary << " " << x6 ;
2063 saux += "FARayon " + saux1.str() + "\n" ;
2065 { std::stringstream saux1 ;
2066 saux1 << NumeBoundary << " " << x7 ;
2067 saux += "FARayon2 " + saux1.str() + "\n" ;
2071 _Texte += saux + "#\n" ;
2074 //===============================================================================
2075 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
2077 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
2078 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
2079 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
2083 std::string saux, saux2 ;
2084 std::stringstream saux1 ;
2085 saux1 << NumeBoundary ;
2086 saux2 = saux1.str() ;
2087 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
2089 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
2090 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
2092 _Texte += saux + "#\n" ;
2095 //===============================================================================
2096 // E. Les interpolations
2097 //===============================================================================
2098 // Les fichiers d'entree et de sortie des champs a interpoler
2099 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
2101 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
2103 _Texte += "#\n# Interpolations des champs\n" ;
2105 // Fichier en entree
2106 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
2107 // Fichier en sortie
2108 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
2110 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
2112 //===============================================================================
2113 // Tous les champs sont a interpoler
2114 void HomardDriver::TexteFieldInterpAll( )
2116 MESSAGE("TexteFieldInterpAll");
2118 _Texte += "CCChaTou oui\n" ;
2120 //===============================================================================
2121 // Ecrit les caracteristiques de chaque interpolation sous la forme :
2122 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
2123 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
2124 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
2125 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
2126 // CCChaPdT 2 14 ! Pas de temps 14
2127 // CCChaNuO 2 14 ! Numero d'ordre 14
2130 // NumeChamp : numero d'ordre du champ a interpoler
2131 // FieldName : nom du champ
2132 // TypeInterp : type d'interpolation
2133 // TimeStep : pas de temps retenu (>0 si pas de precision)
2134 // Rank : numero d'ordre retenu
2136 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
2138 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
2139 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
2140 // Numero d'ordre du champ a interpoler
2141 std::stringstream saux1 ;
2142 saux1 << NumeChamp ;
2143 std::string saux = saux1.str() ;
2145 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
2146 // Type d'interpolation pour le champ
2147 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
2149 if ( TimeStep >= 0 )
2152 std::stringstream saux1 ;
2154 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
2157 std::stringstream saux1 ;
2159 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
2163 //===============================================================================
2164 // F. Les options avancees
2165 //===============================================================================
2166 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
2168 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
2172 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
2173 _Texte += "TypeElem ignore_pyra\n" ;
2177 _Texte += "# Niveaux extremes\n" ;
2178 { std::stringstream saux1 ;
2180 _Texte += "NiveauMa " + saux1.str() + "\n" ;
2185 _Texte += "# Diametre minimal\n" ;
2186 { std::stringstream saux1 ;
2188 _Texte += "DiametMi " + saux1.str() + "\n" ;
2191 if ( AdapInit != 0 )
2194 { _Texte += "# Raffinement" ; }
2196 { _Texte += "# Deraffinement" ; }
2197 _Texte += " des regions sans indicateur\n" ;
2198 { std::stringstream saux1 ;
2200 _Texte += "AdapInit " + saux1.str() + "\n" ;
2203 if ( ExtraOutput % 2 == 0 )
2205 _Texte += "# Sortie des niveaux de raffinement\n" ;
2206 _Texte += "NCNiveau NIVEAU\n" ;
2208 if ( ExtraOutput % 3 == 0 )
2210 _Texte += "# Sortie des qualités des mailles\n" ;
2211 _Texte += "NCQualit QUAL\n" ;
2213 if ( ExtraOutput % 5 == 0 )
2215 _Texte += "# Sortie des diamètres des mailles\n" ;
2216 _Texte += "NCDiamet DIAM\n" ;
2218 if ( ExtraOutput % 7 == 0 )
2220 _Texte += "# Sortie des parents des mailles\n" ;
2221 _Texte += "NCParent PARENT\n" ;
2223 if ( ExtraOutput % 11 == 0 )
2225 _Texte += "# Volumes voisins par recollement\n" ;
2226 _Texte += "NCVoisRc Voisin-Recollement\n" ;
2229 //===============================================================================
2231 //===============================================================================
2232 void HomardDriver::TexteInfoCompute( int MessInfo )
2234 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
2236 if ( MessInfo != 0 )
2238 _Texte += "# Messages d'informations\n" ;
2239 { std::stringstream saux1 ;
2241 _Texte += "MessInfo " + saux1.str() + "\n" ;
2245 //===============================================================================
2246 void HomardDriver::CreeFichier( )
2249 if ( _modeHOMARD == 1 )
2250 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
2251 else if ( _modeHOMARD == 2 )
2252 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
2253 else if ( _modeHOMARD == 5 )
2254 { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
2256 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
2257 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
2261 //===============================================================================
2262 // Creation du fichier de donnees pour l'information
2263 //===============================================================================
2264 void HomardDriver::CreeFichierDonn( )
2267 MESSAGE("CreeFichierDonn");
2268 _NomFichierDonn = "info.donn" ;
2274 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
2275 if (Fic.is_open() == true) { Fic << data << std::endl ; }
2279 //===============================================================================
2280 int HomardDriver::ExecuteHomard(int option)
2282 MESSAGE("ExecuteHomard, avec option = "<<option);
2283 std::string commande ;
2285 // Copie des Fichiers HOMARD
2286 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
2287 codret = system(commande.c_str()) ;
2289 // Execution de HOMARD
2292 commande = _HOMARD_Exec.c_str() ;
2293 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
2294 codret = system(commande.c_str());
2295 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
2296 _NomFichierDonn = "" ;
2301 //=============================================================================
2302 //=============================================================================
2303 HOMARD_Gen::HOMARD_Gen()
2305 MESSAGE("HOMARD_Gen");
2308 //=============================================================================
2309 //=============================================================================
2310 HOMARD_Gen::~HOMARD_Gen()
2312 MESSAGE("~HOMARD_Gen");
2314 //=============================================================================
2316 //=============================================================================
2318 * default constructor:
2320 //=============================================================================
2321 HOMARD_Hypothesis::HOMARD_Hypothesis():
2322 _Name(""), _NomCasCreation(""),
2323 _TypeAdap(-1), _TypeRaff(0), _TypeDera(0),
2325 _TypeThR(0), _ThreshR(0),
2326 _TypeThC(0), _ThreshC(0),
2327 _UsField(0), _UsCmpI(0), _TypeFieldInterp(0)
2329 MESSAGE("HOMARD_Hypothesis");
2332 //=============================================================================
2335 //=============================================================================
2336 HOMARD_Hypothesis::~HOMARD_Hypothesis()
2338 MESSAGE("~HOMARD_Hypothesis");
2340 //=============================================================================
2341 //=============================================================================
2343 //=============================================================================
2344 //=============================================================================
2345 void HOMARD_Hypothesis::SetName( const char* Name )
2347 _Name = std::string( Name );
2349 //=============================================================================
2350 std::string HOMARD_Hypothesis::GetName() const
2354 //=============================================================================
2355 std::string HOMARD_Hypothesis::GetDumpPython() const
2357 std::ostringstream aScript;
2358 aScript << "\n# Creation of the hypothesis " << _Name << "\n" ;
2359 aScript << "\t" << _Name << " = homard.CreateHypothesis(\"" << _Name << "\")\n";
2360 if ( _TypeAdap == -1 )
2363 if ( _TypeRaff == 1 ) { TypeRaffDera = 1 ; }
2364 else { TypeRaffDera = -1 ; }
2365 aScript << "\t" << _Name << ".SetUnifRefinUnRef(" << TypeRaffDera << ")\n";
2368 // Raffinement selon des zones geometriques
2369 std::list<std::string>::const_iterator it = _ListZone.begin();
2371 while(it != _ListZone.end())
2373 aScript << "\t" << _Name << ".AddZone(\"" << *it;
2375 if ( *it == "1" ) { TypeUse = 1 ; }
2376 else { TypeUse = -1 ; }
2377 aScript << "\", " << TypeUse << ")\n";
2381 // Raffinement selon un champ
2382 if ( _TypeAdap == 1 )
2384 aScript << "\t" << _Name << ".SetField(\"" << _Field << "\")\n";
2385 aScript << "\t" << _Name << ".SetUseField(" << _UsField << ")\n";
2386 aScript << "\t" << _Name << ".SetUseComp(" << _UsCmpI << ")\n";
2387 std::list<std::string>::const_iterator it_comp = _ListComp.begin();
2388 while(it_comp != _ListComp.end())
2390 aScript << "\t" << _Name << ".AddComp(\"" << *it_comp << "\")\n";
2393 if ( _TypeRaff == 1 )
2395 aScript << "\t" << _Name << ".SetRefinThr(" << _TypeThR << ", " << _ThreshR << ")\n";
2397 if ( _TypeDera == 1 )
2399 aScript << "\t" << _Name << ".SetUnRefThr(" << _TypeThC << ", " << _ThreshC << ")\n";
2403 // Filtrage du raffinement par des groupes
2404 for ( it=_ListGroupSelected.begin(); it!=_ListGroupSelected.end();it++)
2405 aScript << "\t" << _Name << ".AddGroup(\"" << (*it) << "\")\n" ;
2407 // Interpolation des champs
2408 if ( _TypeFieldInterp == 2 )
2410 std::list<std::string>::const_iterator it_champ = _ListFieldInterp.begin();
2411 while(it_champ != _ListFieldInterp.end())
2413 aScript << "\t" << _Name << ".AddFieldInterpType( \"" << *it_champ << "\" " ;
2415 aScript << ", " << *it_champ << ")\n";
2419 else if ( _TypeFieldInterp != 0 )
2421 aScript << "\t" << _Name << ".SetTypeFieldInterp(" << _TypeFieldInterp << ")\n";
2425 aScript << "\t" <<_Name << ".SetNivMax(" << _NivMax << ")\n";
2429 aScript << "\t" <<_Name << ".SetDiamMin(" << _DiamMin << ")\n";
2431 if ( _AdapInit != 0 )
2433 aScript << "\t" <<_Name << ".SetAdapInit(" << _AdapInit << ")\n";
2435 if ( _ExtraOutput != 1 )
2437 aScript << "\t" <<_Name << ".SetExtraOutput(" << _ExtraOutput << ")\n";
2440 return aScript.str();
2442 //=============================================================================
2443 //=============================================================================
2445 //=============================================================================
2446 //=============================================================================
2447 void HOMARD_Hypothesis::SetAdapType( int TypeAdap )
2449 VERIFICATION( (TypeAdap>=-1) && (TypeAdap<=1) );
2450 _TypeAdap = TypeAdap;
2452 //=============================================================================
2453 int HOMARD_Hypothesis::GetAdapType() const
2457 //=============================================================================
2458 void HOMARD_Hypothesis::SetRefinTypeDera( int TypeRaff, int TypeDera )
2460 VERIFICATION( (TypeRaff>=-1) && (TypeRaff<=1) );
2461 _TypeRaff = TypeRaff;
2462 VERIFICATION( (TypeDera>=-1) && (TypeDera<=1) );
2463 _TypeDera = TypeDera;
2465 //=============================================================================
2466 int HOMARD_Hypothesis::GetRefinType() const
2470 //=============================================================================
2471 int HOMARD_Hypothesis::GetUnRefType() const
2475 //=============================================================================
2476 void HOMARD_Hypothesis::SetField( const char* FieldName )
2478 _Field = std::string( FieldName );
2479 MESSAGE( "SetField : FieldName = " << FieldName );
2481 //=============================================================================
2482 std::string HOMARD_Hypothesis::GetFieldName() const
2486 //=============================================================================
2487 void HOMARD_Hypothesis::SetUseField( int UsField )
2489 VERIFICATION( (UsField>=0) && (UsField<=1) );
2492 //=============================================================================
2493 int HOMARD_Hypothesis::GetUseField() const
2497 //=============================================================================
2498 void HOMARD_Hypothesis::SetUseComp( int UsCmpI )
2500 MESSAGE ("SetUseComp pour UsCmpI = "<<UsCmpI) ;
2501 VERIFICATION( (UsCmpI>=0) && (UsCmpI<=2) );
2504 //=============================================================================
2505 int HOMARD_Hypothesis::GetUseComp() const
2509 //=============================================================================
2510 void HOMARD_Hypothesis::AddComp( const char* NomComp )
2512 // On commence par supprimer la composante au cas ou elle aurait deja ete inseree
2513 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2514 // definition de l'hypothese
2515 SupprComp( NomComp ) ;
2516 // Insertion veritable
2517 _ListComp.push_back( std::string( NomComp ) );
2519 //=============================================================================
2520 void HOMARD_Hypothesis::SupprComp( const char* NomComp )
2522 MESSAGE ("SupprComp pour "<<NomComp) ;
2523 std::list<std::string>::iterator it = find( _ListComp.begin(), _ListComp.end(), NomComp );
2524 if ( it != _ListComp.end() ) { it = _ListComp.erase( it ); }
2526 //=============================================================================
2527 void HOMARD_Hypothesis::SupprComps()
2531 //=============================================================================
2532 const std::list<std::string>& HOMARD_Hypothesis::GetComps() const
2536 //=============================================================================
2537 void HOMARD_Hypothesis::SetRefinThr( int TypeThR, double ThreshR )
2539 MESSAGE( "SetRefinThr : TypeThR = " << TypeThR << ", ThreshR = " << ThreshR );
2540 VERIFICATION( (TypeThR>=0) && (TypeThR<=4) );
2544 //=============================================================================
2545 int HOMARD_Hypothesis::GetRefinThrType() const
2549 //=============================================================================
2550 double HOMARD_Hypothesis::GetThreshR() const
2554 //=============================================================================
2555 void HOMARD_Hypothesis::SetUnRefThr( int TypeThC, double ThreshC )
2557 VERIFICATION( (TypeThC>=0) && (TypeThC<=4) );
2561 //=============================================================================
2562 int HOMARD_Hypothesis::GetUnRefThrType() const
2566 //=============================================================================
2567 double HOMARD_Hypothesis::GetThreshC() const
2571 //=============================================================================
2572 void HOMARD_Hypothesis::SetNivMax( int NivMax )
2573 //=============================================================================
2577 //=============================================================================
2578 const int HOMARD_Hypothesis::GetNivMax() const
2579 //=============================================================================
2583 //=============================================================================
2584 void HOMARD_Hypothesis::SetDiamMin( double DiamMin )
2585 //=============================================================================
2589 //=============================================================================
2590 const double HOMARD_Hypothesis::GetDiamMin() const
2591 //=============================================================================
2595 //=============================================================================
2596 void HOMARD_Hypothesis::SetAdapInit( int AdapInit )
2597 //=============================================================================
2599 _AdapInit = AdapInit;
2601 //=============================================================================
2602 const int HOMARD_Hypothesis::GetAdapInit() const
2603 //=============================================================================
2607 //=============================================================================
2608 void HOMARD_Hypothesis::SetExtraOutput( int ExtraOutput )
2609 //=============================================================================
2611 _ExtraOutput = ExtraOutput;
2613 //=============================================================================
2614 const int HOMARD_Hypothesis::GetExtraOutput() const
2615 //=============================================================================
2617 return _ExtraOutput;
2619 //=============================================================================
2620 void HOMARD_Hypothesis::AddGroup( const char* Group)
2622 // On commence par supprimer le groupe au cas ou il aurait deja ete insere
2623 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2624 // definition de l'hypothese
2625 SupprGroup( Group ) ;
2626 // Insertion veritable
2627 _ListGroupSelected.push_back(Group);
2629 //=============================================================================
2630 void HOMARD_Hypothesis::SupprGroup( const char* Group )
2632 MESSAGE ("SupprGroup pour "<<Group) ;
2633 std::list<std::string>::iterator it = find( _ListGroupSelected.begin(), _ListGroupSelected.end(), Group );
2634 if ( it != _ListGroupSelected.end() ) { it = _ListGroupSelected.erase( it ); }
2636 //=============================================================================
2637 void HOMARD_Hypothesis::SupprGroups()
2639 _ListGroupSelected.clear();
2641 //=============================================================================
2642 void HOMARD_Hypothesis::SetGroups( const std::list<std::string>& ListGroup )
2644 _ListGroupSelected.clear();
2645 std::list<std::string>::const_iterator it = ListGroup.begin();
2646 while(it != ListGroup.end())
2647 _ListGroupSelected.push_back((*it++));
2649 //=============================================================================
2650 const std::list<std::string>& HOMARD_Hypothesis::GetGroups() const
2652 return _ListGroupSelected;
2654 //=============================================================================
2655 // Type d'interpolation des champs :
2656 // 0 : aucun champ n'est interpole
2657 // 1 : tous les champs sont interpoles
2658 // 2 : certains champs sont interpoles
2659 void HOMARD_Hypothesis::SetTypeFieldInterp( int TypeFieldInterp )
2661 VERIFICATION( (TypeFieldInterp>=0) && (TypeFieldInterp<=2) );
2662 _TypeFieldInterp = TypeFieldInterp;
2664 //=============================================================================
2665 int HOMARD_Hypothesis::GetTypeFieldInterp() const
2667 return _TypeFieldInterp;
2669 //=============================================================================
2670 void HOMARD_Hypothesis::AddFieldInterpType( const char* FieldInterp, int TypeInterp )
2672 MESSAGE ("Dans AddFieldInterpType pour " << FieldInterp << " et TypeInterp = " << TypeInterp) ;
2673 // On commence par supprimer le champ au cas ou il aurait deja ete insere
2674 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2675 // definition de l'hypothese
2676 SupprFieldInterp( FieldInterp ) ;
2677 // Insertion veritable
2679 _ListFieldInterp.push_back( std::string( FieldInterp ) );
2681 std::stringstream saux1 ;
2682 saux1 << TypeInterp ;
2683 _ListFieldInterp.push_back( saux1.str() );
2684 // . Indication generale : certains champs sont a interpoler
2685 SetTypeFieldInterp ( 2 ) ;
2687 //=============================================================================
2688 void HOMARD_Hypothesis::SupprFieldInterp( const char* FieldInterp )
2690 MESSAGE ("Dans SupprFieldInterp pour " << FieldInterp) ;
2691 std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp ) ;
2692 // Attention a supprimer le nom du champ et le type d'usage
2693 if ( it != _ListFieldInterp.end() )
2695 it = _ListFieldInterp.erase( it ) ;
2696 it = _ListFieldInterp.erase( it ) ;
2698 // Decompte du nombre de champs restant a interpoler
2699 it = _ListFieldInterp.begin() ;
2701 while(it != _ListFieldInterp.end())
2706 MESSAGE("Nombre de champ restants = "<<cpt/2);
2707 // . Indication generale : aucun champ ne reste a interpoler
2710 SetTypeFieldInterp ( 0 ) ;
2713 //=============================================================================
2714 void HOMARD_Hypothesis::SupprFieldInterps()
2716 MESSAGE ("SupprFieldInterps") ;
2717 _ListFieldInterp.clear();
2718 // . Indication generale : aucun champ ne reste a interpoler
2719 SetTypeFieldInterp ( 0 ) ;
2721 //=============================================================================
2722 const std::list<std::string>& HOMARD_Hypothesis::GetFieldInterps() const
2724 return _ListFieldInterp;
2726 //=============================================================================
2727 //=============================================================================
2728 // Liens avec les autres structures
2729 //=============================================================================
2730 //=============================================================================
2731 void HOMARD_Hypothesis::SetCaseCreation( const char* NomCasCreation )
2733 _NomCasCreation = std::string( NomCasCreation );
2735 //=============================================================================
2736 std::string HOMARD_Hypothesis::GetCaseCreation() const
2738 return _NomCasCreation;
2740 //=============================================================================
2741 void HOMARD_Hypothesis::LinkIteration( const char* NomIteration )
2743 _ListIter.push_back( std::string( NomIteration ) );
2745 //=============================================================================
2746 void HOMARD_Hypothesis::UnLinkIteration( const char* NomIteration )
2748 std::list<std::string>::iterator it = find( _ListIter.begin(), _ListIter.end(), NomIteration ) ;
2749 if ( it != _ListIter.end() )
2751 MESSAGE ("Dans UnLinkIteration pour " << NomIteration) ;
2752 it = _ListIter.erase( it ) ;
2755 //=============================================================================
2756 void HOMARD_Hypothesis::UnLinkIterations()
2760 //=============================================================================
2761 const std::list<std::string>& HOMARD_Hypothesis::GetIterations() const
2765 //=============================================================================
2766 void HOMARD_Hypothesis::AddZone( const char* NomZone, int TypeUse )
2768 MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse) ;
2769 // On commence par supprimer la zone au cas ou elle aurait deja ete inseree
2770 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2771 // definition de l'hypothese
2772 SupprZone( NomZone ) ;
2773 // Insertion veritable
2775 _ListZone.push_back( std::string( NomZone ) );
2776 // . Usage de la zone
2777 std::stringstream saux1 ;
2779 _ListZone.push_back( saux1.str() );
2781 //=============================================================================
2782 void HOMARD_Hypothesis::SupprZone( const char* NomZone )
2784 MESSAGE ("Dans SupprZone pour " << NomZone) ;
2785 std::list<std::string>::iterator it = find( _ListZone.begin(), _ListZone.end(), NomZone );
2786 // Attention a supprimer le nom de zone et le type d'usage
2787 if ( it != _ListZone.end() )
2789 it = _ListZone.erase( it );
2790 it = _ListZone.erase( it );
2793 //=============================================================================
2794 void HOMARD_Hypothesis::SupprZones()
2798 //=============================================================================
2799 const std::list<std::string>& HOMARD_Hypothesis::GetZones() const
2804 //=============================================================================
2806 * default constructor:
2808 //=============================================================================
2809 HOMARD_Iteration::HOMARD_Iteration():
2810 _Name( "" ), _Etat( 0 ),
2812 _NomMesh( "" ), _MeshFile( "" ),
2813 _FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ),
2816 _NomHypo( "" ), _NomCas( "" ), _NomDir( "" ),
2820 MESSAGE("HOMARD_Iteration");
2822 //=============================================================================
2826 //=============================================================================
2827 HOMARD_Iteration::~HOMARD_Iteration()
2829 MESSAGE("~HOMARD_Iteration");
2831 //=============================================================================
2832 //=============================================================================
2834 //=============================================================================
2835 //=============================================================================
2836 void HOMARD_Iteration::SetName( const char* Name )
2838 _Name = std::string( Name );
2840 //=============================================================================
2841 std::string HOMARD_Iteration::GetName() const
2845 //=============================================================================
2846 std::string HOMARD_Iteration::GetDumpPython() const
2848 if (_IterParent == "") return std::string(" ") ; // Pas de creation explicite de iteration 0";
2850 MESSAGE (". Ecriture de l iteration " << _Name );
2851 std::ostringstream aScript;
2852 aScript << "\n# Creation of the iteration " << _Name << "\n";
2855 aScript << "\t" << _Name << " = " << _NomCas << ".NextIteration(\"" << _Name << "\")\n";
2859 aScript << "\t" << _Name << " = " << _IterParent << ".NextIteration(\"" << _Name << "\")\n";
2861 // L'hypothese (doit etre au debut)
2862 aScript << "\t" << _Name << ".AssociateHypo(\"" << _NomHypo << "\")\n";
2863 // Le nom du maillage produit
2864 // MESSAGE (".. maillage produit " << _NomMesh );
2865 aScript << "\t" << _Name << ".SetMeshName(\"" << _NomMesh << "\")\n" ;
2866 // Le fichier du maillage produit
2867 aScript << "\t" << _Name << ".SetMeshFile(\"" << _MeshFile << "\")\n";
2868 // Le fichier des champs
2869 if ( _FieldFile != "" )
2871 aScript << "\t" << _Name << ".SetFieldFile(\"" << _FieldFile << "\")\n";
2873 // Si champ de pilotage, valeurs de pas de temps
2874 MESSAGE (". champ de pilotage : _TimeStep = " << _TimeStep << ", _Rank : " << _Rank);
2875 if ( _TimeStep != -1 )
2877 if ( _TimeStep == -2 ) {
2878 aScript << "\t" << _Name << ".SetTimeStepRankLast()\n";
2882 if ( _TimeStep != -1 )
2886 aScript << "\t" << _Name << ".SetTimeStep( " << _TimeStep << " )\n";
2890 aScript << "\t" << _Name << ".SetTimeStepRank( " << _TimeStep << ", " << _Rank << " )\n";
2895 // Les instants d'interpolation
2896 MESSAGE (". instants d'interpolation ");
2897 std::list<std::string>::const_iterator it = _ListFieldInterpTSR.begin() ;
2898 while(it != _ListFieldInterpTSR.end())
2900 std::string FieldName = std::string((*it)) ;
2901 // MESSAGE ("... FieldName = "<< FieldName);
2903 std::string TimeStepstr = std::string((*it)) ;
2904 // MESSAGE ("... TimeStepstr = "<< TimeStepstr);
2906 std::string Rankstr = std::string((*it)) ;
2907 // MESSAGE ("... Rankstr = "<< Rankstr);
2909 aScript << "\t" << _Name << ".SetFieldInterpTimeStepRank( \"" << FieldName << "\"" ;
2910 aScript << ", " << TimeStepstr ;
2911 aScript << ", " << Rankstr << " )\n" ;
2915 MESSAGE (". Compute ");
2916 if ( _Etat == 2 ) { aScript << "\tcodret = " <<_Name << ".Compute(1, 1)\n"; }
2917 else { aScript << "\t#codret = " <<_Name << ".Compute(1, 1)\n"; }
2918 // MESSAGE (". Fin de l ecriture de l iteration " << _Name );
2920 return aScript.str();
2922 //=============================================================================
2923 //=============================================================================
2925 //=============================================================================
2926 //=============================================================================
2927 void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
2929 _NomDir = std::string( NomDir );
2931 //=============================================================================
2932 std::string HOMARD_Iteration::GetDirNameLoc() const
2936 //=============================================================================
2937 void HOMARD_Iteration::SetNumber( int NumIter )
2941 //=============================================================================
2942 int HOMARD_Iteration::GetNumber() const
2946 //=============================================================================
2947 void HOMARD_Iteration::SetState( int etat )
2951 //=============================================================================
2952 int HOMARD_Iteration::GetState() const
2956 //=============================================================================
2957 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
2959 _NomMesh = std::string( NomMesh );
2961 //=============================================================================
2962 std::string HOMARD_Iteration::GetMeshName() const
2966 //=============================================================================
2967 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
2969 _MeshFile = std::string( MeshFile );
2971 //=============================================================================
2972 std::string HOMARD_Iteration::GetMeshFile() const
2976 //=============================================================================
2977 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
2979 _FieldFile = std::string( FieldFile );
2981 //=============================================================================
2982 std::string HOMARD_Iteration::GetFieldFile() const
2986 //=============================================================================
2987 // Instants pour le champ de pilotage
2988 //=============================================================================
2989 void HOMARD_Iteration::SetTimeStep( int TimeStep )
2991 _TimeStep = TimeStep;
2993 //=============================================================================
2994 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
2996 _TimeStep = TimeStep;
2999 //=============================================================================
3000 void HOMARD_Iteration::SetTimeStepRankLast()
3004 //=============================================================================
3005 int HOMARD_Iteration::GetTimeStep() const
3009 //=============================================================================
3010 int HOMARD_Iteration::GetRank() const
3014 //=============================================================================
3015 // Instants pour un champ a interpoler
3016 //=============================================================================
3017 void HOMARD_Iteration::SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep )
3019 SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep ) ;
3021 //=============================================================================
3022 void HOMARD_Iteration::SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank )
3024 MESSAGE("Champ " << FieldInterp << ", hypothese " << _NomHypo )
3025 // Verification de la presence du champ dans l'hypothese
3026 std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp );
3027 if ( it == _ListFieldInterp.end() )
3029 INFOS("Champ " << FieldInterp << " ; hypothese " << _NomHypo )
3030 VERIFICATION("Le champ est inconnu dans l'hypothese associee a cette iteration." == 0);
3034 _ListFieldInterpTSR.push_back( std::string( FieldInterp ) );
3036 std::stringstream saux1 ;
3038 _ListFieldInterpTSR.push_back( saux1.str() );
3040 std::stringstream saux2 ;
3042 _ListFieldInterpTSR.push_back( saux2.str() );
3044 //=============================================================================
3045 const std::list<std::string>& HOMARD_Iteration::GetFieldInterpsTimeStepRank() const
3047 return _ListFieldInterpTSR;
3049 //=============================================================================
3050 void HOMARD_Iteration::SetFieldInterp( const char* FieldInterp )
3052 _ListFieldInterp.push_back( std::string( FieldInterp ) );
3054 //=============================================================================
3055 const std::list<std::string>& HOMARD_Iteration::GetFieldInterps() const
3057 return _ListFieldInterp;
3059 //=============================================================================
3060 void HOMARD_Iteration::SupprFieldInterps()
3062 _ListFieldInterp.clear();
3064 //=============================================================================
3065 void HOMARD_Iteration::SetLogFile( const char* LogFile )
3067 _LogFile = std::string( LogFile );
3069 //=============================================================================
3070 std::string HOMARD_Iteration::GetLogFile() const
3074 //=============================================================================
3075 void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
3077 _FileInfo = std::string( FileInfo );
3079 //=============================================================================
3080 std::string HOMARD_Iteration::GetFileInfo() const
3084 //=============================================================================
3085 //=============================================================================
3086 // Liens avec les autres iterations
3087 //=============================================================================
3088 //=============================================================================
3089 void HOMARD_Iteration::LinkNextIteration( const char* NomIteration )
3091 _mesIterFilles.push_back( std::string( NomIteration ) );
3093 //=============================================================================
3094 void HOMARD_Iteration::UnLinkNextIteration( const char* NomIteration )
3096 std::list<std::string>::iterator it = find( _mesIterFilles.begin(), _mesIterFilles.end(), NomIteration ) ;
3097 if ( it != _mesIterFilles.end() )
3099 MESSAGE ("Dans UnLinkNextIteration pour " << NomIteration) ;
3100 it = _mesIterFilles.erase( it ) ;
3103 //=============================================================================
3104 void HOMARD_Iteration::UnLinkNextIterations()
3106 _mesIterFilles.clear();
3108 //=============================================================================
3109 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
3111 return _mesIterFilles;
3113 //=============================================================================
3114 void HOMARD_Iteration::SetIterParentName( const char* IterParent )
3116 _IterParent = IterParent;
3118 //=============================================================================
3119 std::string HOMARD_Iteration::GetIterParentName() const
3123 //=============================================================================
3124 //=============================================================================
3125 // Liens avec les autres structures
3126 //=============================================================================
3127 //=============================================================================
3128 void HOMARD_Iteration::SetCaseName( const char* NomCas )
3130 _NomCas = std::string( NomCas );
3132 //=============================================================================
3133 std::string HOMARD_Iteration::GetCaseName() const
3137 //=============================================================================
3138 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
3140 _NomHypo = std::string( NomHypo );
3142 //=============================================================================
3143 std::string HOMARD_Iteration::GetHypoName() const
3147 //=============================================================================
3148 //=============================================================================
3150 //=============================================================================
3151 //=============================================================================
3152 void HOMARD_Iteration::SetInfoCompute( int MessInfo )
3154 _MessInfo = MessInfo;
3156 //=============================================================================
3157 int HOMARD_Iteration::GetInfoCompute() const
3162 } // namespace SMESHHOMARDImpl /end/