Salome HOME
Copyrights update 2015.
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_Hypothesis.cxx
index 6354f5f5837b1f76ff46ed560dfc80a56a5d6702..fc9c0caf69d35a6355592281779703ac859f8290 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2004-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  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
@@ -42,6 +42,7 @@
 HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
   : SMESH_Hypothesis(hypId, studyId, gen),
   myToMeshHoles(DefaultMeshHoles()),
+  myLayersOnAllWrap(DefaultLayersOnAllWrap()),
   myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
   myMaximumMemory(-1),
   myInitialMemory(-1),
@@ -81,6 +82,27 @@ HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   _param_algo_dim = 3;
 }
 
+//=======================================================================
+//function : SetLayersOnAllWrap
+//=======================================================================
+
+void HYBRIDPlugin_Hypothesis::SetLayersOnAllWrap(bool toMesh)
+{
+  if ( myLayersOnAllWrap != toMesh ) {
+    myLayersOnAllWrap = toMesh;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : GetLayersOnAllWrap
+//=======================================================================
+
+bool HYBRIDPlugin_Hypothesis::GetLayersOnAllWrap(bool checkFreeOption) const
+{
+  return myLayersOnAllWrap;
+}
+
 //=======================================================================
 //function : SetToMeshHoles
 //=======================================================================
@@ -1018,6 +1040,15 @@ void HYBRIDPlugin_Hypothesis::ClearGroupsToRemove()
 }
 
 
+//=======================================================================
+//function : DefaultLayersOnAllWrap
+//=======================================================================
+
+bool HYBRIDPlugin_Hypothesis::DefaultLayersOnAllWrap()
+{
+  return true;
+}
+
 //=======================================================================
 //function : DefaultMeshHoles
 //=======================================================================
@@ -1283,6 +1314,7 @@ std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
   save << (int) myElementGeneration << " ";
   save << (int) myAddMultinormals << " ";
   save << (int) mySmoothNormals << " ";
+  save << (int) myLayersOnAllWrap << " ";
 
   save << myNbOfBoundaryLayers << " ";
   save << myHeightFirstLayer << " ";
@@ -1403,6 +1435,12 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
   else
     load.clear(ios::badbit | load.rdstate());
 
+  isOK = (load >> i);
+  if (isOK)
+    myLayersOnAllWrap = (bool) i;
+  else
+    load.clear(ios::badbit | load.rdstate());
+
   isOK = (load >> i);
   if (isOK)
     myNbOfBoundaryLayers = (short) i;
@@ -1743,6 +1781,7 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis*
   bool p_sn    = ( hyp->myTextOption.find("--smooth_normals ")  != std::string::npos );
 
   bool nolayers = false;
+  bool layersOnAllWrap = hyp->myLayersOnAllWrap;
   
   //help mode
   if ( p_h ) {
@@ -1810,9 +1849,14 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis*
 
   //--boundary_layers_surface_ids 5 #for all wrap shell
   //--boundary_layers_surface_ids 6 #for all enfMeshList
-  //TODO if ( !nolayers ) cmd += " --boundary_layers_surface_ids 5,6 "; //as all wrap shell and triangles of enforced mesh
-  if ( !nolayers ) cmd += " --boundary_layers_surface_ids 6 "; //as triangles of enforced mesh
-  
+  //TODO? if ( !nolayers ) cmd += " --boundary_layers_surface_ids 5,6 "; //as all wrap shell and triangles of enforced mesh
+  if ( !nolayers ) {
+    if (layersOnAllWrap)
+      cmd += " --boundary_layers_surface_ids 5 "; //as triangles of all wrap
+    else
+      cmd += " --boundary_layers_surface_ids 6 "; //as triangles of enforced mesh
+  }
+
   if ( !p_eg && hyp ) {
     if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 1 ) {
       const char* value[] = { "tetra-dominant" , "hexa-dominant" };