Salome HOME
updated copyright message
[modules/homard.git] / src / HOMARD / HOMARD_Hypothesis.cxx
index efa92d3d6f5baa0717efd09702bb703dd7dc23d1..c7bf89ff5358648a82a2f180917b59983a29d90b 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-2023  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
@@ -19,7 +19,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //  File   : HOMARD_Hypothesis.cxx
-//  Author : Paul RASCLE, EDF
+//  Author : Gerald NICOLAS, EDF
 //  Module : HOMARD
 //
 // Remarques :
@@ -79,7 +79,13 @@ std::string HOMARD_Hypothesis::GetDumpPython() const
   std::ostringstream aScript;
   aScript << "\n# Creation of the hypothesis " << _Name << "\n" ;
   aScript << "\t" << _Name << " = homard.CreateHypothesis(\"" << _Name << "\")\n";
-  aScript << "\t" << _Name << ".SetAdapRefinUnRef(" << _TypeAdap << ", " << _TypeRaff << ", " << _TypeDera << ")\n";
+  if ( _TypeAdap == -1 )
+  {
+    int TypeRaffDera ;
+    if ( _TypeRaff == 1 ) { TypeRaffDera = 1 ; }
+    else                  { TypeRaffDera = -1 ; }
+    aScript << "\t" << _Name << ".SetUnifRefinUnRef(" << TypeRaffDera << ")\n";
+  }
 
 // Raffinement selon des zones geometriques
   std::list<std::string>::const_iterator it = _ListZone.begin();
@@ -148,9 +154,9 @@ std::string HOMARD_Hypothesis::GetDumpPython() const
   {
     aScript << "\t" <<_Name << ".SetAdapInit(" << _AdapInit << ")\n";
   }
-  if ( _LevelOutput != 0 )
+  if ( _ExtraOutput != 1 )
   {
-    aScript << "\t" <<_Name << ".SetLevelOutput(" << _LevelOutput << ")\n";
+    aScript << "\t" <<_Name << ".SetExtraOutput(" << _ExtraOutput << ")\n";
   }
 
   return aScript.str();
@@ -162,7 +168,7 @@ std::string HOMARD_Hypothesis::GetDumpPython() const
 //=============================================================================
 void HOMARD_Hypothesis::SetAdapType( int TypeAdap )
 {
-  VERIFICATION( (TypeAdap>=-1) and (TypeAdap<=1) );
+  VERIFICATION( (TypeAdap>=-1) && (TypeAdap<=1) );
   _TypeAdap = TypeAdap;
 }
 //=============================================================================
@@ -173,9 +179,9 @@ int HOMARD_Hypothesis::GetAdapType() const
 //=============================================================================
 void HOMARD_Hypothesis::SetRefinTypeDera( int TypeRaff, int TypeDera )
 {
-  VERIFICATION( (TypeRaff>=-1) and (TypeRaff<=1) );
+  VERIFICATION( (TypeRaff>=-1) && (TypeRaff<=1) );
   _TypeRaff = TypeRaff;
-  VERIFICATION( (TypeDera>=-1) and (TypeDera<=1) );
+  VERIFICATION( (TypeDera>=-1) && (TypeDera<=1) );
   _TypeDera = TypeDera;
 }
 //=============================================================================
@@ -202,7 +208,7 @@ std::string HOMARD_Hypothesis::GetFieldName() const
 //=============================================================================
 void HOMARD_Hypothesis::SetUseField( int UsField )
 {
-  VERIFICATION( (UsField>=0) and (UsField<=1) );
+  VERIFICATION( (UsField>=0) && (UsField<=1) );
   _UsField = UsField;
 }
 //=============================================================================
@@ -213,7 +219,8 @@ int HOMARD_Hypothesis::GetUseField() const
 //=============================================================================
 void HOMARD_Hypothesis::SetUseComp( int UsCmpI )
 {
-  VERIFICATION( (UsCmpI>=0) and (UsCmpI<=2) );
+  MESSAGE ("SetUseComp pour UsCmpI = "<<UsCmpI) ;
+  VERIFICATION( (UsCmpI>=0) && (UsCmpI<=2) );
   _UsCmpI = UsCmpI;
 }
 //=============================================================================
@@ -224,7 +231,7 @@ int HOMARD_Hypothesis::GetUseComp() const
 //=============================================================================
 void HOMARD_Hypothesis::AddComp( const char* NomComp )
 {
-// On commence par la supprimer au cas ou elle aurait deja ete inseree
+// On commence par supprimer la composante au cas ou elle aurait deja ete inseree
 // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
 // definition de l'hypothese
   SupprComp( NomComp ) ;
@@ -252,7 +259,7 @@ const std::list<std::string>& HOMARD_Hypothesis::GetComps() const
 void HOMARD_Hypothesis::SetRefinThr( int TypeThR, double ThreshR )
 {
   MESSAGE( "SetRefinThr : TypeThR = " << TypeThR << ", ThreshR = " << ThreshR );
-  VERIFICATION( (TypeThR>=0) and (TypeThR<=4) );
+  VERIFICATION( (TypeThR>=0) && (TypeThR<=4) );
   _TypeThR = TypeThR;
   _ThreshR = ThreshR;
 }
@@ -269,7 +276,7 @@ double HOMARD_Hypothesis::GetThreshR() const
 //=============================================================================
 void HOMARD_Hypothesis::SetUnRefThr( int TypeThC, double ThreshC )
 {
-  VERIFICATION( (TypeThC>=0) and (TypeThC<=4) );
+  VERIFICATION( (TypeThC>=0) && (TypeThC<=4) );
   _TypeThC = TypeThC;
   _ThreshC = ThreshC;
 }
@@ -320,23 +327,40 @@ const int HOMARD_Hypothesis::GetAdapInit() const
   return _AdapInit;
 }
 //=============================================================================
-void HOMARD_Hypothesis::SetLevelOutput( int LevelOutput )
+void HOMARD_Hypothesis::SetExtraOutput( int ExtraOutput )
 //=============================================================================
 {
-  _LevelOutput = LevelOutput;
+  _ExtraOutput = ExtraOutput;
 }
 //=============================================================================
-const int HOMARD_Hypothesis::GetLevelOutput() const
+const int HOMARD_Hypothesis::GetExtraOutput() const
 //=============================================================================
 {
-  return _LevelOutput;
+  return _ExtraOutput;
 }
 //=============================================================================
 void HOMARD_Hypothesis::AddGroup( const char* Group)
 {
+// On commence par supprimer le groupe au cas ou il aurait deja ete insere
+// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
+// definition de l'hypothese
+  SupprGroup( Group ) ;
+// Insertion veritable
   _ListGroupSelected.push_back(Group);
 }
 //=============================================================================
+void HOMARD_Hypothesis::SupprGroup( const char* Group )
+{
+  MESSAGE ("SupprGroup pour "<<Group) ;
+  std::list<std::string>::iterator it = find( _ListGroupSelected.begin(), _ListGroupSelected.end(), Group );
+  if ( it != _ListGroupSelected.end() ) { it = _ListGroupSelected.erase( it ); }
+}
+//=============================================================================
+void HOMARD_Hypothesis::SupprGroups()
+{
+  _ListGroupSelected.clear();
+}
+//=============================================================================
 void HOMARD_Hypothesis::SetGroups( const std::list<std::string>& ListGroup )
 {
   _ListGroupSelected.clear();
@@ -356,7 +380,7 @@ const std::list<std::string>& HOMARD_Hypothesis::GetGroups() const
 //   2 : certains champs sont interpoles
 void HOMARD_Hypothesis::SetTypeFieldInterp( int TypeFieldInterp )
 {
-  VERIFICATION( (TypeFieldInterp>=0) and (TypeFieldInterp<=2) );
+  VERIFICATION( (TypeFieldInterp>=0) && (TypeFieldInterp<=2) );
   _TypeFieldInterp = TypeFieldInterp;
 }
 //=============================================================================