Salome HOME
Add layers imprinting on faces.
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_Hypothesis.cxx
index de92a756b2e2f23eb4de5a81c7eb5d1db8783c7d..3d99a624f9e033e64529c26747bc27db1ff85b01 100644 (file)
@@ -129,6 +129,32 @@ const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithLayers() const
   return myFacesWithLayers;
 }
 
+//=======================================================================
+//function : SetFacesWithImprinting
+//purpose  : Set IDs of faces to grow the layers on
+//=======================================================================
+
+bool HYBRIDPlugin_Hypothesis::SetFacesWithImprinting(const std::vector<int>& theVal)
+{
+  if ( myFacesWithImprinting != theVal )
+  {
+    myFacesWithImprinting = theVal;
+    NotifySubMeshesHypothesisModification();
+    return true;
+  }
+  return false;
+}
+
+//=======================================================================
+//function : GetFacesWithImprinting
+//purpose  : Return IDs of faces to grow the layers on
+//=======================================================================
+
+const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithImprinting() const
+{
+  return myFacesWithImprinting;
+}
+
 //=======================================================================
 //function : SetToMeshHoles
 //=======================================================================
@@ -1440,6 +1466,10 @@ std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
   for ( size_t i = 0; i < myFacesWithLayers.size(); ++i )
     save << " " << myFacesWithLayers[i];
 
+  save << " " << myFacesWithImprinting.size();
+  for ( size_t i = 0; i < myFacesWithImprinting.size(); ++i )
+    save << " " << myFacesWithImprinting[i];
+
   return save;
 }
 
@@ -1770,6 +1800,20 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
         myFacesWithLayers.push_back( i );
     }
   }
+
+  if ( isOK )
+  {
+    i = atoi( separator.c_str() );
+    isOK = ( i >= 0 );
+    if ( isOK )
+    {
+      myFacesWithImprinting.reserve( i );
+      while (( myFacesWithImprinting.size() < myFacesWithImprinting.capacity() ) &&
+             ( isOK = static_cast<bool>(load >> i)) )
+        myFacesWithImprinting.push_back( i );
+    }
+  }
+
   return load;
 }
 
@@ -1877,22 +1921,26 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis*
   if ( !nolayers && hyp )
   {
     cmd << " --boundary_layer_size_mode " << ( layersOnAllWrap ? "global" : "local" );
-    cmd << " --boundary_layer_surface_tags ";
-    if ( layersOnAllWrap )
-    {
-      cmd << " 3 ";
-    }
-    else
+    
+    if ( !layersOnAllWrap )
     {
-      const std::vector<int>& faceIDs = hyp->GetFacesWithLayers();
-      const bool      hasEnforcedTria = !HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(hyp).empty();
-      for ( size_t i = 0; i < faceIDs.size(); ++i )
-        cmd << faceIDs[i] << ",";
-      if ( hasEnforcedTria )
-        cmd << EnforcedTag();
-      cmd << " --boundary_layer_initial_height_on_surface_tags ";
-      for ( size_t i = 0; i < faceIDs.size() + hasEnforcedTria; ++i )
+      // faces with layers
+      const std::vector<int>& faceLayersIDs = hyp->GetFacesWithLayers();
+      if ( !faceLayersIDs.empty() )
+        cmd << " --boundary_layer_surface_tags ";
+      for ( size_t i = 0; i < faceLayersIDs.size(); ++i )
+        cmd << faceLayersIDs[i] << ",";
+      if ( !faceLayersIDs.empty() )
+        cmd << " --boundary_layer_initial_height_on_surface_tags ";
+      for ( size_t i = 0; i < faceLayersIDs.size(); ++i )
         cmd << hyp->myHeightFirstLayer << ",";
+
+      // faces with imprinting
+      const std::vector<int>& faceImprintingIDs = hyp->GetFacesWithImprinting();
+      if ( !faceImprintingIDs.empty() )
+        cmd << " --boundary_layer_imprinting yes --boundary_layer_imprinting_tags ";
+      for ( size_t i = 0; i < faceImprintingIDs.size(); ++i )
+        cmd << faceImprintingIDs[i] << ",";
     }
   }