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();
130 std::vector<double> coor = cas.GetBoundingBox();
131 os << separator() << coor.size();
132 for ( int i = 0; i < coor.size(); i++ )
133 os << separator() << coor[i];
135 std::list<std::string> ListString = cas.GetIterations();
136 os << separator() << ListString.size();
137 std::list<std::string>::const_iterator it;
138 for ( it = ListString.begin(); it != ListString.end(); ++it )
139 os << separator() << *it;
141 ListString = cas.GetGroups();
142 os << separator() << ListString.size();
143 for ( it = ListString.begin(); it != ListString.end(); ++it )
144 os << separator() << *it;
145 ListString = cas.GetBoundaryGroup();
146 os << separator() << ListString.size();
147 for ( it = ListString.begin(); it != ListString.end(); ++it )
148 os << separator() << *it;
150 os << separator() << 0; //cas.GetPyram()
153 // MESSAGE( ". Fin avec "<<saux);
162 \brief Dump iteration to the string
163 \param iteration iteration being dumped
164 \return string representation of the iteration
166 std::string Dump( const HOMARD_Iteration& iteration )
168 std::stringstream os;
171 MESSAGE( ". Sauvegarde de l'iteration "<<iteration.GetName());
172 os << iteration.GetName();
173 os << separator() << iteration.GetState();
174 os << separator() << iteration.GetNumber();
175 os << separator() << iteration.GetMeshFile();
176 os << separator() << iteration.GetLogFile();
177 os << separator() << iteration.GetMeshName();
178 os << separator() << iteration.GetFieldFile();
179 os << separator() << iteration.GetTimeStep();
180 os << separator() << iteration.GetRank();
181 os << separator() << iteration.GetIterParentName();
183 std::list<std::string> ListString = iteration.GetIterations();
184 os << separator() << ListString.size();
185 std::list<std::string>::const_iterator it;
186 for ( it = ListString.begin(); it != ListString.end(); ++it )
187 os << separator() << *it;
189 os << separator() << iteration.GetHypoName();
190 os << separator() << iteration.GetCaseName();
191 os << separator() << iteration.GetDirNameLoc();
194 // MESSAGE( ". Fin avec "<<saux);
202 \brief Dump hypothesis to the string
203 \param hypothesis hypothesis being dumped
204 \return string representation of the hypothesis
206 std::string Dump( const HOMARD_Hypothesis& hypothesis )
208 std::stringstream os;
211 MESSAGE( ". Sauvegarde de l'hypothese "<<hypothesis.GetName());
212 os << hypothesis.GetName();
213 os << separator() << hypothesis.GetCaseCreation();
214 os << separator() << hypothesis.GetAdapType();
215 os << separator() << hypothesis.GetRefinType();
216 os << separator() << hypothesis.GetUnRefType();
217 os << separator() << hypothesis.GetFieldName();
218 os << separator() << hypothesis.GetRefinThrType();
219 os << separator() << hypothesis.GetThreshR();
220 os << separator() << hypothesis.GetUnRefThrType();
221 os << separator() << hypothesis.GetThreshC();
222 os << separator() << hypothesis.GetUseField();
223 os << separator() << hypothesis.GetUseComp();
224 os << separator() << hypothesis.GetTypeFieldInterp();
226 std::list<std::string> ListString = hypothesis.GetIterations();
227 std::list<std::string>::const_iterator it;
228 os << separator() << ListString.size();
229 for ( it = ListString.begin(); it != ListString.end(); ++it )
230 os << separator() << *it;
232 ListString = hypothesis.GetZones();
233 os << separator() << ListString.size();
234 for ( it = ListString.begin(); it != ListString.end(); ++it )
235 os << separator() << *it;
237 ListString = hypothesis.GetComps();
238 os << separator() << ListString.size();
239 for ( it = ListString.begin(); it != ListString.end(); ++it )
240 os << separator() << *it;
242 ListString = hypothesis.GetGroups();
243 os << separator() << ListString.size();
244 for ( it = ListString.begin(); it != ListString.end(); ++it )
245 os << separator() << *it;
247 ListString = hypothesis.GetFieldInterps();
248 os << separator() << ListString.size();
249 for ( it = ListString.begin(); it != ListString.end(); ++it )
250 os << separator() << *it;
252 os << separator() << hypothesis.GetNivMax();
253 os << separator() << hypothesis.GetDiamMin();
254 os << separator() << hypothesis.GetAdapInit();
255 os << separator() << hypothesis.GetExtraOutput();
258 // MESSAGE( ". Fin avec "<<saux);
262 // ==============================
263 // 1.5. Archivage d'une frontiere
264 // ==============================
267 \brief Dump boundary to the string
268 \param boundary boundary being dumped
269 \return string representation of the boundary
271 std::string Dump( const HOMARD_Boundary& boundary )
273 std::stringstream os;
275 MESSAGE( ". Sauvegarde de la frontiere "<<boundary.GetName());
277 int BoundaryType = boundary.GetType() ;
279 os << boundary.GetName() ;
280 os << separator() << BoundaryType ;
281 os << separator() << boundary.GetCaseCreation() ;
283 if ( BoundaryType == -1 )
285 os << separator() << boundary.GetDataFile();
287 else if ( BoundaryType == 0 )
289 os << separator() << boundary.GetMeshName();
290 os << separator() << boundary.GetDataFile();
293 std::vector<double> coor = boundary.GetCoords() ;
294 for ( int i = 0; i < coor.size(); i++ )
295 os << separator() << coor[i];
296 std::vector<double> limit = boundary.GetLimit();
297 for ( int i = 0; i < limit.size(); i++ )
298 os << separator() << limit[i];
301 std::list<std::string> ListString = boundary.GetGroups();
302 std::list<std::string>::const_iterator it;
303 os << separator() << ListString.size();
304 for ( it = ListString.begin(); it != ListString.end(); ++it )
305 os << separator() << *it;
308 // MESSAGE( ". Fin avec "<<saux);
313 // 2. Restauration des objets
314 // ==========================
316 // ==========================
319 \brief Restore case from the string
320 \param cas case being restored
321 \param stream string representation of the case
322 \return \c true if case is correctly restored or \c false otherwise
324 bool Restore( HOMARD_Cas& cas, const std::string& stream )
326 MESSAGE( ". Restoration du cas ");
327 std::string::size_type start = 0;
328 std::string chunk, chunkNext;
331 chunk = getNextChunk( stream, start, ok );
332 if ( !ok ) return false;
333 cas.SetName( chunk.c_str() );
335 chunk = getNextChunk( stream, start, ok );
336 if ( !ok ) return false;
337 cas.SetDirName( chunk.c_str() );
339 chunk = getNextChunk( stream, start, ok );
340 if ( !ok ) return false;
341 cas.SetConfType( atoi( chunk.c_str() ) );
343 chunk = getNextChunk( stream, start, ok );
344 if ( !ok ) return false;
346 int size = atoi( chunk.c_str() );
347 std::vector<double> boite;
348 boite.resize( size );
349 for ( int i = 0; i < size; i++ ) {
350 chunk = getNextChunk( stream, start, ok );
351 if ( !ok ) return false;
352 boite[i] = strtod( chunk.c_str(), 0 );
354 cas.SetBoundingBox( boite );
356 chunk = getNextChunk( stream, start, ok );
357 if ( !ok ) return false;
359 size = atoi( chunk.c_str() );
360 for ( int i = 0; i < size; i++ ) {
361 chunk = getNextChunk( stream, start, ok );
362 if ( !ok ) return false;
363 cas.AddIteration( chunk.c_str() );
366 chunk = getNextChunk( stream, start, ok );
367 if ( !ok ) return false;
368 size = atoi( chunk.c_str() );
369 for ( int i = 0; i < size; i++ )
371 chunk = getNextChunk( stream, start, ok );
372 if ( !ok ) return false;
373 cas.AddGroup( chunk.c_str() );
376 chunk = getNextChunk( stream, start, ok );
377 if ( !ok ) return false;
378 size = atoi( chunk.c_str() );
379 for ( int i = 0; i < size; i++ ) {
380 chunk = getNextChunk( stream, start, ok );
381 if ( !ok ) return false;
383 chunkNext = getNextChunk( stream, start, ok );
384 if ( !ok ) return false;
385 cas.AddBoundaryGroup( chunk.c_str(), chunkNext.c_str() );
388 chunk = getNextChunk( stream, start, ok );
389 if ( !ok ) return false;
390 //cas.SetPyram( atoi( chunk.c_str() ) );
399 \brief Restore iteration from the string
400 \param iteration iteration being restored
401 \param stream string representation of the iteration
402 \return \c true if iteration is correctly restored or \c false otherwise
404 bool Restore( HOMARD_Iteration& iteration, const std::string& stream )
406 std::string::size_type start = 0;
409 chunk = getNextChunk( stream, start, ok );
410 if ( !ok ) return false;
412 iteration.SetName( chunk.c_str() );
413 chunk = getNextChunk( stream, start, ok );
414 if ( !ok ) return false;
415 iteration.SetState( atoi( chunk.c_str() ) );
416 chunk = getNextChunk( stream, start, ok );
417 if ( !ok ) return false;
418 iteration.SetNumber( atoi( chunk.c_str() ) );
419 chunk = getNextChunk( stream, start, ok );
420 if ( !ok ) return false;
421 iteration.SetMeshFile( chunk.c_str() );
422 chunk = getNextChunk( stream, start, ok );
423 if ( !ok ) return false;
424 iteration.SetLogFile( chunk.c_str() );
425 chunk = getNextChunk( stream, start, ok );
426 if ( !ok ) return false;
427 iteration.SetMeshName( chunk.c_str() );
428 chunk = getNextChunk( stream, start, ok );
429 if ( !ok ) return false;
430 iteration.SetFieldFile( chunk.c_str() );
433 chunk = getNextChunk( stream, start, ok );
434 if ( !ok ) return false;
435 timestep = atoi( chunk.c_str() );
436 chunk = getNextChunk( stream, start, ok );
437 if ( !ok ) return false;
438 rank = atoi( chunk.c_str() );
439 iteration.SetTimeStepRank( timestep, rank );
440 chunk = getNextChunk( stream, start, ok );
441 if ( !ok ) return false;
442 iteration.SetIterParentName( chunk.c_str() );
444 chunk = getNextChunk( stream, start, ok );
445 if ( !ok ) return false;
446 int size = atoi( chunk.c_str() );
447 for ( int i = 0; i < size; i++ ) {
448 chunk = getNextChunk( stream, start, ok );
449 if ( !ok ) return false;
450 iteration.LinkNextIteration( chunk.c_str() );
453 chunk = getNextChunk( stream, start, ok );
454 if ( !ok ) return false;
455 iteration.SetHypoName( chunk.c_str() );
456 chunk = getNextChunk( stream, start, ok );
457 if ( !ok ) return false;
458 iteration.SetCaseName( chunk.c_str() );
459 chunk = getNextChunk( stream, start, ok );
460 if ( !ok ) return false;
461 iteration.SetDirNameLoc( chunk.c_str() );
470 \brief Restore hypothesis from the string
471 \param hypothesis hypothesis being restored
472 \param stream string representation of the hypothesis
473 \return \c true if hypothesis is correctly restored or \c false otherwise
475 bool Restore( HOMARD_Hypothesis& hypothesis, const std::string& stream )
477 std::string::size_type start = 0;
478 std::string chunk, chunkNext;
481 chunk = getNextChunk( stream, start, ok );
482 if ( !ok ) return false;
483 hypothesis.SetName( chunk.c_str() );
485 chunk = getNextChunk( stream, start, ok );
486 if ( !ok ) return false;
487 hypothesis.SetCaseCreation( chunk.c_str() );
489 chunk = getNextChunk( stream, start, ok );
490 if ( !ok ) return false;
491 hypothesis.SetAdapType( atoi( chunk.c_str() ) );
493 chunk = getNextChunk( stream, start, ok );
494 if ( !ok ) return false;
495 int typeraff = atoi( chunk.c_str() );
496 chunk = getNextChunk( stream, start, ok );
497 if ( !ok ) return false;
498 int typedera = atoi( chunk.c_str() );
499 hypothesis.SetRefinTypeDera( typeraff, typedera );
501 chunk = getNextChunk( stream, start, ok );
502 if ( !ok ) return false;
503 hypothesis.SetField( chunk.c_str() );
505 chunk = getNextChunk( stream, start, ok );
506 if ( !ok ) return false;
507 int typethr = atoi( chunk.c_str() );
508 chunk = getNextChunk( stream, start, ok );
509 if ( !ok ) return false;
510 double threshr = strtod( chunk.c_str(), 0 );
511 hypothesis.SetRefinThr( typethr, threshr );
513 chunk = getNextChunk( stream, start, ok );
514 if ( !ok ) return false;
515 int typethc = atoi( chunk.c_str() );
516 chunk = getNextChunk( stream, start, ok );
517 if ( !ok ) return false;
518 double threshc = strtod( chunk.c_str(), 0 );
519 hypothesis.SetUnRefThr( typethc, threshc );
521 chunk = getNextChunk( stream, start, ok );
522 if ( !ok ) return false;
523 hypothesis.SetUseField(atoi(chunk.c_str()));
525 chunk = getNextChunk( stream, start, ok );
526 if ( !ok ) return false;
527 hypothesis.SetUseComp(atoi(chunk.c_str()));
529 chunk = getNextChunk( stream, start, ok );
530 if ( !ok ) return false;
531 hypothesis.SetTypeFieldInterp(atoi(chunk.c_str()));
533 chunk = getNextChunk( stream, start, ok );
534 if ( !ok ) return false;
535 int size = atoi( chunk.c_str() );
536 for ( int i = 0; i < size; i++ ) {
537 chunk = getNextChunk( stream, start, ok );
538 if ( !ok ) return false;
539 hypothesis.LinkIteration( chunk.c_str() );
542 chunk = getNextChunk( stream, start, ok );
543 if ( !ok ) return false;
544 size = atoi( chunk.c_str() );
545 for ( int i = 0; i < size; i++ ) {
546 chunk = getNextChunk( stream, start, ok );
547 if ( !ok ) return false;
549 chunkNext = getNextChunk( stream, start, ok );
550 int typeuse = atoi( chunkNext.c_str() );
551 if ( !ok ) return false;
552 hypothesis.AddZone( chunk.c_str(), typeuse );
555 chunk = getNextChunk( stream, start, ok );
556 if ( !ok ) return false;
557 size = atoi( chunk.c_str() );
558 for ( int i = 0; i < size; i++ ) {
559 chunk = getNextChunk( stream, start, ok );
560 if ( !ok ) return false;
561 hypothesis.AddComp( chunk.c_str() );
564 chunk = getNextChunk( stream, start, ok );
565 if ( !ok ) return false;
566 size = atoi( chunk.c_str() );
567 for ( int i = 0; i < size; i++ ) {
568 chunk = getNextChunk( stream, start, ok );
569 if ( !ok ) return false;
570 hypothesis.AddGroup( chunk.c_str() );
573 chunk = getNextChunk( stream, start, ok );
574 if ( !ok ) return false;
575 size = atoi( chunk.c_str() );
576 for ( int i = 0; i < size; i++ ) {
577 chunk = getNextChunk( stream, start, ok );
578 if ( !ok ) return false;
580 chunkNext = getNextChunk( stream, start, ok );
581 int TypeInterp = atoi( chunkNext.c_str() );
582 if ( !ok ) return false;
583 hypothesis.AddFieldInterpType( chunk.c_str(), TypeInterp );
586 chunk = getNextChunk( stream, start, ok );
587 if ( !ok ) return false;
588 hypothesis.SetNivMax( atoi( chunk.c_str() ) );
590 chunk = getNextChunk( stream, start, ok );
591 if ( !ok ) return false;
592 hypothesis.SetDiamMin( strtod( chunk.c_str(), 0 ) );
594 chunk = getNextChunk( stream, start, ok );
595 if ( !ok ) return false;
596 hypothesis.SetAdapInit( strtod( chunk.c_str(), 0 ) );
598 chunk = getNextChunk( stream, start, ok );
599 if ( !ok ) return false;
600 hypothesis.SetExtraOutput( strtod( chunk.c_str(), 0 ) );
606 // =================================
607 // 2.5. Restauration d'une frontiere
608 // =================================
611 \brief Restore boundary from the string
612 \param boundary boundary being restored
613 \param stream string representation of the boundary
614 \return \c true if the boundary is correctly restored or \c false otherwise
616 bool Restore( HOMARD_Boundary& boundary, const std::string& stream )
618 std::string::size_type start = 0;
622 chunk = getNextChunk( stream, start, ok );
623 if ( !ok ) return false;
624 boundary.SetName( chunk.c_str() );
626 chunk = getNextChunk( stream, start, ok );
627 if ( !ok ) return false;
628 int BoundaryType = atoi( chunk.c_str() ) ;
629 boundary.SetType( BoundaryType );
631 chunk = getNextChunk( stream, start, ok );
632 if ( !ok ) return false;
633 boundary.SetCaseCreation( chunk.c_str() );
635 // Si analytique, les coordonnees des frontieres : le nombre depend du type
636 // Si discret, le maillage
637 // Si CAO, la géométrie
639 if ( BoundaryType == -1 ) { lgcoords = -1 ; }
640 else if ( BoundaryType == 1 ) { lgcoords = 7 ; }
641 else if ( BoundaryType == 2 ) { lgcoords = 4 ; }
642 else { lgcoords = 0 ; }
644 if ( lgcoords == -1 )
646 chunk = getNextChunk( stream, start, ok );
647 if ( !ok ) return false;
648 boundary.SetDataFile( chunk.c_str() );
650 else if ( lgcoords == 0 )
652 chunk = getNextChunk( stream, start, ok );
653 if ( !ok ) return false;
654 boundary.SetMeshName( chunk.c_str() );
656 chunk = getNextChunk( stream, start, ok );
657 if ( !ok ) return false;
658 boundary.SetDataFile( chunk.c_str() );
661 { std::vector<double> coords;
662 coords.resize( lgcoords );
663 for ( int i = 0; i < lgcoords; i++ ) {
664 chunk = getNextChunk( stream, start, ok );
665 if ( !ok ) return false;
666 coords[i] = strtod( chunk.c_str(), 0 );
668 if ( BoundaryType == 1 )
669 { boundary.SetCylinder(coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],coords[6]); }
670 else if ( BoundaryType == 2 )
671 { boundary.SetSphere( coords[0], coords[1], coords[2], coords[3]); }
672 else if ( BoundaryType == 3 )
673 { boundary.SetConeA( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6]); }
674 else if ( BoundaryType == 4 )
675 { boundary.SetConeR( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7]); }
676 // Remarque : la taille de coords est suffisante pour les limites
677 for ( int i = 0; i < 3; i++ ) {
678 chunk = getNextChunk( stream, start, ok );
679 if ( !ok ) return false;
680 coords[i] = strtod( chunk.c_str(), 0 );
682 boundary.SetLimit( coords[0], coords[1], coords[2]);
685 chunk = getNextChunk( stream, start, ok );
686 if ( !ok ) return false;
687 int size = atoi( chunk.c_str() );
688 for ( int i = 0; i < size; i++ ) {
689 chunk = getNextChunk( stream, start, ok );
690 if ( !ok ) return false;
691 boundary.AddGroup( chunk.c_str() );
697 //=============================================================================
699 * default constructor:
701 //=============================================================================
702 HOMARD_Boundary::HOMARD_Boundary():
703 _Name( "" ),_Type( 1 ),
704 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
705 _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
706 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
707 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
709 MESSAGE("HOMARD_Boundary");
712 //=============================================================================
713 HOMARD_Boundary::~HOMARD_Boundary()
715 MESSAGE("~HOMARD_Boundary");
717 //=============================================================================
718 //=============================================================================
720 //=============================================================================
721 //=============================================================================
722 void HOMARD_Boundary::SetName( const char* Name )
724 _Name = std::string( Name );
726 //=============================================================================
727 std::string HOMARD_Boundary::GetName() const
731 //=============================================================================
732 std::string HOMARD_Boundary::GetDumpPython() const
734 std::ostringstream aScript;
738 aScript << _Name << " = smeshhomard.CreateBoundaryCAO(\"" << _Name << "\", ";
739 aScript << "\"" << _DataFile << "\")\n";
744 aScript << _Name << " = smeshhomard.CreateBoundaryDi(\"" << _Name << "\", ";
745 aScript << "\"" << _MeshName << "\", ";
746 aScript << "\"" << _DataFile << "\")\n";
751 aScript << _Name << " = smeshhomard.CreateBoundaryCylinder(\"" << _Name << "\", ";
752 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
757 aScript << _Name << " = smeshhomard.CreateBoundarySphere(\"" << _Name << "\", ";
758 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
763 aScript << _Name << " = smeshhomard.CreateBoundaryConeA(\"" << _Name << "\", ";
764 aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n";
769 aScript << _Name << " = smeshhomard.CreateBoundaryConeR(\"" << _Name << "\", ";
770 aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n";
775 aScript << _Name << " = smeshhomard.CreateBoundaryTorus(\"" << _Name << "\", ";
776 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon1 << ", " << _Rayon2 << ")\n";
781 return aScript.str();
783 //=============================================================================
784 //=============================================================================
786 //=============================================================================
787 //=============================================================================
788 void HOMARD_Boundary::SetType( int Type )
792 //=============================================================================
793 int HOMARD_Boundary::GetType() const
797 //=============================================================================
798 void HOMARD_Boundary::SetMeshName( const char* MeshName )
800 _MeshName = std::string( MeshName );
802 //=============================================================================
803 std::string HOMARD_Boundary::GetMeshName() const
807 //=============================================================================
808 void HOMARD_Boundary::SetDataFile( const char* DataFile )
810 _DataFile = std::string( DataFile );
812 //=============================================================================
813 std::string HOMARD_Boundary::GetDataFile() const
817 //=======================================================================================
818 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
819 double X3, double X4, double X5, double X6 )
821 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
822 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
825 //======================================================================
826 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
828 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
831 //======================================================================
832 void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
833 double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
835 _Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1;
837 _Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2;
840 //======================================================================
841 void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
842 double Xcentre, double Ycentre, double Zcentre)
844 _Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe;
846 _Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre;
848 //=======================================================================================
849 void HOMARD_Boundary::SetTorus( double X0, double X1, double X2,
850 double X3, double X4, double X5, double X6, double X7 )
852 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
853 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
857 //=======================================================================================
858 std::vector<double> HOMARD_Boundary::GetCoords() const
860 std::vector<double> mesCoor;
867 mesCoor.push_back( _Xcentre );
868 mesCoor.push_back( _Ycentre );
869 mesCoor.push_back( _Zcentre );
870 mesCoor.push_back( _Xaxe );
871 mesCoor.push_back( _Yaxe );
872 mesCoor.push_back( _Zaxe );
873 mesCoor.push_back( _rayon );
879 mesCoor.push_back( _Xcentre );
880 mesCoor.push_back( _Ycentre );
881 mesCoor.push_back( _Zcentre );
882 mesCoor.push_back( _rayon );
885 // Cone defini par un axe et un angle
888 mesCoor.push_back( _Xaxe );
889 mesCoor.push_back( _Yaxe );
890 mesCoor.push_back( _Zaxe );
891 mesCoor.push_back( _Angle );
892 mesCoor.push_back( _Xcentre );
893 mesCoor.push_back( _Ycentre );
894 mesCoor.push_back( _Zcentre );
897 // Cone defini par les 2 rayons
900 mesCoor.push_back( _Xcentre1 );
901 mesCoor.push_back( _Ycentre1 );
902 mesCoor.push_back( _Zcentre1 );
903 mesCoor.push_back( _Rayon1 );
904 mesCoor.push_back( _Xcentre2 );
905 mesCoor.push_back( _Ycentre2 );
906 mesCoor.push_back( _Zcentre2 );
907 mesCoor.push_back( _Rayon2 );
913 mesCoor.push_back( _Xcentre );
914 mesCoor.push_back( _Ycentre );
915 mesCoor.push_back( _Zcentre );
916 mesCoor.push_back( _Xaxe );
917 mesCoor.push_back( _Yaxe );
918 mesCoor.push_back( _Zaxe );
919 mesCoor.push_back( _Rayon1 );
920 mesCoor.push_back( _Rayon2 );
923 VERIFICATION( (_Type>=1) && (_Type<=5) ) ;
927 //======================================================================
928 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
930 _Xincr = X0; _Yincr = X1; _Zincr = X2;
932 //=======================================================================================
933 std::vector<double> HOMARD_Boundary::GetLimit() const
935 std::vector<double> mesLimit;
936 mesLimit.push_back( _Xincr );
937 mesLimit.push_back( _Yincr );
938 mesLimit.push_back( _Zincr );
941 //=============================================================================
942 void HOMARD_Boundary::AddGroup( const char* Group)
944 _ListGroupSelected.push_back(Group);
946 //=============================================================================
947 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
949 _ListGroupSelected.clear();
950 std::list<std::string>::const_iterator it = ListGroup.begin();
951 while(it != ListGroup.end())
952 _ListGroupSelected.push_back((*it++));
954 //=============================================================================
955 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
957 return _ListGroupSelected;
959 //=============================================================================
960 //=============================================================================
961 // Liens avec les autres structures
962 //=============================================================================
963 //=============================================================================
964 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
966 _NomCasCreation = std::string( NomCasCreation );
968 //=============================================================================
969 std::string HOMARD_Boundary::GetCaseCreation() const
971 return _NomCasCreation;
973 //=============================================================================
975 //=============================================================================
977 * default constructor:
978 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
980 //=============================================================================
981 HOMARD_Cas::HOMARD_Cas():
982 _Name(""), _NomDir("/tmp"), _ConfType(0)
984 MESSAGE("HOMARD_Cas");
986 //=============================================================================
987 HOMARD_Cas::~HOMARD_Cas()
988 //=============================================================================
990 MESSAGE("~HOMARD_Cas");
992 //=============================================================================
993 //=============================================================================
995 //=============================================================================
996 //=============================================================================
997 void HOMARD_Cas::SetName( const char* Name )
999 _Name = std::string( Name );
1001 //=============================================================================
1002 std::string HOMARD_Cas::GetName() const
1006 //=============================================================================
1007 std::string HOMARD_Cas::GetDumpPython() const
1009 std::ostringstream aScript;
1010 //aScript << _Name << ".SetDirName(\"" << _NomDir << "\")\n";
1011 aScript << _Name << ".SetConfType(" << _ConfType << ")\n";
1012 // Suivi de frontieres
1013 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
1014 while (it != _ListBoundaryGroup.end()) {
1015 aScript << _Name << ".AddBoundaryGroup(\"" << *it << "\", \"";
1017 aScript << *it << "\")\n";
1021 return aScript.str();
1023 //=============================================================================
1024 //=============================================================================
1026 //=============================================================================
1027 //=============================================================================
1028 int HOMARD_Cas::SetDirName( const char* NomDir )
1030 // MESSAGE("SetDirName, NomDir : "<<NomDir);
1031 // MESSAGE("SetDirName, _NomDir : "<<_NomDir);
1033 // On vérifie qu'aucun calcul n'a eu lieu pour ce cas
1034 // MESSAGE("SetDirName, _ListIter.size() : "<<_ListIter.size());
1035 if ( _ListIter.size() > 1 ) { erreur = 1 ; }
1037 if ( CHDIR(NomDir) == 0 )
1038 { _NomDir = std::string( NomDir ); }
1043 if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 )
1045 if ( _mkdir(NomDir) == 0 )
1048 if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); }
1049 else { erreur = 2 ; }
1051 else { erreur = 2 ; }
1055 //=============================================================================
1056 std::string HOMARD_Cas::GetDirName() const
1060 //=============================================================================
1061 int HOMARD_Cas::GetNumberofIter()
1063 return _ListIter.size();
1066 // Le type de conformite ou non conformite
1068 //=============================================================================
1069 void HOMARD_Cas::SetConfType( int Conftype )
1071 // VERIFICATION( (Conftype>=-2) && (Conftype<=3) );
1072 _ConfType = Conftype;
1074 //=============================================================================
1075 const int HOMARD_Cas::GetConfType() const
1080 // La boite englobante
1082 //=============================================================================
1083 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
1086 _Boite.resize( extremas.size() );
1087 for ( int i = 0; i < extremas.size(); i++ )
1088 _Boite[i] = extremas[i];
1090 //=============================================================================
1091 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
1098 //=============================================================================
1099 void HOMARD_Cas::AddGroup( const char* Group )
1101 _ListGroup.push_back(Group);
1103 //=============================================================================
1104 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
1107 std::list<std::string>::const_iterator it = ListGroup.begin();
1108 while(it != ListGroup.end())
1110 _ListGroup.push_back((*it++));
1113 //=============================================================================
1114 const std::list<std::string>& HOMARD_Cas::GetGroups() const
1118 //=============================================================================
1119 void HOMARD_Cas::SupprGroups()
1126 //=============================================================================
1127 void HOMARD_Cas::AddBoundary( const char* Boundary )
1129 // MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary );
1130 const char* Group = "";
1131 AddBoundaryGroup( Boundary, Group );
1133 //=============================================================================
1134 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
1136 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary );
1137 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group );
1138 _ListBoundaryGroup.push_back( Boundary );
1139 _ListBoundaryGroup.push_back( Group );
1141 //=============================================================================
1142 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
1144 return _ListBoundaryGroup;
1146 //=============================================================================
1147 void HOMARD_Cas::SupprBoundaryGroup()
1149 _ListBoundaryGroup.clear();
1151 //=============================================================================
1152 //=============================================================================
1153 // Liens avec les autres structures
1154 //=============================================================================
1155 //=============================================================================
1156 std::string HOMARD_Cas::GetIter0Name() const
1158 // Par construction de la liste, l'iteration a ete mise en tete.
1159 return (*(_ListIter.begin()));
1161 //=============================================================================
1162 void HOMARD_Cas::AddIteration( const char* NomIteration )
1164 _ListIter.push_back( std::string( NomIteration ) );
1166 //=============================================================================
1167 const std::list<std::string>& HOMARD_Cas::GetIterations() const
1171 //=============================================================================
1172 void HOMARD_Cas::SupprIterations()
1177 //=============================================================================
1178 //=============================================================================
1179 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
1180 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
1181 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
1182 _Texte( "" ), _bLu( false )
1184 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
1185 // Le repertoire ou se trouve l'executable HOMARD
1188 if ( getenv("HOMARD_ROOT_DIR") != NULL ) { dir = getenv("HOMARD_ROOT_DIR") ; }
1189 dir += "/bin/salome";
1190 MESSAGE("dir ="<<dir);
1191 // L'executable HOMARD
1192 std::string executable = "homard";
1193 MESSAGE("executable ="<<executable);
1194 // Memorisation du nom complet de l'executable HOMARD
1195 _HOMARD_Exec = dir + "/" + executable ;
1196 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
1199 _siterp1 = siterp1 ;
1201 //=============================================================================
1202 //=============================================================================
1203 HomardDriver::~HomardDriver()
1206 //===============================================================================
1208 //===============================================================================
1209 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
1211 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
1213 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
1214 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
1215 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
1216 _Texte += "Langue \"" + Langue + "\"\n" ;
1219 //===============================================================================
1220 void HomardDriver::TexteAdap()
1222 MESSAGE("TexteAdap");
1224 _Texte += "Action homa\n";
1225 _Texte += "CCAssoci med\n";
1226 _Texte += "ModeHOMA 1\n";
1227 _Texte += "NumeIter " + _siter + "\n";
1230 //===============================================================================
1231 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
1233 MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
1235 _Texte += "ModeHOMA 2\n" ;
1236 std::stringstream saux1 ;
1238 std::string saux2 = saux1.str() ;
1239 _Texte += "TypeBila " + saux2 + "\n" ;
1240 if ( NumeIter == 0 )
1242 _Texte += "NumeIter 0\n" ;
1243 _Texte += "Action info_av\n" ;
1244 _Texte += "CCAssoci med\n" ;
1248 _Texte += "NumeIter " + _siter + "\n" ;
1249 _Texte += "Action info_ap\n" ;
1250 _Texte += "CCAssoci homard\n" ;
1255 //===============================================================================
1256 void HomardDriver::TexteMajCoords( int NumeIter )
1258 MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
1260 _Texte += "ModeHOMA 5\n" ;
1261 _Texte += "NumeIter " + _siterp1 + "\n" ;
1262 _Texte += "Action homa\n" ;
1263 _Texte += "CCAssoci med\n" ;
1264 _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
1268 //===============================================================================
1269 // B. Les maillages en entree et en sortie
1270 //===============================================================================
1271 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
1273 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
1274 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
1275 MESSAGE("TexteMaillage, apres = "<<apres);
1278 if ( apres < 1 ) { saux = "__" ; }
1280 _Texte += "# Maillages Med " + saux + "\n" ;
1281 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
1282 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
1285 //===============================================================================
1286 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
1288 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
1290 if ( apres < 1 ) { saux = "__" ; }
1291 else { saux = "P1" ; }
1293 _Texte += "# Maillage HOMARD " + liter + "\n" ;
1294 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
1297 //===============================================================================
1298 // C. Le pilotage de l'adaptation
1299 //===============================================================================
1300 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
1302 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
1303 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
1305 // Type de conformite
1312 saux = "NON_CONFORME_1_ARETE" ;
1317 saux = "CONFORME_BOITES" ;
1327 saux = "NON_CONFORME" ;
1332 saux = "NON_CONFORME_1_NOEUD" ;
1337 saux = "NON_CONFORME_INDICATEUR" ;
1341 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
1343 // Type de raffinement/deraffinement
1345 if ( TypeAdap == -1 )
1347 if ( TypeRaff == 1 )
1349 saux = "TypeRaff uniforme\n" ;
1353 saux = "TypeRaff non\n" ;
1355 if ( TypeDera == 1 )
1357 saux += "TypeDera uniforme" ;
1361 saux += "TypeDera non" ;
1366 if ( TypeRaff == 1 )
1368 saux = "TypeRaff libre\n" ;
1372 saux = "TypeRaff non\n" ;
1374 if ( TypeDera == 1 )
1376 saux += "TypeDera libre" ;
1380 saux += "TypeDera non" ;
1383 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
1385 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
1387 //===============================================================================
1388 void HomardDriver::TexteCompo( int NumeComp, const std::string NomCompo)
1390 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NomCompo = "<<NomCompo);
1391 _Texte +="CCCoChaI \"" + NomCompo + "\"\n" ;
1393 //===============================================================================
1394 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 )
1396 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
1397 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
1399 std::string saux, saux2 ;
1402 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
1403 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
1404 // Attention a mettre le bon signe a ZoneTypeHOMARD :
1405 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
1406 // <0 signifie que l'on deraffinera
1408 int ZoneTypeHOMARD ;
1409 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
1410 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
1411 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
1412 else { ZoneTypeHOMARD = ZoneType ; }
1414 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
1416 std::stringstream saux1 ;
1418 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
1420 { std::stringstream saux1 ;
1421 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
1422 saux += "ZoRaType " + saux1.str() + "\n" ;
1427 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
1428 // Y Homard <=> Y Salome
1430 saux += "#Rectangle\n" ;
1431 { std::stringstream saux1 ;
1432 saux1 << NumeZone << " " << x0 ;
1433 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1435 { std::stringstream saux1 ;
1436 saux1 << NumeZone << " " << x1 ;
1437 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1439 { std::stringstream saux1 ;
1440 saux1 << NumeZone << " " << x2 ;
1441 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1443 { std::stringstream saux1 ;
1444 saux1 << NumeZone << " " << x3 ;
1445 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1449 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
1450 // Y Homard <=> Z Salome
1452 saux += "#Rectangle\n" ;
1453 { std::stringstream saux1 ;
1454 saux1 << NumeZone << " " << x2 ;
1455 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1457 { std::stringstream saux1 ;
1458 saux1 << NumeZone << " " << x3 ;
1459 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1461 { std::stringstream saux1 ;
1462 saux1 << NumeZone << " " << x4 ;
1463 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1465 { std::stringstream saux1 ;
1466 saux1 << NumeZone << " " << x5 ;
1467 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1471 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
1472 // Y Homard <=> Z Salome
1474 saux += "#Rectangle\n" ;
1475 { std::stringstream saux1 ;
1476 saux1 << NumeZone << " " << x0 ;
1477 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1479 { std::stringstream saux1 ;
1480 saux1 << NumeZone << " " << x1 ;
1481 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1483 { std::stringstream saux1 ;
1484 saux1 << NumeZone << " " << x4 ;
1485 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1487 { std::stringstream saux1 ;
1488 saux1 << NumeZone << " " << x5 ;
1489 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1493 // Cas du parallelepipede
1495 else if ( ZoneType == 2 )
1497 saux += "# Boite\n" ;
1498 { std::stringstream saux1 ;
1499 saux1 << NumeZone << " " << x0 ;
1500 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1502 { std::stringstream saux1 ;
1503 saux1 << NumeZone << " " << x1 ;
1504 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1506 { std::stringstream saux1 ;
1507 saux1 << NumeZone << " " << x2 ;
1508 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1510 { std::stringstream saux1 ;
1511 saux1 << NumeZone << " " << x3 ;
1512 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1514 { std::stringstream saux1 ;
1515 saux1 << NumeZone << " " << x4 ;
1516 saux += "ZoRaZmin " + saux1.str() + "\n" ;
1518 { std::stringstream saux1 ;
1519 saux1 << NumeZone << " " << x5 ;
1520 saux += "ZoRaZmax " + saux1.str() + "\n" ;
1526 else if ( ZoneType == 31 || ZoneType == 61 )
1528 saux += "# Sphere\n" ;
1529 { std::stringstream saux1 ;
1530 saux1 << NumeZone << " " << x0 ;
1531 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1533 { std::stringstream saux1 ;
1534 saux1 << NumeZone << " " << x1 ;
1535 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1537 { std::stringstream saux1 ;
1538 saux1 << NumeZone << " " << x6 ;
1539 saux2 = saux1.str() ;
1540 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1541 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1543 if ( ZoneType == 61 )
1544 { std::stringstream saux1 ;
1545 saux1 << NumeZone << " " << x8 ;
1546 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1549 else if ( ZoneType == 32 || ZoneType == 62 )
1551 saux += "# Sphere\n" ;
1552 { std::stringstream saux1 ;
1553 saux1 << NumeZone << " " << x1 ;
1554 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1556 { std::stringstream saux1 ;
1557 saux1 << NumeZone << " " << x2 ;
1558 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1560 { std::stringstream saux1 ;
1561 saux1 << NumeZone << " " << x6 ;
1562 saux2 = saux1.str() ;
1563 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1564 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1566 if ( ZoneType == 62 )
1567 { std::stringstream saux1 ;
1568 saux1 << NumeZone << " " << x8 ;
1569 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1572 else if ( ZoneType == 33 || ZoneType == 63 )
1574 saux += "# Sphere\n" ;
1575 { std::stringstream saux1 ;
1576 saux1 << NumeZone << " " << x0 ;
1577 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1579 { std::stringstream saux1 ;
1580 saux1 << NumeZone << " " << x2 ;
1581 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1583 { std::stringstream saux1 ;
1584 saux1 << NumeZone << " " << x6 ;
1585 saux2 = saux1.str() ;
1586 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1587 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1589 if ( ZoneType == 63 )
1590 { std::stringstream saux1 ;
1591 saux1 << NumeZone << " " << x8 ;
1592 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1598 else if ( ZoneType == 4 )
1600 saux += "# Sphere\n" ;
1601 { std::stringstream saux1 ;
1602 saux1 << NumeZone << " " << x0 ;
1603 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1605 { std::stringstream saux1 ;
1606 saux1 << NumeZone << " " << x1 ;
1607 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1609 { std::stringstream saux1 ;
1610 saux1 << NumeZone << " " << x2 ;
1611 saux += "ZoRaZCen " + saux1.str() + "\n" ;
1613 { std::stringstream saux1 ;
1614 saux1 << NumeZone << " " << x3 ;
1615 saux += "ZoRaRayo " + saux1.str() + "\n" ;
1619 // Cas du cylindre ou du tuyau
1621 else if ( ZoneType == 5 || ZoneType == 7 )
1623 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
1624 else { saux += "# Tuyau\n" ; }
1625 { std::stringstream saux1 ;
1626 saux1 << NumeZone << " " << x0 ;
1627 saux += "ZoRaXBas " + saux1.str() + "\n" ;
1629 { std::stringstream saux1 ;
1630 saux1 << NumeZone << " " << x1 ;
1631 saux += "ZoRaYBas " + saux1.str() + "\n" ;
1633 { std::stringstream saux1 ;
1634 saux1 << NumeZone << " " << x2 ;
1635 saux += "ZoRaZBas " + saux1.str() + "\n" ;
1637 { std::stringstream saux1 ;
1638 saux1 << NumeZone << " " << x3 ;
1639 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
1641 { std::stringstream saux1 ;
1642 saux1 << NumeZone << " " << x4 ;
1643 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
1645 { std::stringstream saux1 ;
1646 saux1 << NumeZone << " " << x5 ;
1647 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
1649 { std::stringstream saux1 ;
1650 saux1 << NumeZone << " " << x6 ;
1651 saux2 = saux1.str() ;
1652 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
1653 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
1655 { std::stringstream saux1 ;
1656 saux1 << NumeZone << " " << x7 ;
1657 saux += "ZoRaHaut " + saux1.str() + "\n" ;
1659 if ( ZoneType == 7 )
1660 { std::stringstream saux1 ;
1661 saux1 << NumeZone << " " << x8 ;
1662 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1666 _Texte += saux + "#\n" ;
1668 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
1670 //===============================================================================
1671 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
1672 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
1673 int UsField, int UsCmpI )
1675 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
1676 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
1678 std::string saux, saux2 ;
1681 _Texte += "# Champ d'indicateurs\n" ;
1682 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
1683 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
1685 // Cas ou on prend le dernier pas de temps
1686 if ( TimeStep == -2 )
1687 { _Texte += "CCNumPTI Last\n" ; }
1688 // Cas avec pas de temps
1689 else if ( TimeStep >= 0 )
1692 std::stringstream saux1 ;
1694 saux2 = saux1.str() ;
1695 _Texte += "CCNumPTI " + saux2 + "\n" ;
1699 std::stringstream saux1 ;
1701 saux2 = saux1.str() ;
1702 _Texte += "CCNumOrI " + saux2 + "\n" ;
1717 std::stringstream saux1 ;
1719 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
1733 std::stringstream saux1 ;
1735 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
1740 { saux = "MAILLE" ; }
1745 _Texte += "CCModeFI " + saux + "\n" ;
1752 { saux = "INFINI" ; }
1754 { saux = "RELATIF" ; }
1757 _Texte += "CCUsCmpI " + saux + "\n" ;
1760 //===============================================================================
1761 void HomardDriver::TexteGroup( const std::string GroupName )
1763 MESSAGE("TexteGroup, GroupName = "<<GroupName);
1765 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
1768 //===============================================================================
1769 // D. Les frontieres
1770 //===============================================================================
1771 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
1773 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
1775 // Type de suivi de frontiere
1777 std::stringstream saux1 ;
1778 saux1 << BoundaryOption ;
1779 std::string saux = saux1.str() ;
1780 _Texte += "SuivFron " + saux + "\n" ;
1782 }//===============================================================================
1783 void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
1785 MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
1787 _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
1791 //===============================================================================
1792 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
1794 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
1795 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
1797 _Texte += "#\n# Frontiere discrete\n" ;
1798 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
1799 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
1802 //===============================================================================
1803 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
1805 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
1807 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
1810 //===============================================================================
1811 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 )
1813 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
1814 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
1815 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
1816 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
1818 std::string saux, saux2 ;
1822 std::stringstream saux1 ;
1823 saux1 << NumeBoundary ;
1824 saux2 = saux1.str() ;
1825 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
1826 if ( BoundaryType == 1 )
1827 { saux += "# Cylindre\n" ; }
1828 if ( BoundaryType == 2 )
1829 { saux += "# Sphere\n" ; }
1830 if ( BoundaryType == 3 || BoundaryType == 4 )
1831 { saux += "# Cone\n" ; }
1832 if ( BoundaryType == 5 )
1833 { saux += "# Tore\n" ; }
1835 // Le nom de la frontiere
1837 { std::stringstream saux1 ;
1838 saux1 << NumeBoundary ;
1839 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
1842 // Type de frontiere
1844 { std::stringstream saux1 ;
1845 saux1 << NumeBoundary << " " << BoundaryType ;
1846 saux += "FAType " + saux1.str() + "\n" ;
1851 if ( BoundaryType == 1 )
1853 { std::stringstream saux1 ;
1854 saux1 << NumeBoundary << " " << x0 ;
1855 saux2 = saux1.str() ;
1856 saux += "FAXCen " + saux1.str() + "\n" ;
1858 { std::stringstream saux1 ;
1859 saux1 << NumeBoundary << " " << x1 ;
1860 saux += "FAYCen " + saux1.str() + "\n" ;
1862 { std::stringstream saux1 ;
1863 saux1 << NumeBoundary << " " << x2 ;
1864 saux += "FAZCen " + saux1.str() + "\n" ;
1866 { std::stringstream saux1 ;
1867 saux1 << NumeBoundary << " " << x3 ;
1868 saux += "FAXAxe " + saux1.str() + "\n" ;
1870 { std::stringstream saux1 ;
1871 saux1 << NumeBoundary << " " << x4 ;
1872 saux += "FAYAxe " + saux1.str() + "\n" ;
1874 { std::stringstream saux1 ;
1875 saux1 << NumeBoundary << " " << x5 ;
1876 saux += "FAZAxe " + saux1.str() + "\n" ;
1878 { std::stringstream saux1 ;
1879 saux1 << NumeBoundary << " " << x6 ;
1880 saux += "FARayon " + saux1.str() + "\n" ;
1886 else if ( BoundaryType == 2 )
1888 { std::stringstream saux1 ;
1889 saux1 << NumeBoundary << " " << x0 ;
1890 saux += "FAXCen " + saux1.str() + "\n" ;
1892 { std::stringstream saux1 ;
1893 saux1 << NumeBoundary << " " << x1 ;
1894 saux += "FAYCen " + saux1.str() + "\n" ;
1896 { std::stringstream saux1 ;
1897 saux1 << NumeBoundary << " " << x2 ;
1898 saux += "FAZCen " + saux1.str() + "\n" ;
1900 { std::stringstream saux1 ;
1901 saux1 << NumeBoundary << " " << x3 ;
1902 saux += "FARayon " + saux1.str() + "\n" ;
1906 // Cas du cone defini par un axe et un angle
1908 if ( BoundaryType == 3 )
1910 { std::stringstream saux1 ;
1911 saux1 << NumeBoundary << " " << x0 ;
1912 saux += "FAXAxe " + saux1.str() + "\n" ;
1914 { std::stringstream saux1 ;
1915 saux1 << NumeBoundary << " " << x1 ;
1916 saux += "FAYAxe " + saux1.str() + "\n" ;
1918 { std::stringstream saux1 ;
1919 saux1 << NumeBoundary << " " << x2 ;
1920 saux += "FAZAxe " + saux1.str() + "\n" ;
1922 { std::stringstream saux1 ;
1923 saux1 << NumeBoundary << " " << x3 ;
1924 saux += "FAAngle " + saux1.str() + "\n" ;
1926 { std::stringstream saux1 ;
1927 saux1 << NumeBoundary << " " << x4 ;
1928 saux += "FAXCen " + saux1.str() + "\n" ;
1930 { std::stringstream saux1 ;
1931 saux1 << NumeBoundary << " " << x5 ;
1932 saux += "FAYCen " + saux1.str() + "\n" ;
1934 { std::stringstream saux1 ;
1935 saux1 << NumeBoundary << " " << x6 ;
1936 saux += "FAZCen " + saux1.str() + "\n" ;
1940 // Cas du cone defini par les 2 rayons
1942 if ( BoundaryType == 4 )
1944 { std::stringstream saux1 ;
1945 saux1 << NumeBoundary << " " << x0 ;
1946 saux += "FAXCen " + saux1.str() + "\n" ;
1948 { std::stringstream saux1 ;
1949 saux1 << NumeBoundary << " " << x1 ;
1950 saux += "FAYCen " + saux1.str() + "\n" ;
1952 { std::stringstream saux1 ;
1953 saux1 << NumeBoundary << " " << x2 ;
1954 saux += "FAZCen " + saux1.str() + "\n" ;
1956 { std::stringstream saux1 ;
1957 saux1 << NumeBoundary << " " << x3 ;
1958 saux += "FARayon " + saux1.str() + "\n" ;
1960 { std::stringstream saux1 ;
1961 saux1 << NumeBoundary << " " << x4 ;
1962 saux += "FAXCen2 " + saux1.str() + "\n" ;
1964 { std::stringstream saux1 ;
1965 saux1 << NumeBoundary << " " << x5 ;
1966 saux += "FAYCen2 " + saux1.str() + "\n" ;
1968 { std::stringstream saux1 ;
1969 saux1 << NumeBoundary << " " << x6 ;
1970 saux += "FAZCen2 " + saux1.str() + "\n" ;
1972 { std::stringstream saux1 ;
1973 saux1 << NumeBoundary << " " << x7 ;
1974 saux += "FARayon2 " + saux1.str() + "\n" ;
1980 if ( BoundaryType == 5 )
1982 { std::stringstream saux1 ;
1983 saux1 << NumeBoundary << " " << x0 ;
1984 saux2 = saux1.str() ;
1985 saux += "FAXCen " + saux1.str() + "\n" ;
1987 { std::stringstream saux1 ;
1988 saux1 << NumeBoundary << " " << x1 ;
1989 saux += "FAYCen " + saux1.str() + "\n" ;
1991 { std::stringstream saux1 ;
1992 saux1 << NumeBoundary << " " << x2 ;
1993 saux += "FAZCen " + saux1.str() + "\n" ;
1995 { std::stringstream saux1 ;
1996 saux1 << NumeBoundary << " " << x3 ;
1997 saux += "FAXAxe " + saux1.str() + "\n" ;
1999 { std::stringstream saux1 ;
2000 saux1 << NumeBoundary << " " << x4 ;
2001 saux += "FAYAxe " + saux1.str() + "\n" ;
2003 { std::stringstream saux1 ;
2004 saux1 << NumeBoundary << " " << x5 ;
2005 saux += "FAZAxe " + saux1.str() + "\n" ;
2007 { std::stringstream saux1 ;
2008 saux1 << NumeBoundary << " " << x6 ;
2009 saux += "FARayon " + saux1.str() + "\n" ;
2011 { std::stringstream saux1 ;
2012 saux1 << NumeBoundary << " " << x7 ;
2013 saux += "FARayon2 " + saux1.str() + "\n" ;
2017 _Texte += saux + "#\n" ;
2020 //===============================================================================
2021 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
2023 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
2024 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
2025 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
2029 std::string saux, saux2 ;
2030 std::stringstream saux1 ;
2031 saux1 << NumeBoundary ;
2032 saux2 = saux1.str() ;
2033 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
2035 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
2036 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
2038 _Texte += saux + "#\n" ;
2041 //===============================================================================
2042 // E. Les interpolations
2043 //===============================================================================
2044 // Les fichiers d'entree et de sortie des champs a interpoler
2045 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
2047 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
2049 _Texte += "#\n# Interpolations des champs\n" ;
2051 // Fichier en entree
2052 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
2053 // Fichier en sortie
2054 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
2056 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
2058 //===============================================================================
2059 // Tous les champs sont a interpoler
2060 void HomardDriver::TexteFieldInterpAll( )
2062 MESSAGE("TexteFieldInterpAll");
2064 _Texte += "CCChaTou oui\n" ;
2066 //===============================================================================
2067 // Ecrit les caracteristiques de chaque interpolation sous la forme :
2068 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
2069 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
2070 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
2071 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
2072 // CCChaPdT 2 14 ! Pas de temps 14
2073 // CCChaNuO 2 14 ! Numero d'ordre 14
2076 // NumeChamp : numero d'ordre du champ a interpoler
2077 // FieldName : nom du champ
2078 // TypeInterp : type d'interpolation
2079 // TimeStep : pas de temps retenu (>0 si pas de precision)
2080 // Rank : numero d'ordre retenu
2082 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
2084 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
2085 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
2086 // Numero d'ordre du champ a interpoler
2087 std::stringstream saux1 ;
2088 saux1 << NumeChamp ;
2089 std::string saux = saux1.str() ;
2091 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
2092 // Type d'interpolation pour le champ
2093 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
2095 if ( TimeStep >= 0 )
2098 std::stringstream saux1 ;
2100 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
2103 std::stringstream saux1 ;
2105 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
2109 //===============================================================================
2110 // F. Les options avancees
2111 //===============================================================================
2112 void HomardDriver::TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
2114 MESSAGE("TexteAdvanced, NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
2118 _Texte += "# Niveaux extremes\n" ;
2119 { std::stringstream saux1 ;
2121 _Texte += "NiveauMa " + saux1.str() + "\n" ;
2126 _Texte += "# Diametre minimal\n" ;
2127 { std::stringstream saux1 ;
2129 _Texte += "DiametMi " + saux1.str() + "\n" ;
2132 if ( AdapInit != 0 )
2135 { _Texte += "# Raffinement" ; }
2137 { _Texte += "# Deraffinement" ; }
2138 _Texte += " des regions sans indicateur\n" ;
2139 { std::stringstream saux1 ;
2141 _Texte += "AdapInit " + saux1.str() + "\n" ;
2144 if ( ExtraOutput % 2 == 0 )
2146 _Texte += "# Sortie des niveaux de raffinement\n" ;
2147 _Texte += "NCNiveau NIVEAU\n" ;
2149 if ( ExtraOutput % 3 == 0 )
2151 _Texte += "# Sortie des qualités des mailles\n" ;
2152 _Texte += "NCQualit QUAL\n" ;
2154 if ( ExtraOutput % 5 == 0 )
2156 _Texte += "# Sortie des diamètres des mailles\n" ;
2157 _Texte += "NCDiamet DIAM\n" ;
2159 if ( ExtraOutput % 7 == 0 )
2161 _Texte += "# Sortie des parents des mailles\n" ;
2162 _Texte += "NCParent PARENT\n" ;
2164 if ( ExtraOutput % 11 == 0 )
2166 _Texte += "# Volumes voisins par recollement\n" ;
2167 _Texte += "NCVoisRc Voisin-Recollement\n" ;
2170 //===============================================================================
2172 //===============================================================================
2173 void HomardDriver::TexteInfoCompute( int MessInfo )
2175 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
2177 if ( MessInfo != 0 )
2179 _Texte += "# Messages d'informations\n" ;
2180 { std::stringstream saux1 ;
2182 _Texte += "MessInfo " + saux1.str() + "\n" ;
2186 //===============================================================================
2187 void HomardDriver::CreeFichier( )
2190 if ( _modeHOMARD == 1 )
2191 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
2192 else if ( _modeHOMARD == 2 )
2193 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
2194 else if ( _modeHOMARD == 5 )
2195 { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
2197 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
2198 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
2202 //===============================================================================
2203 // Creation du fichier de donnees pour l'information
2204 //===============================================================================
2205 void HomardDriver::CreeFichierDonn( )
2208 MESSAGE("CreeFichierDonn");
2209 _NomFichierDonn = "info.donn" ;
2215 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
2216 if (Fic.is_open() == true) { Fic << data << std::endl ; }
2220 //===============================================================================
2221 int HomardDriver::ExecuteHomard()
2223 MESSAGE("ExecuteHomard");
2224 std::string commande ;
2226 // Copie des Fichiers HOMARD
2227 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
2228 codret = system(commande.c_str()) ;
2230 // Execution de HOMARD
2233 commande = _HOMARD_Exec.c_str() ;
2234 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
2235 codret = system(commande.c_str());
2236 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
2237 _NomFichierDonn = "" ;
2242 //=============================================================================
2243 //=============================================================================
2244 HOMARD_Gen::HOMARD_Gen()
2246 MESSAGE("HOMARD_Gen");
2249 //=============================================================================
2250 //=============================================================================
2251 HOMARD_Gen::~HOMARD_Gen()
2253 MESSAGE("~HOMARD_Gen");
2255 //=============================================================================
2257 //=============================================================================
2259 * default constructor:
2261 //=============================================================================
2262 HOMARD_Hypothesis::HOMARD_Hypothesis():
2263 _Name(""), _NomCasCreation(""),
2264 _TypeAdap(-1), _TypeRaff(0), _TypeDera(0),
2266 _TypeThR(0), _TypeThC(0),
2267 _ThreshR(0), _ThreshC(0),
2268 _UsField(0), _UsCmpI(0), _TypeFieldInterp(0),
2270 _NivMax(-1), _DiamMin(-1.0), _AdapInit(0), _ExtraOutput(1)
2272 MESSAGE("HOMARD_Hypothesis");
2275 //=============================================================================
2278 //=============================================================================
2279 HOMARD_Hypothesis::~HOMARD_Hypothesis()
2281 MESSAGE("~HOMARD_Hypothesis");
2283 //=============================================================================
2284 //=============================================================================
2286 //=============================================================================
2287 //=============================================================================
2288 void HOMARD_Hypothesis::SetName( const char* Name )
2290 _Name = std::string( Name );
2292 //=============================================================================
2293 std::string HOMARD_Hypothesis::GetName() const
2297 //=============================================================================
2298 //=============================================================================
2300 //=============================================================================
2301 //=============================================================================
2302 void HOMARD_Hypothesis::SetAdapType( int TypeAdap )
2304 VERIFICATION( (TypeAdap>=-1) && (TypeAdap<=1) );
2305 _TypeAdap = TypeAdap;
2307 //=============================================================================
2308 int HOMARD_Hypothesis::GetAdapType() const
2312 //=============================================================================
2313 void HOMARD_Hypothesis::SetRefinTypeDera( int TypeRaff, int TypeDera )
2315 VERIFICATION( (TypeRaff>=-1) && (TypeRaff<=1) );
2316 _TypeRaff = TypeRaff;
2317 VERIFICATION( (TypeDera>=-1) && (TypeDera<=1) );
2318 _TypeDera = TypeDera;
2320 //=============================================================================
2321 int HOMARD_Hypothesis::GetRefinType() const
2325 //=============================================================================
2326 int HOMARD_Hypothesis::GetUnRefType() const
2330 //=============================================================================
2331 void HOMARD_Hypothesis::SetField( const char* FieldName )
2333 _Field = std::string( FieldName );
2334 MESSAGE( "SetField : FieldName = " << FieldName );
2336 //=============================================================================
2337 std::string HOMARD_Hypothesis::GetFieldName() const
2341 //=============================================================================
2342 void HOMARD_Hypothesis::SetUseField( int UsField )
2344 VERIFICATION( (UsField>=0) && (UsField<=1) );
2347 //=============================================================================
2348 int HOMARD_Hypothesis::GetUseField() const
2352 //=============================================================================
2353 void HOMARD_Hypothesis::SetUseComp( int UsCmpI )
2355 MESSAGE ("SetUseComp pour UsCmpI = "<<UsCmpI) ;
2356 VERIFICATION( (UsCmpI>=0) && (UsCmpI<=2) );
2359 //=============================================================================
2360 int HOMARD_Hypothesis::GetUseComp() const
2364 //=============================================================================
2365 void HOMARD_Hypothesis::AddComp( const char* NomComp )
2367 // On commence par supprimer la composante au cas ou elle aurait deja ete inseree
2368 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2369 // definition de l'hypothese
2370 SupprComp( NomComp ) ;
2371 // Insertion veritable
2372 _ListComp.push_back( std::string( NomComp ) );
2374 //=============================================================================
2375 void HOMARD_Hypothesis::SupprComp( const char* NomComp )
2377 MESSAGE ("SupprComp pour "<<NomComp) ;
2378 std::list<std::string>::iterator it = find( _ListComp.begin(), _ListComp.end(), NomComp );
2379 if ( it != _ListComp.end() ) { it = _ListComp.erase( it ); }
2381 //=============================================================================
2382 void HOMARD_Hypothesis::SupprComps()
2386 //=============================================================================
2387 const std::list<std::string>& HOMARD_Hypothesis::GetComps() const
2391 //=============================================================================
2392 void HOMARD_Hypothesis::SetRefinThr( int TypeThR, double ThreshR )
2394 MESSAGE( "SetRefinThr : TypeThR = " << TypeThR << ", ThreshR = " << ThreshR );
2395 VERIFICATION( (TypeThR>=0) && (TypeThR<=4) );
2399 //=============================================================================
2400 int HOMARD_Hypothesis::GetRefinThrType() const
2404 //=============================================================================
2405 double HOMARD_Hypothesis::GetThreshR() const
2409 //=============================================================================
2410 void HOMARD_Hypothesis::SetUnRefThr( int TypeThC, double ThreshC )
2412 VERIFICATION( (TypeThC>=0) && (TypeThC<=4) );
2416 //=============================================================================
2417 int HOMARD_Hypothesis::GetUnRefThrType() const
2421 //=============================================================================
2422 double HOMARD_Hypothesis::GetThreshC() const
2426 //=============================================================================
2427 void HOMARD_Hypothesis::SetNivMax( int NivMax )
2428 //=============================================================================
2432 //=============================================================================
2433 const int HOMARD_Hypothesis::GetNivMax() const
2434 //=============================================================================
2438 //=============================================================================
2439 void HOMARD_Hypothesis::SetDiamMin( double DiamMin )
2440 //=============================================================================
2444 //=============================================================================
2445 const double HOMARD_Hypothesis::GetDiamMin() const
2446 //=============================================================================
2450 //=============================================================================
2451 void HOMARD_Hypothesis::SetAdapInit( int AdapInit )
2452 //=============================================================================
2454 _AdapInit = AdapInit;
2456 //=============================================================================
2457 const int HOMARD_Hypothesis::GetAdapInit() const
2458 //=============================================================================
2462 //=============================================================================
2463 void HOMARD_Hypothesis::SetExtraOutput( int ExtraOutput )
2464 //=============================================================================
2466 _ExtraOutput = ExtraOutput;
2468 //=============================================================================
2469 const int HOMARD_Hypothesis::GetExtraOutput() const
2470 //=============================================================================
2472 return _ExtraOutput;
2474 //=============================================================================
2475 void HOMARD_Hypothesis::AddGroup( const char* Group)
2477 // On commence par supprimer le groupe au cas ou il aurait deja ete insere
2478 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2479 // definition de l'hypothese
2480 SupprGroup( Group ) ;
2481 // Insertion veritable
2482 _ListGroupSelected.push_back(Group);
2484 //=============================================================================
2485 void HOMARD_Hypothesis::SupprGroup( const char* Group )
2487 MESSAGE ("SupprGroup pour "<<Group) ;
2488 std::list<std::string>::iterator it = find( _ListGroupSelected.begin(), _ListGroupSelected.end(), Group );
2489 if ( it != _ListGroupSelected.end() ) { it = _ListGroupSelected.erase( it ); }
2491 //=============================================================================
2492 void HOMARD_Hypothesis::SupprGroups()
2494 _ListGroupSelected.clear();
2496 //=============================================================================
2497 void HOMARD_Hypothesis::SetGroups( const std::list<std::string>& ListGroup )
2499 _ListGroupSelected.clear();
2500 std::list<std::string>::const_iterator it = ListGroup.begin();
2501 while(it != ListGroup.end())
2502 _ListGroupSelected.push_back((*it++));
2504 //=============================================================================
2505 const std::list<std::string>& HOMARD_Hypothesis::GetGroups() const
2507 return _ListGroupSelected;
2509 //=============================================================================
2510 // Type d'interpolation des champs :
2511 // 0 : aucun champ n'est interpole
2512 // 1 : tous les champs sont interpoles
2513 // 2 : certains champs sont interpoles
2514 void HOMARD_Hypothesis::SetTypeFieldInterp( int TypeFieldInterp )
2516 VERIFICATION( (TypeFieldInterp>=0) && (TypeFieldInterp<=2) );
2517 _TypeFieldInterp = TypeFieldInterp;
2519 //=============================================================================
2520 int HOMARD_Hypothesis::GetTypeFieldInterp() const
2522 return _TypeFieldInterp;
2524 //=============================================================================
2525 void HOMARD_Hypothesis::AddFieldInterpType( const char* FieldInterp, int TypeInterp )
2527 MESSAGE ("Dans AddFieldInterpType pour " << FieldInterp << " et TypeInterp = " << TypeInterp) ;
2528 // On commence par supprimer le champ au cas ou il aurait deja ete insere
2529 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2530 // definition de l'hypothese
2531 SupprFieldInterp( FieldInterp ) ;
2532 // Insertion veritable
2534 _ListFieldInterp.push_back( std::string( FieldInterp ) );
2536 std::stringstream saux1 ;
2537 saux1 << TypeInterp ;
2538 _ListFieldInterp.push_back( saux1.str() );
2539 // . Indication generale : certains champs sont a interpoler
2540 SetTypeFieldInterp ( 2 ) ;
2542 //=============================================================================
2543 void HOMARD_Hypothesis::SupprFieldInterp( const char* FieldInterp )
2545 MESSAGE ("Dans SupprFieldInterp pour " << FieldInterp) ;
2546 std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp ) ;
2547 // Attention a supprimer le nom du champ et le type d'usage
2548 if ( it != _ListFieldInterp.end() )
2550 it = _ListFieldInterp.erase( it ) ;
2551 it = _ListFieldInterp.erase( it ) ;
2553 // Decompte du nombre de champs restant a interpoler
2554 it = _ListFieldInterp.begin() ;
2556 while(it != _ListFieldInterp.end())
2561 MESSAGE("Nombre de champ restants = "<<cpt/2);
2562 // . Indication generale : aucun champ ne reste a interpoler
2565 SetTypeFieldInterp ( 0 ) ;
2568 //=============================================================================
2569 void HOMARD_Hypothesis::SupprFieldInterps()
2571 MESSAGE ("SupprFieldInterps") ;
2572 _ListFieldInterp.clear();
2573 // . Indication generale : aucun champ ne reste a interpoler
2574 SetTypeFieldInterp ( 0 ) ;
2576 //=============================================================================
2577 const std::list<std::string>& HOMARD_Hypothesis::GetFieldInterps() const
2579 return _ListFieldInterp;
2581 //=============================================================================
2582 //=============================================================================
2583 // Liens avec les autres structures
2584 //=============================================================================
2585 //=============================================================================
2586 void HOMARD_Hypothesis::SetCaseCreation( const char* NomCasCreation )
2588 _NomCasCreation = std::string( NomCasCreation );
2590 //=============================================================================
2591 std::string HOMARD_Hypothesis::GetCaseCreation() const
2593 return _NomCasCreation;
2595 //=============================================================================
2596 void HOMARD_Hypothesis::LinkIteration( const char* NomIteration )
2598 _ListIter.push_back( std::string( NomIteration ) );
2600 //=============================================================================
2601 void HOMARD_Hypothesis::UnLinkIteration( const char* NomIteration )
2603 std::list<std::string>::iterator it = find( _ListIter.begin(), _ListIter.end(), NomIteration ) ;
2604 if ( it != _ListIter.end() )
2606 MESSAGE ("Dans UnLinkIteration pour " << NomIteration) ;
2607 it = _ListIter.erase( it ) ;
2610 //=============================================================================
2611 void HOMARD_Hypothesis::UnLinkIterations()
2615 //=============================================================================
2616 const std::list<std::string>& HOMARD_Hypothesis::GetIterations() const
2620 //=============================================================================
2621 void HOMARD_Hypothesis::AddZone( const char* NomZone, int TypeUse )
2623 MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse) ;
2624 // On commence par supprimer la zone au cas ou elle aurait deja ete inseree
2625 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2626 // definition de l'hypothese
2627 SupprZone( NomZone ) ;
2628 // Insertion veritable
2630 _ListZone.push_back( std::string( NomZone ) );
2631 // . Usage de la zone
2632 std::stringstream saux1 ;
2634 _ListZone.push_back( saux1.str() );
2636 //=============================================================================
2637 void HOMARD_Hypothesis::SupprZone( const char* NomZone )
2639 MESSAGE ("Dans SupprZone pour " << NomZone) ;
2640 std::list<std::string>::iterator it = find( _ListZone.begin(), _ListZone.end(), NomZone );
2641 // Attention a supprimer le nom de zone et le type d'usage
2642 if ( it != _ListZone.end() )
2644 it = _ListZone.erase( it );
2645 it = _ListZone.erase( it );
2648 //=============================================================================
2649 void HOMARD_Hypothesis::SupprZones()
2653 //=============================================================================
2654 const std::list<std::string>& HOMARD_Hypothesis::GetZones() const
2659 //=============================================================================
2661 * default constructor:
2663 //=============================================================================
2664 HOMARD_Iteration::HOMARD_Iteration():
2665 _Name( "" ), _Etat( 0 ),
2667 _NomMesh( "" ), _MeshFile( "" ),
2668 _FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ),
2671 _NomHypo( "" ), _NomCas( "" ), _NomDir( "" ),
2675 MESSAGE("HOMARD_Iteration");
2677 //=============================================================================
2681 //=============================================================================
2682 HOMARD_Iteration::~HOMARD_Iteration()
2684 MESSAGE("~HOMARD_Iteration");
2686 //=============================================================================
2687 //=============================================================================
2689 //=============================================================================
2690 //=============================================================================
2691 void HOMARD_Iteration::SetName( const char* Name )
2693 _Name = std::string( Name );
2695 //=============================================================================
2696 std::string HOMARD_Iteration::GetName() const
2700 //=============================================================================
2701 //=============================================================================
2703 //=============================================================================
2704 //=============================================================================
2705 void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
2707 _NomDir = std::string( NomDir );
2709 //=============================================================================
2710 std::string HOMARD_Iteration::GetDirNameLoc() const
2714 //=============================================================================
2715 void HOMARD_Iteration::SetNumber( int NumIter )
2719 //=============================================================================
2720 int HOMARD_Iteration::GetNumber() const
2724 //=============================================================================
2725 void HOMARD_Iteration::SetState( int etat )
2729 //=============================================================================
2730 int HOMARD_Iteration::GetState() const
2734 //=============================================================================
2735 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
2737 _NomMesh = std::string( NomMesh );
2739 //=============================================================================
2740 std::string HOMARD_Iteration::GetMeshName() const
2744 //=============================================================================
2745 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
2747 _MeshFile = std::string( MeshFile );
2749 //=============================================================================
2750 std::string HOMARD_Iteration::GetMeshFile() const
2754 //=============================================================================
2755 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
2757 _FieldFile = std::string( FieldFile );
2759 //=============================================================================
2760 std::string HOMARD_Iteration::GetFieldFile() const
2764 //=============================================================================
2765 // Instants pour le champ de pilotage
2766 //=============================================================================
2767 void HOMARD_Iteration::SetTimeStep( int TimeStep )
2769 _TimeStep = TimeStep;
2771 //=============================================================================
2772 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
2774 _TimeStep = TimeStep;
2777 //=============================================================================
2778 void HOMARD_Iteration::SetTimeStepRankLast()
2782 //=============================================================================
2783 int HOMARD_Iteration::GetTimeStep() const
2787 //=============================================================================
2788 int HOMARD_Iteration::GetRank() const
2792 //=============================================================================
2793 // Instants pour un champ a interpoler
2794 //=============================================================================
2795 void HOMARD_Iteration::SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep )
2797 SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep ) ;
2799 //=============================================================================
2800 void HOMARD_Iteration::SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank )
2802 MESSAGE("Champ " << FieldInterp << ", hypothese " << _NomHypo )
2803 // Verification de la presence du champ dans l'hypothese
2804 std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp );
2805 if ( it == _ListFieldInterp.end() )
2807 INFOS("Champ " << FieldInterp << " ; hypothese " << _NomHypo )
2808 VERIFICATION("Le champ est inconnu dans l'hypothese associee a cette iteration." == 0);
2812 _ListFieldInterpTSR.push_back( std::string( FieldInterp ) );
2814 std::stringstream saux1 ;
2816 _ListFieldInterpTSR.push_back( saux1.str() );
2818 std::stringstream saux2 ;
2820 _ListFieldInterpTSR.push_back( saux2.str() );
2822 //=============================================================================
2823 const std::list<std::string>& HOMARD_Iteration::GetFieldInterpsTimeStepRank() const
2825 return _ListFieldInterpTSR;
2827 //=============================================================================
2828 void HOMARD_Iteration::SetFieldInterp( const char* FieldInterp )
2830 _ListFieldInterp.push_back( std::string( FieldInterp ) );
2832 //=============================================================================
2833 const std::list<std::string>& HOMARD_Iteration::GetFieldInterps() const
2835 return _ListFieldInterp;
2837 //=============================================================================
2838 void HOMARD_Iteration::SupprFieldInterps()
2840 _ListFieldInterp.clear();
2842 //=============================================================================
2843 void HOMARD_Iteration::SetLogFile( const char* LogFile )
2845 _LogFile = std::string( LogFile );
2847 //=============================================================================
2848 std::string HOMARD_Iteration::GetLogFile() const
2852 //=============================================================================
2853 void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
2855 _FileInfo = std::string( FileInfo );
2857 //=============================================================================
2858 std::string HOMARD_Iteration::GetFileInfo() const
2862 //=============================================================================
2863 //=============================================================================
2864 // Liens avec les autres iterations
2865 //=============================================================================
2866 //=============================================================================
2867 void HOMARD_Iteration::LinkNextIteration( const char* NomIteration )
2869 _mesIterFilles.push_back( std::string( NomIteration ) );
2871 //=============================================================================
2872 void HOMARD_Iteration::UnLinkNextIteration( const char* NomIteration )
2874 std::list<std::string>::iterator it = find( _mesIterFilles.begin(), _mesIterFilles.end(), NomIteration ) ;
2875 if ( it != _mesIterFilles.end() )
2877 MESSAGE ("Dans UnLinkNextIteration pour " << NomIteration) ;
2878 it = _mesIterFilles.erase( it ) ;
2881 //=============================================================================
2882 void HOMARD_Iteration::UnLinkNextIterations()
2884 _mesIterFilles.clear();
2886 //=============================================================================
2887 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
2889 return _mesIterFilles;
2891 //=============================================================================
2892 void HOMARD_Iteration::SetIterParentName( const char* IterParent )
2894 _IterParent = IterParent;
2896 //=============================================================================
2897 std::string HOMARD_Iteration::GetIterParentName() const
2901 //=============================================================================
2902 //=============================================================================
2903 // Liens avec les autres structures
2904 //=============================================================================
2905 //=============================================================================
2906 void HOMARD_Iteration::SetCaseName( const char* NomCas )
2908 _NomCas = std::string( NomCas );
2910 //=============================================================================
2911 std::string HOMARD_Iteration::GetCaseName() const
2915 //=============================================================================
2916 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
2918 _NomHypo = std::string( NomHypo );
2920 //=============================================================================
2921 std::string HOMARD_Iteration::GetHypoName() const
2925 //=============================================================================
2926 //=============================================================================
2928 //=============================================================================
2929 //=============================================================================
2930 void HOMARD_Iteration::SetInfoCompute( int MessInfo )
2932 _MessInfo = MessInfo;
2934 //=============================================================================
2935 int HOMARD_Iteration::GetInfoCompute() const
2940 } // namespace SMESHHOMARDImpl /end/