Salome HOME
Copyright update 2022
[modules/homard.git] / src / HOMARD_I / HOMARD_Hypothesis_i.cxx
index 0e555430d723254bbd8058f1eed4b745f70eb3fb..b7531938932a798cb3f876f1bfb0570cd5b6bb02 100644 (file)
@@ -1,9 +1,9 @@
-// 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
@@ -16,6 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // Remarques :
 // L'ordre de description des fonctions est le meme dans tous les fichiers
 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
@@ -112,10 +113,22 @@ bool HOMARD_Hypothesis_i::Restore( const std::string& stream )
 // Caracteristiques
 //=============================================================================
 //=============================================================================
-void HOMARD_Hypothesis_i::SetAdapRefinUnRef( CORBA::Long TypeAdap,CORBA::Long TypeRaff, CORBA::Long TypeDera )
+void HOMARD_Hypothesis_i::SetUnifRefinUnRef( CORBA::Long TypeRaffDera )
 {
   ASSERT( myHomardHypothesis );
-  myHomardHypothesis->SetAdapType( TypeAdap );
+  VERIFICATION( (TypeRaffDera==1) || (TypeRaffDera==-1) );
+  int TypeRaff, TypeDera ;
+  if ( TypeRaffDera == 1 )
+  {
+    TypeRaff = 1 ;
+    TypeDera = 0 ;
+  }
+  else if ( TypeRaffDera == -1 )
+  {
+    TypeRaff = 0 ;
+    TypeDera = 1 ;
+  }
+  myHomardHypothesis->SetAdapType( -1 );
   myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
 }
 //=============================================================================
@@ -166,7 +179,7 @@ void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
 //=============================================================================
 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
 {
-  ASSERT(myHomardHypothesis);
+  ASSERT( myHomardHypothesis );
   HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
   aInfosHypo->FieldName  = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
   aInfosHypo->TypeThR    = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
@@ -183,22 +196,28 @@ void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
   myHomardHypothesis->SetUseComp( UsCmpI );
 }
 //=============================================================================
-void HOMARD_Hypothesis_i::AddComp( const char* NomComposant )
+void HOMARD_Hypothesis_i::AddComp( const char* NomComp )
 {
   ASSERT( myHomardHypothesis );
-  myHomardHypothesis->AddComp( NomComposant );
+  myHomardHypothesis->AddComp( NomComp );
 }
 //=============================================================================
-void HOMARD_Hypothesis_i::SupprComp()
+void HOMARD_Hypothesis_i::SupprComp( const char* NomComp )
 {
   ASSERT( myHomardHypothesis );
-  myHomardHypothesis->SupprComp();
+  myHomardHypothesis->SupprComp(NomComp);
 }
 //=============================================================================
-HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetListComp()
+void HOMARD_Hypothesis_i::SupprComps()
 {
   ASSERT( myHomardHypothesis );
-  const std::list<std::string>& ListString = myHomardHypothesis->GetListComp();
+  myHomardHypothesis->SupprComps();
+}
+//=============================================================================
+HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps()
+{
+  ASSERT( myHomardHypothesis );
+  const std::list<std::string>& ListString = myHomardHypothesis->GetComps();
   HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
   aResult->length( ListString.size() );
   std::list<std::string>::const_iterator it;
@@ -212,6 +231,12 @@ HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetListComp()
 //=============================================================================
 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
 {
+  myHomardHypothesis->SetAdapType( 1 );
+  if ( TypeThR > 0 )
+  {
+    int TypeDera = myHomardHypothesis->GetUnRefType() ;
+    myHomardHypothesis->SetRefinTypeDera( 1, TypeDera );
+  }
   myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
 }
 //=============================================================================
@@ -223,6 +248,12 @@ CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
 //=============================================================================
 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
 {
+  myHomardHypothesis->SetAdapType( 1 );
+  if ( TypeThC > 0 )
+  {
+    int TypeRaff = myHomardHypothesis->GetRefinType() ;
+    myHomardHypothesis->SetRefinTypeDera( TypeRaff, 1 );
+  }
   myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
 }
 //=============================================================================
@@ -268,16 +299,16 @@ CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
   return myHomardHypothesis->GetAdapInit();
 }
 //=============================================================================
-void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
+void HOMARD_Hypothesis_i::SetExtraOutput( CORBA::Long ExtraOutput )
 {
   ASSERT( myHomardHypothesis );
-  myHomardHypothesis->SetLevelOutput( LevelOutput );
+  myHomardHypothesis->SetExtraOutput( ExtraOutput );
 }
 //=============================================================================
-CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
+CORBA::Long HOMARD_Hypothesis_i::GetExtraOutput()
 {
   ASSERT( myHomardHypothesis );
-  return myHomardHypothesis->GetLevelOutput();
+  return myHomardHypothesis->GetExtraOutput();
 }
 //=============================================================================
 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
@@ -286,13 +317,25 @@ void HOMARD_Hypothesis_i::AddGroup( const char* Group)
   myHomardHypothesis->AddGroup( Group );
 }
 //=============================================================================
+void HOMARD_Hypothesis_i::SupprGroup( const char* Group )
+{
+  ASSERT( myHomardHypothesis );
+  myHomardHypothesis->SupprGroup(Group);
+}
+//=============================================================================
+void HOMARD_Hypothesis_i::SupprGroups()
+{
+  ASSERT( myHomardHypothesis );
+  myHomardHypothesis->SupprGroups();
+}
+//=============================================================================
 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
 {
   ASSERT( myHomardHypothesis );
   std::list<std::string> ListString;
   for ( int i = 0; i < ListGroup.length(); i++ )
   {
-      ListString.push_back(std::string(ListGroup[i]));
+    ListString.push_back(std::string(ListGroup[i]));
   }
   myHomardHypothesis->SetGroups( ListString );
 }
@@ -327,20 +370,32 @@ CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
 {
   ASSERT( myHomardHypothesis );
-  myHomardHypothesis->AddFieldInterp( FieldInterp );
+  myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
 }
 //=============================================================================
-void HOMARD_Hypothesis_i::SupprFieldInterp()
+void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
 {
   ASSERT( myHomardHypothesis );
-  myHomardHypothesis->SupprFieldInterp();
+  myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
 }
 //=============================================================================
-HOMARD::listFieldInterpHypo* HOMARD_Hypothesis_i::GetListFieldInterp()
+void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
 {
   ASSERT( myHomardHypothesis );
-  const std::list<std::string>& ListString = myHomardHypothesis->GetListFieldInterp();
-  HOMARD::listFieldInterpHypo_var aResult = new HOMARD::listFieldInterpHypo;
+  myHomardHypothesis->SupprFieldInterp(FieldInterp);
+}
+//=============================================================================
+void HOMARD_Hypothesis_i::SupprFieldInterps()
+{
+  ASSERT( myHomardHypothesis );
+  myHomardHypothesis->SupprFieldInterps();
+}
+//=============================================================================
+HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
+{
+  ASSERT( myHomardHypothesis );
+  const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
+  HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
   aResult->length( ListString.size() );
   std::list<std::string>::const_iterator it;
   int i = 0;
@@ -369,19 +424,19 @@ char* HOMARD_Hypothesis_i::GetCaseCreation()
 //=============================================================================
 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
 {
-  ASSERT(myHomardHypothesis);
+  ASSERT( myHomardHypothesis );
   myHomardHypothesis->LinkIteration( NomIteration );
 }
 //=============================================================================
 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
 {
-  ASSERT(myHomardHypothesis);
+  ASSERT( myHomardHypothesis );
   myHomardHypothesis->UnLinkIteration( NomIteration );
 }
 //=============================================================================
 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
 {
-  ASSERT(myHomardHypothesis);
+  ASSERT( myHomardHypothesis );
   const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
   HOMARD::listeIters_var aResult = new HOMARD::listeIters;
   aResult->length( ListString.size() );
@@ -394,30 +449,50 @@ HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
   return aResult._retn();
 }
 //=============================================================================
-void  HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
+void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
 {
-  MESSAGE ("Dans AddZone pour " << NomZone) ;
+  MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse ) ;
   ASSERT( myHomardHypothesis );
+  VERIFICATION( (TypeUse==1) || (TypeUse==-1) );
+  myHomardHypothesis->SetAdapType( 0 );
+  int TypeRaff, TypeDera ;
+  if ( TypeUse == 1 )
+  {
+    TypeRaff = 1 ;
+    TypeDera = myHomardHypothesis->GetUnRefType() ;
+  }
+  else if ( TypeUse == -1 )
+  {
+    TypeRaff = myHomardHypothesis->GetRefinType() ;
+    TypeDera = 1 ;
+  }
+  myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
   char* NomHypo = GetName() ;
   return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
 }
 //=============================================================================
-void  HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
+void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
 {
   MESSAGE ("Dans AddZone0 pour " << NomZone) ;
   ASSERT( myHomardHypothesis );
   myHomardHypothesis->AddZone( NomZone, TypeUse );
 }
 //=============================================================================
-void  HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
+void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
 {
-  ASSERT(myHomardHypothesis);
+  ASSERT( myHomardHypothesis );
   myHomardHypothesis->SupprZone( NomZone);
 }
 //=============================================================================
+void HOMARD_Hypothesis_i::SupprZones()
+{
+  ASSERT( myHomardHypothesis );
+  myHomardHypothesis->SupprZones();
+}
+//=============================================================================
 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
 {
-  ASSERT(myHomardHypothesis);
+  ASSERT( myHomardHypothesis );
   const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
   HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
   aResult->length( ListString.size() );