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
1187 if ( getenv("HOMARD_REP_EXE_PRIVATE") != NULL ) { dir = getenv("HOMARD_REP_EXE_PRIVATE") ; }
1188 else { dir = getenv("HOMARD_REP_EXE") ; }
1189 MESSAGE("dir ="<<dir);
1190 // L'executable HOMARD
1191 std::string executable ;
1192 if ( getenv("HOMARD_EXE_PRIVATE") != NULL ) { executable = getenv("HOMARD_EXE_PRIVATE") ; }
1193 else { executable = getenv("HOMARD_EXE") ; }
1194 MESSAGE("executable ="<<executable);
1195 // Memorisation du nom complet de l'executable HOMARD
1196 _HOMARD_Exec = dir + "/" + executable ;
1197 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
1200 _siterp1 = siterp1 ;
1202 //=============================================================================
1203 //=============================================================================
1204 HomardDriver::~HomardDriver()
1207 //===============================================================================
1209 //===============================================================================
1210 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
1212 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
1214 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
1215 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
1216 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
1217 _Texte += "Langue \"" + Langue + "\"\n" ;
1220 //===============================================================================
1221 void HomardDriver::TexteAdap()
1223 MESSAGE("TexteAdap");
1225 _Texte += "Action homa\n";
1226 _Texte += "CCAssoci med\n";
1227 _Texte += "ModeHOMA 1\n";
1228 _Texte += "NumeIter " + _siter + "\n";
1231 //===============================================================================
1232 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
1234 MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
1236 _Texte += "ModeHOMA 2\n" ;
1237 std::stringstream saux1 ;
1239 std::string saux2 = saux1.str() ;
1240 _Texte += "TypeBila " + saux2 + "\n" ;
1241 if ( NumeIter == 0 )
1243 _Texte += "NumeIter 0\n" ;
1244 _Texte += "Action info_av\n" ;
1245 _Texte += "CCAssoci med\n" ;
1249 _Texte += "NumeIter " + _siter + "\n" ;
1250 _Texte += "Action info_ap\n" ;
1251 _Texte += "CCAssoci homard\n" ;
1256 //===============================================================================
1257 void HomardDriver::TexteMajCoords( int NumeIter )
1259 MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
1261 _Texte += "ModeHOMA 5\n" ;
1262 _Texte += "NumeIter " + _siterp1 + "\n" ;
1263 _Texte += "Action homa\n" ;
1264 _Texte += "CCAssoci med\n" ;
1265 _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
1269 //===============================================================================
1270 // B. Les maillages en entree et en sortie
1271 //===============================================================================
1272 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
1274 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
1275 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
1276 MESSAGE("TexteMaillage, apres = "<<apres);
1279 if ( apres < 1 ) { saux = "__" ; }
1281 _Texte += "# Maillages Med " + saux + "\n" ;
1282 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
1283 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
1286 //===============================================================================
1287 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
1289 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
1291 if ( apres < 1 ) { saux = "__" ; }
1292 else { saux = "P1" ; }
1294 _Texte += "# Maillage HOMARD " + liter + "\n" ;
1295 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
1298 //===============================================================================
1299 // C. Le pilotage de l'adaptation
1300 //===============================================================================
1301 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
1303 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
1304 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
1306 // Type de conformite
1313 saux = "NON_CONFORME_1_ARETE" ;
1318 saux = "CONFORME_BOITES" ;
1328 saux = "NON_CONFORME" ;
1333 saux = "NON_CONFORME_1_NOEUD" ;
1338 saux = "NON_CONFORME_INDICATEUR" ;
1342 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
1344 // Type de raffinement/deraffinement
1346 if ( TypeAdap == -1 )
1348 if ( TypeRaff == 1 )
1350 saux = "TypeRaff uniforme\n" ;
1354 saux = "TypeRaff non\n" ;
1356 if ( TypeDera == 1 )
1358 saux += "TypeDera uniforme" ;
1362 saux += "TypeDera non" ;
1367 if ( TypeRaff == 1 )
1369 saux = "TypeRaff libre\n" ;
1373 saux = "TypeRaff non\n" ;
1375 if ( TypeDera == 1 )
1377 saux += "TypeDera libre" ;
1381 saux += "TypeDera non" ;
1384 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
1386 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
1388 //===============================================================================
1389 void HomardDriver::TexteCompo( int NumeComp, const std::string NomCompo)
1391 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NomCompo = "<<NomCompo);
1392 _Texte +="CCCoChaI \"" + NomCompo + "\"\n" ;
1394 //===============================================================================
1395 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 )
1397 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
1398 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
1400 std::string saux, saux2 ;
1403 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
1404 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
1405 // Attention a mettre le bon signe a ZoneTypeHOMARD :
1406 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
1407 // <0 signifie que l'on deraffinera
1409 int ZoneTypeHOMARD ;
1410 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
1411 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
1412 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
1413 else { ZoneTypeHOMARD = ZoneType ; }
1415 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
1417 std::stringstream saux1 ;
1419 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
1421 { std::stringstream saux1 ;
1422 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
1423 saux += "ZoRaType " + saux1.str() + "\n" ;
1428 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
1429 // Y Homard <=> Y Salome
1431 saux += "#Rectangle\n" ;
1432 { std::stringstream saux1 ;
1433 saux1 << NumeZone << " " << x0 ;
1434 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1436 { std::stringstream saux1 ;
1437 saux1 << NumeZone << " " << x1 ;
1438 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1440 { std::stringstream saux1 ;
1441 saux1 << NumeZone << " " << x2 ;
1442 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1444 { std::stringstream saux1 ;
1445 saux1 << NumeZone << " " << x3 ;
1446 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1450 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
1451 // Y Homard <=> Z Salome
1453 saux += "#Rectangle\n" ;
1454 { std::stringstream saux1 ;
1455 saux1 << NumeZone << " " << x2 ;
1456 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1458 { std::stringstream saux1 ;
1459 saux1 << NumeZone << " " << x3 ;
1460 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1462 { std::stringstream saux1 ;
1463 saux1 << NumeZone << " " << x4 ;
1464 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1466 { std::stringstream saux1 ;
1467 saux1 << NumeZone << " " << x5 ;
1468 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1472 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
1473 // Y Homard <=> Z Salome
1475 saux += "#Rectangle\n" ;
1476 { std::stringstream saux1 ;
1477 saux1 << NumeZone << " " << x0 ;
1478 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1480 { std::stringstream saux1 ;
1481 saux1 << NumeZone << " " << x1 ;
1482 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1484 { std::stringstream saux1 ;
1485 saux1 << NumeZone << " " << x4 ;
1486 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1488 { std::stringstream saux1 ;
1489 saux1 << NumeZone << " " << x5 ;
1490 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1494 // Cas du parallelepipede
1496 else if ( ZoneType == 2 )
1498 saux += "# Boite\n" ;
1499 { std::stringstream saux1 ;
1500 saux1 << NumeZone << " " << x0 ;
1501 saux += "ZoRaXmin " + saux1.str() + "\n" ;
1503 { std::stringstream saux1 ;
1504 saux1 << NumeZone << " " << x1 ;
1505 saux += "ZoRaXmax " + saux1.str() + "\n" ;
1507 { std::stringstream saux1 ;
1508 saux1 << NumeZone << " " << x2 ;
1509 saux += "ZoRaYmin " + saux1.str() + "\n" ;
1511 { std::stringstream saux1 ;
1512 saux1 << NumeZone << " " << x3 ;
1513 saux += "ZoRaYmax " + saux1.str() + "\n" ;
1515 { std::stringstream saux1 ;
1516 saux1 << NumeZone << " " << x4 ;
1517 saux += "ZoRaZmin " + saux1.str() + "\n" ;
1519 { std::stringstream saux1 ;
1520 saux1 << NumeZone << " " << x5 ;
1521 saux += "ZoRaZmax " + saux1.str() + "\n" ;
1527 else if ( ZoneType == 31 || ZoneType == 61 )
1529 saux += "# Sphere\n" ;
1530 { std::stringstream saux1 ;
1531 saux1 << NumeZone << " " << x0 ;
1532 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1534 { std::stringstream saux1 ;
1535 saux1 << NumeZone << " " << x1 ;
1536 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1538 { std::stringstream saux1 ;
1539 saux1 << NumeZone << " " << x6 ;
1540 saux2 = saux1.str() ;
1541 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1542 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1544 if ( ZoneType == 61 )
1545 { std::stringstream saux1 ;
1546 saux1 << NumeZone << " " << x8 ;
1547 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1550 else if ( ZoneType == 32 || ZoneType == 62 )
1552 saux += "# Sphere\n" ;
1553 { std::stringstream saux1 ;
1554 saux1 << NumeZone << " " << x1 ;
1555 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1557 { std::stringstream saux1 ;
1558 saux1 << NumeZone << " " << x2 ;
1559 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1561 { std::stringstream saux1 ;
1562 saux1 << NumeZone << " " << x6 ;
1563 saux2 = saux1.str() ;
1564 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1565 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1567 if ( ZoneType == 62 )
1568 { std::stringstream saux1 ;
1569 saux1 << NumeZone << " " << x8 ;
1570 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1573 else if ( ZoneType == 33 || ZoneType == 63 )
1575 saux += "# Sphere\n" ;
1576 { std::stringstream saux1 ;
1577 saux1 << NumeZone << " " << x0 ;
1578 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1580 { std::stringstream saux1 ;
1581 saux1 << NumeZone << " " << x2 ;
1582 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1584 { std::stringstream saux1 ;
1585 saux1 << NumeZone << " " << x6 ;
1586 saux2 = saux1.str() ;
1587 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
1588 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
1590 if ( ZoneType == 63 )
1591 { std::stringstream saux1 ;
1592 saux1 << NumeZone << " " << x8 ;
1593 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1599 else if ( ZoneType == 4 )
1601 saux += "# Sphere\n" ;
1602 { std::stringstream saux1 ;
1603 saux1 << NumeZone << " " << x0 ;
1604 saux += "ZoRaXCen " + saux1.str() + "\n" ;
1606 { std::stringstream saux1 ;
1607 saux1 << NumeZone << " " << x1 ;
1608 saux += "ZoRaYCen " + saux1.str() + "\n" ;
1610 { std::stringstream saux1 ;
1611 saux1 << NumeZone << " " << x2 ;
1612 saux += "ZoRaZCen " + saux1.str() + "\n" ;
1614 { std::stringstream saux1 ;
1615 saux1 << NumeZone << " " << x3 ;
1616 saux += "ZoRaRayo " + saux1.str() + "\n" ;
1620 // Cas du cylindre ou du tuyau
1622 else if ( ZoneType == 5 || ZoneType == 7 )
1624 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
1625 else { saux += "# Tuyau\n" ; }
1626 { std::stringstream saux1 ;
1627 saux1 << NumeZone << " " << x0 ;
1628 saux += "ZoRaXBas " + saux1.str() + "\n" ;
1630 { std::stringstream saux1 ;
1631 saux1 << NumeZone << " " << x1 ;
1632 saux += "ZoRaYBas " + saux1.str() + "\n" ;
1634 { std::stringstream saux1 ;
1635 saux1 << NumeZone << " " << x2 ;
1636 saux += "ZoRaZBas " + saux1.str() + "\n" ;
1638 { std::stringstream saux1 ;
1639 saux1 << NumeZone << " " << x3 ;
1640 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
1642 { std::stringstream saux1 ;
1643 saux1 << NumeZone << " " << x4 ;
1644 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
1646 { std::stringstream saux1 ;
1647 saux1 << NumeZone << " " << x5 ;
1648 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
1650 { std::stringstream saux1 ;
1651 saux1 << NumeZone << " " << x6 ;
1652 saux2 = saux1.str() ;
1653 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
1654 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
1656 { std::stringstream saux1 ;
1657 saux1 << NumeZone << " " << x7 ;
1658 saux += "ZoRaHaut " + saux1.str() + "\n" ;
1660 if ( ZoneType == 7 )
1661 { std::stringstream saux1 ;
1662 saux1 << NumeZone << " " << x8 ;
1663 saux += "ZoRaRayI " + saux1.str() + "\n" ;
1667 _Texte += saux + "#\n" ;
1669 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
1671 //===============================================================================
1672 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
1673 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
1674 int UsField, int UsCmpI )
1676 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
1677 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
1679 std::string saux, saux2 ;
1682 _Texte += "# Champ d'indicateurs\n" ;
1683 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
1684 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
1686 // Cas ou on prend le dernier pas de temps
1687 if ( TimeStep == -2 )
1688 { _Texte += "CCNumPTI Last\n" ; }
1689 // Cas avec pas de temps
1690 else if ( TimeStep >= 0 )
1693 std::stringstream saux1 ;
1695 saux2 = saux1.str() ;
1696 _Texte += "CCNumPTI " + saux2 + "\n" ;
1700 std::stringstream saux1 ;
1702 saux2 = saux1.str() ;
1703 _Texte += "CCNumOrI " + saux2 + "\n" ;
1718 std::stringstream saux1 ;
1720 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
1734 std::stringstream saux1 ;
1736 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
1741 { saux = "MAILLE" ; }
1746 _Texte += "CCModeFI " + saux + "\n" ;
1753 { saux = "INFINI" ; }
1755 { saux = "RELATIF" ; }
1758 _Texte += "CCUsCmpI " + saux + "\n" ;
1761 //===============================================================================
1762 void HomardDriver::TexteGroup( const std::string GroupName )
1764 MESSAGE("TexteGroup, GroupName = "<<GroupName);
1766 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
1769 //===============================================================================
1770 // D. Les frontieres
1771 //===============================================================================
1772 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
1774 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
1776 // Type de suivi de frontiere
1778 std::stringstream saux1 ;
1779 saux1 << BoundaryOption ;
1780 std::string saux = saux1.str() ;
1781 _Texte += "SuivFron " + saux + "\n" ;
1783 }//===============================================================================
1784 void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
1786 MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
1788 _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
1792 //===============================================================================
1793 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
1795 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
1796 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
1798 _Texte += "#\n# Frontiere discrete\n" ;
1799 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
1800 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
1803 //===============================================================================
1804 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
1806 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
1808 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
1811 //===============================================================================
1812 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 )
1814 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
1815 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
1816 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
1817 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
1819 std::string saux, saux2 ;
1823 std::stringstream saux1 ;
1824 saux1 << NumeBoundary ;
1825 saux2 = saux1.str() ;
1826 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
1827 if ( BoundaryType == 1 )
1828 { saux += "# Cylindre\n" ; }
1829 if ( BoundaryType == 2 )
1830 { saux += "# Sphere\n" ; }
1831 if ( BoundaryType == 3 || BoundaryType == 4 )
1832 { saux += "# Cone\n" ; }
1833 if ( BoundaryType == 5 )
1834 { saux += "# Tore\n" ; }
1836 // Le nom de la frontiere
1838 { std::stringstream saux1 ;
1839 saux1 << NumeBoundary ;
1840 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
1843 // Type de frontiere
1845 { std::stringstream saux1 ;
1846 saux1 << NumeBoundary << " " << BoundaryType ;
1847 saux += "FAType " + saux1.str() + "\n" ;
1852 if ( BoundaryType == 1 )
1854 { std::stringstream saux1 ;
1855 saux1 << NumeBoundary << " " << x0 ;
1856 saux2 = saux1.str() ;
1857 saux += "FAXCen " + saux1.str() + "\n" ;
1859 { std::stringstream saux1 ;
1860 saux1 << NumeBoundary << " " << x1 ;
1861 saux += "FAYCen " + saux1.str() + "\n" ;
1863 { std::stringstream saux1 ;
1864 saux1 << NumeBoundary << " " << x2 ;
1865 saux += "FAZCen " + saux1.str() + "\n" ;
1867 { std::stringstream saux1 ;
1868 saux1 << NumeBoundary << " " << x3 ;
1869 saux += "FAXAxe " + saux1.str() + "\n" ;
1871 { std::stringstream saux1 ;
1872 saux1 << NumeBoundary << " " << x4 ;
1873 saux += "FAYAxe " + saux1.str() + "\n" ;
1875 { std::stringstream saux1 ;
1876 saux1 << NumeBoundary << " " << x5 ;
1877 saux += "FAZAxe " + saux1.str() + "\n" ;
1879 { std::stringstream saux1 ;
1880 saux1 << NumeBoundary << " " << x6 ;
1881 saux += "FARayon " + saux1.str() + "\n" ;
1887 else if ( BoundaryType == 2 )
1889 { std::stringstream saux1 ;
1890 saux1 << NumeBoundary << " " << x0 ;
1891 saux += "FAXCen " + saux1.str() + "\n" ;
1893 { std::stringstream saux1 ;
1894 saux1 << NumeBoundary << " " << x1 ;
1895 saux += "FAYCen " + saux1.str() + "\n" ;
1897 { std::stringstream saux1 ;
1898 saux1 << NumeBoundary << " " << x2 ;
1899 saux += "FAZCen " + saux1.str() + "\n" ;
1901 { std::stringstream saux1 ;
1902 saux1 << NumeBoundary << " " << x3 ;
1903 saux += "FARayon " + saux1.str() + "\n" ;
1907 // Cas du cone defini par un axe et un angle
1909 if ( BoundaryType == 3 )
1911 { std::stringstream saux1 ;
1912 saux1 << NumeBoundary << " " << x0 ;
1913 saux += "FAXAxe " + saux1.str() + "\n" ;
1915 { std::stringstream saux1 ;
1916 saux1 << NumeBoundary << " " << x1 ;
1917 saux += "FAYAxe " + saux1.str() + "\n" ;
1919 { std::stringstream saux1 ;
1920 saux1 << NumeBoundary << " " << x2 ;
1921 saux += "FAZAxe " + saux1.str() + "\n" ;
1923 { std::stringstream saux1 ;
1924 saux1 << NumeBoundary << " " << x3 ;
1925 saux += "FAAngle " + saux1.str() + "\n" ;
1927 { std::stringstream saux1 ;
1928 saux1 << NumeBoundary << " " << x4 ;
1929 saux += "FAXCen " + saux1.str() + "\n" ;
1931 { std::stringstream saux1 ;
1932 saux1 << NumeBoundary << " " << x5 ;
1933 saux += "FAYCen " + saux1.str() + "\n" ;
1935 { std::stringstream saux1 ;
1936 saux1 << NumeBoundary << " " << x6 ;
1937 saux += "FAZCen " + saux1.str() + "\n" ;
1941 // Cas du cone defini par les 2 rayons
1943 if ( BoundaryType == 4 )
1945 { std::stringstream saux1 ;
1946 saux1 << NumeBoundary << " " << x0 ;
1947 saux += "FAXCen " + saux1.str() + "\n" ;
1949 { std::stringstream saux1 ;
1950 saux1 << NumeBoundary << " " << x1 ;
1951 saux += "FAYCen " + saux1.str() + "\n" ;
1953 { std::stringstream saux1 ;
1954 saux1 << NumeBoundary << " " << x2 ;
1955 saux += "FAZCen " + saux1.str() + "\n" ;
1957 { std::stringstream saux1 ;
1958 saux1 << NumeBoundary << " " << x3 ;
1959 saux += "FARayon " + saux1.str() + "\n" ;
1961 { std::stringstream saux1 ;
1962 saux1 << NumeBoundary << " " << x4 ;
1963 saux += "FAXCen2 " + saux1.str() + "\n" ;
1965 { std::stringstream saux1 ;
1966 saux1 << NumeBoundary << " " << x5 ;
1967 saux += "FAYCen2 " + saux1.str() + "\n" ;
1969 { std::stringstream saux1 ;
1970 saux1 << NumeBoundary << " " << x6 ;
1971 saux += "FAZCen2 " + saux1.str() + "\n" ;
1973 { std::stringstream saux1 ;
1974 saux1 << NumeBoundary << " " << x7 ;
1975 saux += "FARayon2 " + saux1.str() + "\n" ;
1981 if ( BoundaryType == 5 )
1983 { std::stringstream saux1 ;
1984 saux1 << NumeBoundary << " " << x0 ;
1985 saux2 = saux1.str() ;
1986 saux += "FAXCen " + saux1.str() + "\n" ;
1988 { std::stringstream saux1 ;
1989 saux1 << NumeBoundary << " " << x1 ;
1990 saux += "FAYCen " + saux1.str() + "\n" ;
1992 { std::stringstream saux1 ;
1993 saux1 << NumeBoundary << " " << x2 ;
1994 saux += "FAZCen " + saux1.str() + "\n" ;
1996 { std::stringstream saux1 ;
1997 saux1 << NumeBoundary << " " << x3 ;
1998 saux += "FAXAxe " + saux1.str() + "\n" ;
2000 { std::stringstream saux1 ;
2001 saux1 << NumeBoundary << " " << x4 ;
2002 saux += "FAYAxe " + saux1.str() + "\n" ;
2004 { std::stringstream saux1 ;
2005 saux1 << NumeBoundary << " " << x5 ;
2006 saux += "FAZAxe " + saux1.str() + "\n" ;
2008 { std::stringstream saux1 ;
2009 saux1 << NumeBoundary << " " << x6 ;
2010 saux += "FARayon " + saux1.str() + "\n" ;
2012 { std::stringstream saux1 ;
2013 saux1 << NumeBoundary << " " << x7 ;
2014 saux += "FARayon2 " + saux1.str() + "\n" ;
2018 _Texte += saux + "#\n" ;
2021 //===============================================================================
2022 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
2024 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
2025 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
2026 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
2030 std::string saux, saux2 ;
2031 std::stringstream saux1 ;
2032 saux1 << NumeBoundary ;
2033 saux2 = saux1.str() ;
2034 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
2036 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
2037 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
2039 _Texte += saux + "#\n" ;
2042 //===============================================================================
2043 // E. Les interpolations
2044 //===============================================================================
2045 // Les fichiers d'entree et de sortie des champs a interpoler
2046 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
2048 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
2050 _Texte += "#\n# Interpolations des champs\n" ;
2052 // Fichier en entree
2053 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
2054 // Fichier en sortie
2055 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
2057 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
2059 //===============================================================================
2060 // Tous les champs sont a interpoler
2061 void HomardDriver::TexteFieldInterpAll( )
2063 MESSAGE("TexteFieldInterpAll");
2065 _Texte += "CCChaTou oui\n" ;
2067 //===============================================================================
2068 // Ecrit les caracteristiques de chaque interpolation sous la forme :
2069 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
2070 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
2071 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
2072 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
2073 // CCChaPdT 2 14 ! Pas de temps 14
2074 // CCChaNuO 2 14 ! Numero d'ordre 14
2077 // NumeChamp : numero d'ordre du champ a interpoler
2078 // FieldName : nom du champ
2079 // TypeInterp : type d'interpolation
2080 // TimeStep : pas de temps retenu (>0 si pas de precision)
2081 // Rank : numero d'ordre retenu
2083 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
2085 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
2086 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
2087 // Numero d'ordre du champ a interpoler
2088 std::stringstream saux1 ;
2089 saux1 << NumeChamp ;
2090 std::string saux = saux1.str() ;
2092 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
2093 // Type d'interpolation pour le champ
2094 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
2096 if ( TimeStep >= 0 )
2099 std::stringstream saux1 ;
2101 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
2104 std::stringstream saux1 ;
2106 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
2110 //===============================================================================
2111 // F. Les options avancees
2112 //===============================================================================
2113 void HomardDriver::TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
2115 MESSAGE("TexteAdvanced, NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
2119 _Texte += "# Niveaux extremes\n" ;
2120 { std::stringstream saux1 ;
2122 _Texte += "NiveauMa " + saux1.str() + "\n" ;
2127 _Texte += "# Diametre minimal\n" ;
2128 { std::stringstream saux1 ;
2130 _Texte += "DiametMi " + saux1.str() + "\n" ;
2133 if ( AdapInit != 0 )
2136 { _Texte += "# Raffinement" ; }
2138 { _Texte += "# Deraffinement" ; }
2139 _Texte += " des regions sans indicateur\n" ;
2140 { std::stringstream saux1 ;
2142 _Texte += "AdapInit " + saux1.str() + "\n" ;
2145 if ( ExtraOutput % 2 == 0 )
2147 _Texte += "# Sortie des niveaux de raffinement\n" ;
2148 _Texte += "NCNiveau NIVEAU\n" ;
2150 if ( ExtraOutput % 3 == 0 )
2152 _Texte += "# Sortie des qualités des mailles\n" ;
2153 _Texte += "NCQualit QUAL\n" ;
2155 if ( ExtraOutput % 5 == 0 )
2157 _Texte += "# Sortie des diamètres des mailles\n" ;
2158 _Texte += "NCDiamet DIAM\n" ;
2160 if ( ExtraOutput % 7 == 0 )
2162 _Texte += "# Sortie des parents des mailles\n" ;
2163 _Texte += "NCParent PARENT\n" ;
2165 if ( ExtraOutput % 11 == 0 )
2167 _Texte += "# Volumes voisins par recollement\n" ;
2168 _Texte += "NCVoisRc Voisin-Recollement\n" ;
2171 //===============================================================================
2173 //===============================================================================
2174 void HomardDriver::TexteInfoCompute( int MessInfo )
2176 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
2178 if ( MessInfo != 0 )
2180 _Texte += "# Messages d'informations\n" ;
2181 { std::stringstream saux1 ;
2183 _Texte += "MessInfo " + saux1.str() + "\n" ;
2187 //===============================================================================
2188 void HomardDriver::CreeFichier( )
2191 if ( _modeHOMARD == 1 )
2192 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
2193 else if ( _modeHOMARD == 2 )
2194 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
2195 else if ( _modeHOMARD == 5 )
2196 { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
2198 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
2199 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
2203 //===============================================================================
2204 // Creation du fichier de donnees pour l'information
2205 //===============================================================================
2206 void HomardDriver::CreeFichierDonn( )
2209 MESSAGE("CreeFichierDonn");
2210 _NomFichierDonn = "info.donn" ;
2216 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
2217 if (Fic.is_open() == true) { Fic << data << std::endl ; }
2221 //===============================================================================
2222 int HomardDriver::ExecuteHomard()
2224 MESSAGE("ExecuteHomard");
2225 std::string commande ;
2227 // Copie des Fichiers HOMARD
2228 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
2229 codret = system(commande.c_str()) ;
2231 // Execution de HOMARD
2234 commande = _HOMARD_Exec.c_str() ;
2235 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
2236 codret = system(commande.c_str());
2237 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
2238 _NomFichierDonn = "" ;
2243 //=============================================================================
2244 //=============================================================================
2245 HOMARD_Gen::HOMARD_Gen()
2247 MESSAGE("HOMARD_Gen");
2250 //=============================================================================
2251 //=============================================================================
2252 HOMARD_Gen::~HOMARD_Gen()
2254 MESSAGE("~HOMARD_Gen");
2256 //=============================================================================
2258 //=============================================================================
2260 * default constructor:
2262 //=============================================================================
2263 HOMARD_Hypothesis::HOMARD_Hypothesis():
2264 _Name(""), _NomCasCreation(""),
2265 _TypeAdap(-1), _TypeRaff(0), _TypeDera(0),
2267 _TypeThR(0), _TypeThC(0),
2268 _ThreshR(0), _ThreshC(0),
2269 _UsField(0), _UsCmpI(0), _TypeFieldInterp(0),
2271 _NivMax(-1), _DiamMin(-1.0), _AdapInit(0), _ExtraOutput(1)
2273 MESSAGE("HOMARD_Hypothesis");
2276 //=============================================================================
2279 //=============================================================================
2280 HOMARD_Hypothesis::~HOMARD_Hypothesis()
2282 MESSAGE("~HOMARD_Hypothesis");
2284 //=============================================================================
2285 //=============================================================================
2287 //=============================================================================
2288 //=============================================================================
2289 void HOMARD_Hypothesis::SetName( const char* Name )
2291 _Name = std::string( Name );
2293 //=============================================================================
2294 std::string HOMARD_Hypothesis::GetName() const
2298 //=============================================================================
2299 //=============================================================================
2301 //=============================================================================
2302 //=============================================================================
2303 void HOMARD_Hypothesis::SetAdapType( int TypeAdap )
2305 VERIFICATION( (TypeAdap>=-1) && (TypeAdap<=1) );
2306 _TypeAdap = TypeAdap;
2308 //=============================================================================
2309 int HOMARD_Hypothesis::GetAdapType() const
2313 //=============================================================================
2314 void HOMARD_Hypothesis::SetRefinTypeDera( int TypeRaff, int TypeDera )
2316 VERIFICATION( (TypeRaff>=-1) && (TypeRaff<=1) );
2317 _TypeRaff = TypeRaff;
2318 VERIFICATION( (TypeDera>=-1) && (TypeDera<=1) );
2319 _TypeDera = TypeDera;
2321 //=============================================================================
2322 int HOMARD_Hypothesis::GetRefinType() const
2326 //=============================================================================
2327 int HOMARD_Hypothesis::GetUnRefType() const
2331 //=============================================================================
2332 void HOMARD_Hypothesis::SetField( const char* FieldName )
2334 _Field = std::string( FieldName );
2335 MESSAGE( "SetField : FieldName = " << FieldName );
2337 //=============================================================================
2338 std::string HOMARD_Hypothesis::GetFieldName() const
2342 //=============================================================================
2343 void HOMARD_Hypothesis::SetUseField( int UsField )
2345 VERIFICATION( (UsField>=0) && (UsField<=1) );
2348 //=============================================================================
2349 int HOMARD_Hypothesis::GetUseField() const
2353 //=============================================================================
2354 void HOMARD_Hypothesis::SetUseComp( int UsCmpI )
2356 MESSAGE ("SetUseComp pour UsCmpI = "<<UsCmpI) ;
2357 VERIFICATION( (UsCmpI>=0) && (UsCmpI<=2) );
2360 //=============================================================================
2361 int HOMARD_Hypothesis::GetUseComp() const
2365 //=============================================================================
2366 void HOMARD_Hypothesis::AddComp( const char* NomComp )
2368 // On commence par supprimer la composante au cas ou elle aurait deja ete inseree
2369 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2370 // definition de l'hypothese
2371 SupprComp( NomComp ) ;
2372 // Insertion veritable
2373 _ListComp.push_back( std::string( NomComp ) );
2375 //=============================================================================
2376 void HOMARD_Hypothesis::SupprComp( const char* NomComp )
2378 MESSAGE ("SupprComp pour "<<NomComp) ;
2379 std::list<std::string>::iterator it = find( _ListComp.begin(), _ListComp.end(), NomComp );
2380 if ( it != _ListComp.end() ) { it = _ListComp.erase( it ); }
2382 //=============================================================================
2383 void HOMARD_Hypothesis::SupprComps()
2387 //=============================================================================
2388 const std::list<std::string>& HOMARD_Hypothesis::GetComps() const
2392 //=============================================================================
2393 void HOMARD_Hypothesis::SetRefinThr( int TypeThR, double ThreshR )
2395 MESSAGE( "SetRefinThr : TypeThR = " << TypeThR << ", ThreshR = " << ThreshR );
2396 VERIFICATION( (TypeThR>=0) && (TypeThR<=4) );
2400 //=============================================================================
2401 int HOMARD_Hypothesis::GetRefinThrType() const
2405 //=============================================================================
2406 double HOMARD_Hypothesis::GetThreshR() const
2410 //=============================================================================
2411 void HOMARD_Hypothesis::SetUnRefThr( int TypeThC, double ThreshC )
2413 VERIFICATION( (TypeThC>=0) && (TypeThC<=4) );
2417 //=============================================================================
2418 int HOMARD_Hypothesis::GetUnRefThrType() const
2422 //=============================================================================
2423 double HOMARD_Hypothesis::GetThreshC() const
2427 //=============================================================================
2428 void HOMARD_Hypothesis::SetNivMax( int NivMax )
2429 //=============================================================================
2433 //=============================================================================
2434 const int HOMARD_Hypothesis::GetNivMax() const
2435 //=============================================================================
2439 //=============================================================================
2440 void HOMARD_Hypothesis::SetDiamMin( double DiamMin )
2441 //=============================================================================
2445 //=============================================================================
2446 const double HOMARD_Hypothesis::GetDiamMin() const
2447 //=============================================================================
2451 //=============================================================================
2452 void HOMARD_Hypothesis::SetAdapInit( int AdapInit )
2453 //=============================================================================
2455 _AdapInit = AdapInit;
2457 //=============================================================================
2458 const int HOMARD_Hypothesis::GetAdapInit() const
2459 //=============================================================================
2463 //=============================================================================
2464 void HOMARD_Hypothesis::SetExtraOutput( int ExtraOutput )
2465 //=============================================================================
2467 _ExtraOutput = ExtraOutput;
2469 //=============================================================================
2470 const int HOMARD_Hypothesis::GetExtraOutput() const
2471 //=============================================================================
2473 return _ExtraOutput;
2475 //=============================================================================
2476 void HOMARD_Hypothesis::AddGroup( const char* Group)
2478 // On commence par supprimer le groupe au cas ou il aurait deja ete insere
2479 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2480 // definition de l'hypothese
2481 SupprGroup( Group ) ;
2482 // Insertion veritable
2483 _ListGroupSelected.push_back(Group);
2485 //=============================================================================
2486 void HOMARD_Hypothesis::SupprGroup( const char* Group )
2488 MESSAGE ("SupprGroup pour "<<Group) ;
2489 std::list<std::string>::iterator it = find( _ListGroupSelected.begin(), _ListGroupSelected.end(), Group );
2490 if ( it != _ListGroupSelected.end() ) { it = _ListGroupSelected.erase( it ); }
2492 //=============================================================================
2493 void HOMARD_Hypothesis::SupprGroups()
2495 _ListGroupSelected.clear();
2497 //=============================================================================
2498 void HOMARD_Hypothesis::SetGroups( const std::list<std::string>& ListGroup )
2500 _ListGroupSelected.clear();
2501 std::list<std::string>::const_iterator it = ListGroup.begin();
2502 while(it != ListGroup.end())
2503 _ListGroupSelected.push_back((*it++));
2505 //=============================================================================
2506 const std::list<std::string>& HOMARD_Hypothesis::GetGroups() const
2508 return _ListGroupSelected;
2510 //=============================================================================
2511 // Type d'interpolation des champs :
2512 // 0 : aucun champ n'est interpole
2513 // 1 : tous les champs sont interpoles
2514 // 2 : certains champs sont interpoles
2515 void HOMARD_Hypothesis::SetTypeFieldInterp( int TypeFieldInterp )
2517 VERIFICATION( (TypeFieldInterp>=0) && (TypeFieldInterp<=2) );
2518 _TypeFieldInterp = TypeFieldInterp;
2520 //=============================================================================
2521 int HOMARD_Hypothesis::GetTypeFieldInterp() const
2523 return _TypeFieldInterp;
2525 //=============================================================================
2526 void HOMARD_Hypothesis::AddFieldInterpType( const char* FieldInterp, int TypeInterp )
2528 MESSAGE ("Dans AddFieldInterpType pour " << FieldInterp << " et TypeInterp = " << TypeInterp) ;
2529 // On commence par supprimer le champ au cas ou il aurait deja ete insere
2530 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2531 // definition de l'hypothese
2532 SupprFieldInterp( FieldInterp ) ;
2533 // Insertion veritable
2535 _ListFieldInterp.push_back( std::string( FieldInterp ) );
2537 std::stringstream saux1 ;
2538 saux1 << TypeInterp ;
2539 _ListFieldInterp.push_back( saux1.str() );
2540 // . Indication generale : certains champs sont a interpoler
2541 SetTypeFieldInterp ( 2 ) ;
2543 //=============================================================================
2544 void HOMARD_Hypothesis::SupprFieldInterp( const char* FieldInterp )
2546 MESSAGE ("Dans SupprFieldInterp pour " << FieldInterp) ;
2547 std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp ) ;
2548 // Attention a supprimer le nom du champ et le type d'usage
2549 if ( it != _ListFieldInterp.end() )
2551 it = _ListFieldInterp.erase( it ) ;
2552 it = _ListFieldInterp.erase( it ) ;
2554 // Decompte du nombre de champs restant a interpoler
2555 it = _ListFieldInterp.begin() ;
2557 while(it != _ListFieldInterp.end())
2562 MESSAGE("Nombre de champ restants = "<<cpt/2);
2563 // . Indication generale : aucun champ ne reste a interpoler
2566 SetTypeFieldInterp ( 0 ) ;
2569 //=============================================================================
2570 void HOMARD_Hypothesis::SupprFieldInterps()
2572 MESSAGE ("SupprFieldInterps") ;
2573 _ListFieldInterp.clear();
2574 // . Indication generale : aucun champ ne reste a interpoler
2575 SetTypeFieldInterp ( 0 ) ;
2577 //=============================================================================
2578 const std::list<std::string>& HOMARD_Hypothesis::GetFieldInterps() const
2580 return _ListFieldInterp;
2582 //=============================================================================
2583 //=============================================================================
2584 // Liens avec les autres structures
2585 //=============================================================================
2586 //=============================================================================
2587 void HOMARD_Hypothesis::SetCaseCreation( const char* NomCasCreation )
2589 _NomCasCreation = std::string( NomCasCreation );
2591 //=============================================================================
2592 std::string HOMARD_Hypothesis::GetCaseCreation() const
2594 return _NomCasCreation;
2596 //=============================================================================
2597 void HOMARD_Hypothesis::LinkIteration( const char* NomIteration )
2599 _ListIter.push_back( std::string( NomIteration ) );
2601 //=============================================================================
2602 void HOMARD_Hypothesis::UnLinkIteration( const char* NomIteration )
2604 std::list<std::string>::iterator it = find( _ListIter.begin(), _ListIter.end(), NomIteration ) ;
2605 if ( it != _ListIter.end() )
2607 MESSAGE ("Dans UnLinkIteration pour " << NomIteration) ;
2608 it = _ListIter.erase( it ) ;
2611 //=============================================================================
2612 void HOMARD_Hypothesis::UnLinkIterations()
2616 //=============================================================================
2617 const std::list<std::string>& HOMARD_Hypothesis::GetIterations() const
2621 //=============================================================================
2622 void HOMARD_Hypothesis::AddZone( const char* NomZone, int TypeUse )
2624 MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse) ;
2625 // On commence par supprimer la zone au cas ou elle aurait deja ete inseree
2626 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
2627 // definition de l'hypothese
2628 SupprZone( NomZone ) ;
2629 // Insertion veritable
2631 _ListZone.push_back( std::string( NomZone ) );
2632 // . Usage de la zone
2633 std::stringstream saux1 ;
2635 _ListZone.push_back( saux1.str() );
2637 //=============================================================================
2638 void HOMARD_Hypothesis::SupprZone( const char* NomZone )
2640 MESSAGE ("Dans SupprZone pour " << NomZone) ;
2641 std::list<std::string>::iterator it = find( _ListZone.begin(), _ListZone.end(), NomZone );
2642 // Attention a supprimer le nom de zone et le type d'usage
2643 if ( it != _ListZone.end() )
2645 it = _ListZone.erase( it );
2646 it = _ListZone.erase( it );
2649 //=============================================================================
2650 void HOMARD_Hypothesis::SupprZones()
2654 //=============================================================================
2655 const std::list<std::string>& HOMARD_Hypothesis::GetZones() const
2660 //=============================================================================
2662 * default constructor:
2664 //=============================================================================
2665 HOMARD_Iteration::HOMARD_Iteration():
2666 _Name( "" ), _Etat( 0 ),
2668 _NomMesh( "" ), _MeshFile( "" ),
2669 _FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ),
2672 _NomHypo( "" ), _NomCas( "" ), _NomDir( "" ),
2676 MESSAGE("HOMARD_Iteration");
2678 //=============================================================================
2682 //=============================================================================
2683 HOMARD_Iteration::~HOMARD_Iteration()
2685 MESSAGE("~HOMARD_Iteration");
2687 //=============================================================================
2688 //=============================================================================
2690 //=============================================================================
2691 //=============================================================================
2692 void HOMARD_Iteration::SetName( const char* Name )
2694 _Name = std::string( Name );
2696 //=============================================================================
2697 std::string HOMARD_Iteration::GetName() const
2701 //=============================================================================
2702 //=============================================================================
2704 //=============================================================================
2705 //=============================================================================
2706 void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
2708 _NomDir = std::string( NomDir );
2710 //=============================================================================
2711 std::string HOMARD_Iteration::GetDirNameLoc() const
2715 //=============================================================================
2716 void HOMARD_Iteration::SetNumber( int NumIter )
2720 //=============================================================================
2721 int HOMARD_Iteration::GetNumber() const
2725 //=============================================================================
2726 void HOMARD_Iteration::SetState( int etat )
2730 //=============================================================================
2731 int HOMARD_Iteration::GetState() const
2735 //=============================================================================
2736 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
2738 _NomMesh = std::string( NomMesh );
2740 //=============================================================================
2741 std::string HOMARD_Iteration::GetMeshName() const
2745 //=============================================================================
2746 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
2748 _MeshFile = std::string( MeshFile );
2750 //=============================================================================
2751 std::string HOMARD_Iteration::GetMeshFile() const
2755 //=============================================================================
2756 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
2758 _FieldFile = std::string( FieldFile );
2760 //=============================================================================
2761 std::string HOMARD_Iteration::GetFieldFile() const
2765 //=============================================================================
2766 // Instants pour le champ de pilotage
2767 //=============================================================================
2768 void HOMARD_Iteration::SetTimeStep( int TimeStep )
2770 _TimeStep = TimeStep;
2772 //=============================================================================
2773 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
2775 _TimeStep = TimeStep;
2778 //=============================================================================
2779 void HOMARD_Iteration::SetTimeStepRankLast()
2783 //=============================================================================
2784 int HOMARD_Iteration::GetTimeStep() const
2788 //=============================================================================
2789 int HOMARD_Iteration::GetRank() const
2793 //=============================================================================
2794 // Instants pour un champ a interpoler
2795 //=============================================================================
2796 void HOMARD_Iteration::SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep )
2798 SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep ) ;
2800 //=============================================================================
2801 void HOMARD_Iteration::SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank )
2803 MESSAGE("Champ " << FieldInterp << ", hypothese " << _NomHypo )
2804 // Verification de la presence du champ dans l'hypothese
2805 std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp );
2806 if ( it == _ListFieldInterp.end() )
2808 INFOS("Champ " << FieldInterp << " ; hypothese " << _NomHypo )
2809 VERIFICATION("Le champ est inconnu dans l'hypothese associee a cette iteration." == 0);
2813 _ListFieldInterpTSR.push_back( std::string( FieldInterp ) );
2815 std::stringstream saux1 ;
2817 _ListFieldInterpTSR.push_back( saux1.str() );
2819 std::stringstream saux2 ;
2821 _ListFieldInterpTSR.push_back( saux2.str() );
2823 //=============================================================================
2824 const std::list<std::string>& HOMARD_Iteration::GetFieldInterpsTimeStepRank() const
2826 return _ListFieldInterpTSR;
2828 //=============================================================================
2829 void HOMARD_Iteration::SetFieldInterp( const char* FieldInterp )
2831 _ListFieldInterp.push_back( std::string( FieldInterp ) );
2833 //=============================================================================
2834 const std::list<std::string>& HOMARD_Iteration::GetFieldInterps() const
2836 return _ListFieldInterp;
2838 //=============================================================================
2839 void HOMARD_Iteration::SupprFieldInterps()
2841 _ListFieldInterp.clear();
2843 //=============================================================================
2844 void HOMARD_Iteration::SetLogFile( const char* LogFile )
2846 _LogFile = std::string( LogFile );
2848 //=============================================================================
2849 std::string HOMARD_Iteration::GetLogFile() const
2853 //=============================================================================
2854 void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
2856 _FileInfo = std::string( FileInfo );
2858 //=============================================================================
2859 std::string HOMARD_Iteration::GetFileInfo() const
2863 //=============================================================================
2864 //=============================================================================
2865 // Liens avec les autres iterations
2866 //=============================================================================
2867 //=============================================================================
2868 void HOMARD_Iteration::LinkNextIteration( const char* NomIteration )
2870 _mesIterFilles.push_back( std::string( NomIteration ) );
2872 //=============================================================================
2873 void HOMARD_Iteration::UnLinkNextIteration( const char* NomIteration )
2875 std::list<std::string>::iterator it = find( _mesIterFilles.begin(), _mesIterFilles.end(), NomIteration ) ;
2876 if ( it != _mesIterFilles.end() )
2878 MESSAGE ("Dans UnLinkNextIteration pour " << NomIteration) ;
2879 it = _mesIterFilles.erase( it ) ;
2882 //=============================================================================
2883 void HOMARD_Iteration::UnLinkNextIterations()
2885 _mesIterFilles.clear();
2887 //=============================================================================
2888 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
2890 return _mesIterFilles;
2892 //=============================================================================
2893 void HOMARD_Iteration::SetIterParentName( const char* IterParent )
2895 _IterParent = IterParent;
2897 //=============================================================================
2898 std::string HOMARD_Iteration::GetIterParentName() const
2902 //=============================================================================
2903 //=============================================================================
2904 // Liens avec les autres structures
2905 //=============================================================================
2906 //=============================================================================
2907 void HOMARD_Iteration::SetCaseName( const char* NomCas )
2909 _NomCas = std::string( NomCas );
2911 //=============================================================================
2912 std::string HOMARD_Iteration::GetCaseName() const
2916 //=============================================================================
2917 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
2919 _NomHypo = std::string( NomHypo );
2921 //=============================================================================
2922 std::string HOMARD_Iteration::GetHypoName() const
2926 //=============================================================================
2927 //=============================================================================
2929 //=============================================================================
2930 //=============================================================================
2931 void HOMARD_Iteration::SetInfoCompute( int MessInfo )
2933 _MessInfo = MessInfo;
2935 //=============================================================================
2936 int HOMARD_Iteration::GetInfoCompute() const
2941 } // namespace SMESHHOMARDImpl /end/