Salome HOME
22834: [CEA 1347] Viscous layers: be able to choose the extrusion method
[modules/smesh.git] / src / StdMeshers / StdMeshers_ViscousLayers.hxx
index 9794ec54d4aa2fee4b4318457bfb6e5b000b580b..d76fa680f46d3a631dea27e87591374cd0dc8343 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // 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
@@ -28,6 +28,7 @@
 
 #include "SMESH_Hypothesis.hxx"
 #include "SMESH_ProxyMesh.hxx"
+#include "SMESH_ComputeError.hxx"
 
 #include <vector>
 
@@ -39,29 +40,54 @@ class STDMESHERS_EXPORT StdMeshers_ViscousLayers : public SMESH_Hypothesis
 public:
   StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen);
 
-  // Set boundary shapes to exclude from treatment, faces in 3D, edges in 2D
-  void SetBndShapesToIgnore(const std::vector<int>& shapeIds);
-  std::vector<int> GetBndShapesToIgnore() const { return _ignoreBndShapeIds; }
-  bool IsIgnoredShape(const int shapeID) const;
+  // Set boundary shapes (faces in 3D, edges in 2D) either to exclude from
+  // treatment or to make the Viscous Layers on
+  void   SetBndShapes(const std::vector<int>& shapeIds, bool toIgnore);
+  std::vector<int> GetBndShapes() const { return _shapeIds; }
+  bool   IsToIgnoreShapes() const { return _isToIgnoreShapes; }
 
   // Set total thickness of layers of prisms
-  void SetTotalThickness(double thickness);
+  void   SetTotalThickness(double thickness);
   double GetTotalThickness() const { return _thickness; }
 
   // Set number of layers of prisms
-  void SetNumberLayers(int nb);
-  int GetNumberLayers() const { return _nbLayers; }
+  void   SetNumberLayers(int nb);
+  int    GetNumberLayers() const { return _nbLayers; }
 
   // Set factor (>1.0) of growth of layer thickness towards inside of mesh
-  void SetStretchFactor(double factor);
+  void   SetStretchFactor(double factor);
   double GetStretchFactor() const { return _stretchFactor; }
 
+  // Method of computing node translation 
+  enum ExtrusionMethod {
+    // node is translated along normal to a surface with possible further smoothing
+    SURF_OFFSET_SMOOTH,
+    // node is translated along the average normal of surrounding faces till
+    // intersection with a neighbor face translated along its own normal 
+    // by the layers thickness
+    FACE_OFFSET,
+    // node is translated along the average normal of surrounding faces
+    // by the layers thickness
+    NODE_OFFSET
+  };
+  void   SetMethod( ExtrusionMethod how );
+  ExtrusionMethod GetMethod() const { return _method; }
+
   // Computes temporary 2D mesh to be used by 3D algorithm.
   // Return SMESH_ProxyMesh for each SOLID in theShape
   SMESH_ProxyMesh::Ptr Compute(SMESH_Mesh&         theMesh,
                                const TopoDS_Shape& theShape,
                                const bool          toMakeN2NMap=false) const;
 
+  // Checks compatibility of assigned StdMeshers_ViscousLayers hypotheses
+  static SMESH_ComputeErrorPtr
+    CheckHypothesis(SMESH_Mesh&                          aMesh,
+                    const TopoDS_Shape&                  aShape,
+                    SMESH_Hypothesis::Hypothesis_Status& aStatus);
+
+  // Checks if viscous layers should be constructed on a shape
+  bool IsShapeWithLayers(int shapeIndex) const;
+
   virtual std::ostream & SaveTo(std::ostream & save);
   virtual std::istream & LoadFrom(std::istream & load);
 
@@ -70,8 +96,6 @@ public:
     * \param theMesh - the built mesh
     * \param theShape - the geometry of interest
     * \retval bool - true if parameter values have been successfully defined
-    *
-    * Just return false as this hypothesis does not have parameters values
    */
   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
 
@@ -86,10 +110,12 @@ public:
 
  private:
 
-  std::vector<int> _ignoreBndShapeIds;
+  std::vector<int> _shapeIds;
+  bool             _isToIgnoreShapes;
   int              _nbLayers;
   double           _thickness;
   double           _stretchFactor;
+  ExtrusionMethod  _method;
 };
 
 class SMESH_subMesh;