]> SALOME platform Git repositories - modules/homard.git/blobdiff - src/HOMARD/HOMARD_Hypothesis.cxx
Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/homard.git] / src / HOMARD / HOMARD_Hypothesis.cxx
index 4da42dd200c6fcb8d4908fee39cf87b8deb294ce..40874c5350f3002cc234c297210ecdc1702c9ae6 100644 (file)
@@ -1,25 +1,22 @@
 //  HOMARD HOMARD : implementaion of HOMARD idl descriptions
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2011-2012  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.
+// 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.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //  File   : HOMARD_Hypothesis.cxx
 //  Author : Paul RASCLE, EDF
@@ -39,7 +36,7 @@ HOMARD_Hypothesis::HOMARD_Hypothesis():
   _Field(""),
   _TypeThR(0), _ThreshR(0),
   _TypeThC(0), _ThreshC(0),
-  _UsCmpI(0),  _TypeFieldInterp(0)
+  _UsField(0), _UsCmpI(0),  _TypeFieldInterp(0)
 {
   MESSAGE("HOMARD_Hypothesis");
 }
@@ -91,28 +88,33 @@ std::string HOMARD_Hypothesis::GetName() const
 std::string HOMARD_Hypothesis::GetDumpPython() const
 {
   std::ostringstream aScript;
-  aScript << "\n# Creation of the hypothesis " << _NomHypo << "\n" ; 
-  aScript << "\t" << _NomHypo << " = homard.CreateHypothesis('" << _NomHypo << "')\n";
-  aScript << "\t" << _NomHypo << ".SetCaseCreation('" << _NomCasCreation << "')\n";
+  aScript << "\n# Creation of the hypothesis " << _NomHypo << "\n" ;
+  aScript << "\t" << _NomHypo << " = homard.CreateHypothesis(\"" << _NomHypo << "\")\n";
   aScript << "\t" << _NomHypo << ".SetAdapRefinUnRef(" << _TypeAdap << ", " << _TypeRaff << ", " << _TypeDera << ")\n";
 
 // Raffinement selon des zones geometriques
   std::list<std::string>::const_iterator it = _ListZone.begin();
+  int TypeUse ;
   while(it != _ListZone.end())
   {
-      aScript << "\thomard.AssociateHypoZone('"<< *it << "', '" <<_NomHypo << "')\n";
+      aScript << "\thomard.AssociateHypoZone(\""<< _NomHypo << "\", \"" << *it;
+      it++;
+      if ( *it == "1" ) { TypeUse =  1 ; }
+      else              { TypeUse = -1 ; }
+      aScript << "\", " << TypeUse << ")\n";
       it++;
   }
 
 // Raffinement selon un champ
   if ( _TypeAdap == 1 )
   {
-    aScript << "\t" << _NomHypo << ".SetField('" << _Field << "')\n";
+    aScript << "\t" << _NomHypo << ".SetField(\"" << _Field << "\")\n";
+    aScript << "\t" << _NomHypo << ".SetUseField(" << _UsField << ")\n";
     aScript << "\t" << _NomHypo << ".SetUseComp(" << _UsCmpI << ")\n";
     std::list<std::string>::const_iterator it_comp = _ListComposant.begin();
-    while(it_comp != _ListComposant.end()) 
+    while(it_comp != _ListComposant.end())
     {
-      aScript << "\t" << _NomHypo << ".AddComp('" << *it_comp << "')\n";
+      aScript << "\t" << _NomHypo << ".AddComp(\"" << *it_comp << "\")\n";
       it_comp++;
     }
     if ( _TypeRaff == 1 )
@@ -129,7 +131,7 @@ std::string HOMARD_Hypothesis::GetDumpPython() const
 
 // Filtrage du raffinement par des groupes
    for ( it=_ListGroupSelected.begin(); it!=_ListGroupSelected.end();it++)
-       aScript << "\t" << _NomHypo << ".AddGroup('"  << (*it) <<  "')\n" ;
+       aScript << "\t" << _NomHypo << ".AddGroup(\""  << (*it) <<  "\")\n" ;
 
 // Interpolation champ
   aScript << "\t" << _NomHypo << ".SetTypeFieldInterp(" << _TypeFieldInterp << ")\n";
@@ -138,10 +140,25 @@ std::string HOMARD_Hypothesis::GetDumpPython() const
     std::list<std::string>::const_iterator it_champ = _ListFieldInterp.begin();
     while(it_champ != _ListFieldInterp.end())
     {
-      aScript << "\t" << _NomHypo << ".AddFieldInterp('" << *it_champ << "')\n";
+      aScript << "\t" << _NomHypo << ".AddFieldInterp(\"" << *it_champ << "\")\n";
       it_champ++;
     }
   }
+  if ( _NivMax > 0 )
+  {
+    aScript << "\tNivMax = " << _NivMax << "\n";
+    aScript << "\t" <<_NomHypo << ".SetNivMax(NivMax)\n";
+  }
+  if ( _DiamMin > 0 )
+  {
+    aScript << "\tDiamMin = " << _DiamMin << "\n";
+    aScript << "\t" <<_NomHypo << ".SetDiamMin(DiamMin)\n";
+  }
+  if ( _AdapInit != 0 )
+  {
+    aScript << "\tAdapInit = " << _AdapInit << "\n";
+    aScript << "\t" <<_NomHypo << ".SetAdapInit(AdapInit)\n";
+  }
 
   return aScript.str();
 }
@@ -203,11 +220,12 @@ int HOMARD_Hypothesis::GetUnRefType() const
 void HOMARD_Hypothesis::SetField( const char* FieldName )
 {
   _Field = std::string( FieldName );
-  MESSAGE( "dans SetField, FieldName : " << FieldName );
+  MESSAGE( "SetField : FieldName = " << FieldName );
 }
 //=============================================================================
 void HOMARD_Hypothesis::SetRefinThr( int TypeThR, double ThreshR )
 {
+  MESSAGE( "SetRefinThr : TypeThR = " << TypeThR << ", ThreshR = " << ThreshR );
   ASSERT(!(( TypeThR < 0) or (TypeThR > 3 )));
   _TypeThR = TypeThR;
   _ThreshR = ThreshR;
@@ -229,7 +247,7 @@ void HOMARD_Hypothesis::SetUseComp( int UsCmpI )
 void HOMARD_Hypothesis::SetUseField( int UsField )
 {
   ASSERT(!((UsField < 0) or (UsField > 1 )));
-  MESSAGE( "SetUseField a programmer ");
+  _UsField = UsField;
 }
 
 //=============================================================================
@@ -240,45 +258,32 @@ std::string HOMARD_Hypothesis::GetFieldName() const
 {
   return _Field;
 }
-
-//=============================================================================
-/*!
-*/
 //=============================================================================
 int HOMARD_Hypothesis::GetRefinThrType() const
 {
   return _TypeThR;
 }
-
-//=============================================================================
-/*!
-*/
 //=============================================================================
 double HOMARD_Hypothesis::GetThreshR() const
 {
   return _ThreshR;
 }
-
-//=============================================================================
-/*!
-*/
 //=============================================================================
 int HOMARD_Hypothesis::GetUnRefThrType() const
 {
   return _TypeThC;
 }
 
-//=============================================================================
-/*!
-*/
 //=============================================================================
 double HOMARD_Hypothesis::GetThreshC() const
 {
   return _ThreshC;
 }
 //=============================================================================
-/*!
-*/
+int HOMARD_Hypothesis::GetUseField() const
+{
+  return _UsField;
+}
 //=============================================================================
 int HOMARD_Hypothesis::GetUseCompI() const
 {
@@ -306,9 +311,13 @@ const std::list<std::string>& HOMARD_Hypothesis::GetIterations() const
 /*!
 */
 //=============================================================================
-void HOMARD_Hypothesis::AddZone( const char* NomZone )
+void HOMARD_Hypothesis::AddZone( const char* NomZone, int TypeUse )
 {
   _ListZone.push_back( std::string( NomZone ) );
+  std::stringstream saux1 ;
+  saux1 << TypeUse ;
+  std::string saux2 = saux1.str() ;
+  _ListZone.push_back( saux2 );
 }
 //=============================================================================
 void HOMARD_Hypothesis::SupprZone( const char* NomZone )
@@ -361,7 +370,7 @@ void HOMARD_Hypothesis::SetGroups( const std::list<std::string>& ListGroup )
 {
   _ListGroupSelected.clear();
   std::list<std::string>::const_iterator it = ListGroup.begin();
-  while(it != ListGroup.end()) 
+  while(it != ListGroup.end())
     _ListGroupSelected.push_back((*it++));
 }
 //=============================================================================
@@ -405,4 +414,39 @@ const std::list<std::string>& HOMARD_Hypothesis::GetListFieldInterp() const
 {
   return _ListFieldInterp;
 }
-
+//=============================================================================
+void HOMARD_Hypothesis::SetNivMax( int NivMax )
+//=============================================================================
+{
+  _NivMax = NivMax;
+}
+//=============================================================================
+const int HOMARD_Hypothesis::GetNivMax() const
+//=============================================================================
+{
+  return _NivMax;
+}
+//=============================================================================
+void HOMARD_Hypothesis::SetAdapInit( int AdapInit )
+//=============================================================================
+{
+  _AdapInit = AdapInit;
+}
+//=============================================================================
+const int HOMARD_Hypothesis::GetAdapInit() const
+//=============================================================================
+{
+  return _AdapInit;
+}
+//=============================================================================
+void HOMARD_Hypothesis::SetDiamMin( double DiamMin )
+//=============================================================================
+{
+  _DiamMin = DiamMin;
+}
+//=============================================================================
+const double HOMARD_Hypothesis::GetDiamMin() const
+//=============================================================================
+{
+  return _DiamMin;
+}