Salome HOME
Copyright update 2022
[modules/homard.git] / src / HOMARD / HomardDriver.cxx
index 4589c24adcf1e6ba836f66fe5b22d4888df02411..5c702f924f0b19b4cb5f8c56774f0028a77455d6 100644 (file)
@@ -1,11 +1,11 @@
 //  HOMARD HOMARD : implementation of HOMARD idl descriptions
 //
-// Copyright (C) 2011-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -75,20 +75,23 @@ void HomardDriver::TexteInit( const std::string DirCompute, const std::string Lo
 //
 }
 //===============================================================================
-void HomardDriver::TexteAdap( )
+void HomardDriver::TexteAdap( int ExtType )
 {
   MESSAGE("TexteAdap");
 //
   _Texte += "Action   homa\n" ;
-  _Texte += "CCAssoci med\n" ;
+  if ( ExtType ==  0 )      { _Texte += "CCAssoci med\n" ; }
+  else if ( ExtType ==  1 ) { _Texte += "CCAssoci saturne\n" ; }
+  else                      { _Texte += "CCAssoci saturne_2d\n" ; }
   _Texte += "ModeHOMA 1\n" ;
   _Texte += "NumeIter " + _siter + "\n" ;
+  _modeHOMARD = 1 ;
 //
 }
 //===============================================================================
 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
 {
-  MESSAGE("TexteInit, TypeBila ="<<TypeBila);
+  MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
 //
   _Texte += "ModeHOMA 2\n" ;
   std::stringstream saux1 ;
@@ -107,6 +110,20 @@ void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
     _Texte += "Action   info_ap\n" ;
     _Texte += "CCAssoci homard\n" ;
   }
+  _modeHOMARD = 2 ;
+//
+}
+//===============================================================================
+void HomardDriver::TexteMajCoords( int NumeIter )
+{
+  MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
+//
+  _Texte += "ModeHOMA 5\n" ;
+  _Texte += "NumeIter " + _siterp1 + "\n" ;
+  _Texte += "Action   homa\n" ;
+  _Texte += "CCAssoci med\n" ;
+  _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
+  _modeHOMARD = 5 ;
 //
 }
 //===============================================================================
@@ -114,7 +131,9 @@ void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
 //===============================================================================
 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
 {
-  MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile<<", apres ="<<apres);
+  MESSAGE("TexteMaillage, NomMesh  = "<<NomMesh);
+  MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
+  MESSAGE("TexteMaillage, apres = "<<apres);
   std::string saux ;
   saux = "P1" ;
   if ( apres < 1 ) { saux = "__" ; }
@@ -149,29 +168,34 @@ void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff,
   std::string saux ;
   switch (ConfType)
   {
+    case -2: //
+    {
+      saux = "NON_CONFORME_1_ARETE" ;
+      break;
+    }
     case -1: //
     {
-      saux = "conforme_boites" ;
+      saux = "CONFORME_BOITES" ;
       break;
     }
-    case 1: //
+    case 0: //
     {
-      saux = "conforme" ;
+      saux = "CONFORME" ;
       break;
     }
-    case 2: //
+    case 1: //
     {
-      saux = "non_conforme_1_noeud" ;
+      saux = "NON_CONFORME" ;
       break;
     }
-    case 3: //
+    case 2: //
     {
-      saux = "non_conforme_1_arete" ;
+      saux = "NON_CONFORME_1_NOEUD" ;
       break;
     }
-    case 4: //
+    case 3: //
     {
-      saux = "non_conforme_indicateur" ;
+      saux = "NON_CONFORME_INDICATEUR" ;
       break;
     }
   }
@@ -222,10 +246,10 @@ void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff,
 //   MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
 }
 //===============================================================================
-void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
+void HomardDriver::TexteCompo( int NumeComp, const std::string NomCompo)
 {
-  MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
-  _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
+  MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NomCompo = "<<NomCompo);
+  _Texte +="CCCoChaI \"" + NomCompo + "\"\n" ;
 }
 //===============================================================================
 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 )
@@ -588,7 +612,7 @@ void HomardDriver::TexteField( const std::string FieldName, const std::string Fi
   if ( UsCmpI == 1 )
   { saux = "INFINI" ; }
   if ( UsCmpI == 2 )
-  { saux = "V_RELATIVE" ; }
+  { saux = "RELATIF" ; }
   if ( saux != " " )
   {
     _Texte += "CCUsCmpI " + saux  + "\n" ;
@@ -616,13 +640,22 @@ void HomardDriver::TexteBoundaryOption( int BoundaryOption )
   std::string saux = saux1.str() ;
   _Texte += "SuivFron " + saux + "\n" ;
 //
+}//===============================================================================
+void HomardDriver::TexteBoundaryCAOGr(  const std::string GroupName )
+{
+  MESSAGE("TexteBoundaryCAOGr, GroupName  = "<<GroupName);
+//
+  _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
+//
 }
+
 //===============================================================================
 void HomardDriver::TexteBoundaryDi(  const std::string MeshName, const std::string MeshFile )
 {
   MESSAGE("TexteBoundaryDi, MeshName  = "<<MeshName);
   MESSAGE("TexteBoundaryDi, MeshFile  = "<<MeshFile);
 //
+  _Texte += "#\n# Frontiere discrete\n" ;
   _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
   _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
 //
@@ -657,6 +690,8 @@ void HomardDriver::TexteBoundaryAn( const std::string NameBoundary, int NumeBoun
   { saux += "# Sphere\n" ; }
   if ( BoundaryType == 3 || BoundaryType == 4 )
   { saux += "# Cone\n" ; }
+  if ( BoundaryType == 5 )
+  { saux += "# Tore\n" ; }
 //
 // Le nom de la frontiere
 //
@@ -800,6 +835,45 @@ void HomardDriver::TexteBoundaryAn( const std::string NameBoundary, int NumeBoun
       saux += "FARayon2 " + saux1.str() + "\n" ;
     }
  }
+//
+// Cas du tore
+//
+  if ( BoundaryType == 5 )
+  {
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x0 ;
+      saux2 = saux1.str() ;
+      saux += "FAXCen " + saux1.str() + "\n" ;
+    }
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x1 ;
+      saux += "FAYCen " + saux1.str() + "\n" ;
+    }
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x2 ;
+      saux += "FAZCen " + saux1.str() + "\n" ;
+    }
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x3 ;
+      saux += "FAXAxe " + saux1.str() + "\n" ;
+    }
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x4 ;
+      saux += "FAYAxe " + saux1.str() + "\n" ;
+    }
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x5 ;
+      saux += "FAZAxe " + saux1.str() + "\n" ;
+    }
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x6 ;
+      saux += "FARayon  " + saux1.str() + "\n" ;
+    }
+    { std::stringstream saux1 ;
+      saux1 << NumeBoundary << " " << x7 ;
+      saux += "FARayon2 " + saux1.str() + "\n" ;
+    }
+ }
 //
   _Texte += saux + "#\n" ;
 //
@@ -896,9 +970,9 @@ void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string Fi
 //===============================================================================
 // F. Les options avancees
 //===============================================================================
-void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
+void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
 {
-  MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
+  MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
 
   if ( Pyram > 0 )
   {
@@ -933,11 +1007,31 @@ void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int Ada
       _Texte += "AdapInit " + saux1.str() + "\n" ;
     }
   }
-  if ( LevelOutput != 0 )
+  if ( ExtraOutput % 2 == 0 )
   {
     _Texte += "# Sortie des niveaux de raffinement\n" ;
     _Texte += "NCNiveau NIVEAU\n" ;
   }
+  if ( ExtraOutput % 3 == 0 )
+  {
+    _Texte += "# Sortie des qualités des mailles\n" ;
+    _Texte += "NCQualit QUAL\n" ;
+  }
+  if ( ExtraOutput % 5 == 0 )
+  {
+    _Texte += "# Sortie des diamètres des mailles\n" ;
+    _Texte += "NCDiamet DIAM\n" ;
+  }
+  if ( ExtraOutput % 7 == 0 )
+  {
+    _Texte += "# Sortie des parents des mailles\n" ;
+    _Texte += "NCParent PARENT\n" ;
+  }
+  if ( ExtraOutput % 11 == 0 )
+  {
+    _Texte += "# Volumes voisins par recollement\n" ;
+    _Texte += "NCVoisRc Voisin-Recollement\n" ;
+  }
 }
 //===============================================================================
 // G. Les messages
@@ -959,10 +1053,12 @@ void HomardDriver::TexteInfoCompute( int MessInfo )
 void HomardDriver::CreeFichier( )
 {
 //
-  if ( _siter != _siterp1 )
+  if ( _modeHOMARD == 1 )
   { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
-  else
+  else if ( _modeHOMARD == 2 )
   { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
+  else if ( _modeHOMARD == 5 )
+  { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
 //
   std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
   if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }