Salome HOME
Updated copyright comment
[modules/smesh.git] / src / StdMeshers / StdMeshers_ViscousLayerBuilder.hxx
1 // Copyright (C) 2007-2024  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  File   : StdMeshers_ViscousLayersBuilder.hxx
21 //  Module : SMESH
22 //
23 #ifndef _SMESH_ViscourLayerBuilder_HXX_
24 #define _SMESH_ViscourLayerBuilder_HXX_
25
26 #include <BRepOffset_MakeOffset.hxx>
27 #include <BRepOffset_Offset.hxx>
28
29 #include "SMESH_StdMeshers.hxx"
30 #include "SMESH_Hypothesis.hxx"
31 #include "StdMeshers_Cartesian_VL.hxx"
32 #include "StdMeshers_ViscousLayers.hxx"
33 #include "StdMeshers_ViscousLayers2D.hxx"
34
35
36 class STDMESHERS_EXPORT StdMeshers_ViscousLayerBuilder: public SMESH_2D_Algo
37 {
38  public:
39   StdMeshers_ViscousLayerBuilder(int hypId, SMESH_Gen* gen);
40   ~StdMeshers_ViscousLayerBuilder();
41
42   virtual bool CheckHypothesis(SMESH_Mesh&                          aMesh,
43                                const TopoDS_Shape&                  aShape,
44                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
45
46   virtual bool Compute(SMESH_Mesh& /*aMesh*/, const TopoDS_Shape& /*aShape*/ );
47
48   virtual bool Evaluate(SMESH_Mesh & /*aMesh*/, const TopoDS_Shape & /*aShape*/,
49                         MapShapeNbElems& /*aResMap*/ );
50
51   /*!
52    * \brief Check if the algo is applicable to the geometry and dimension
53   */
54   virtual bool IsApplicable( const TopoDS_Shape &S, bool /*toCheckAll*/, int algoDim );  
55
56   void   SetBndShapes(const std::vector<int>& shapeIds, bool toIgnore);
57   // std::vector<int> GetBndShapes() const { return _shapeIds; }
58   // bool   IsToIgnoreShapes() const { return _isToIgnoreShapes; }
59
60   void   SetTotalThickness(double thickness);
61   // double GetTotalThickness() const { return _thickness; }
62
63   void   SetNumberLayers(int nb);
64   // int    GetNumberLayers() const { return _nbLayers; }
65
66   void   SetStretchFactor(double factor);
67   // double GetStretchFactor() const { return _stretchFactor; }
68
69   void   SetMethod( StdMeshers_ViscousLayers::ExtrusionMethod how );
70   // StdMeshers_ViscousLayers::ExtrusionMethod GetMethod() const { return _method; }
71
72   // name of a group to create
73   void SetGroupName(const std::string& name);
74   // const std::string& GetGroupName() const { return _groupName; }
75
76    /*!
77    * \brief Compute a shrink version of the geometry. 
78    *        Use the BRepOffset_MakeOffset to perfom the operations for Solids. 
79    *        Use BRepBuilderAPI_MakeFace to perform the operation for planar faces.
80    * \remark For possitive offsets, planar faces are shrink in all directions BRepBuilderAPI_MakeFace does not support coarse grained edge selection.
81     * \param theMesh - the built mesh
82     * \param theShape - the geometry to be shrink
83     * \retval TopoDS_Shape - a new shape of the shrink geometry
84    */
85   TopoDS_Shape GetShrinkGeometry( SMESH_Mesh & theMesh, const TopoDS_Shape & theShape );
86
87     /*!
88    * \brief Build the elements of the viscous layer based on the shrinkMesh and copied to theMesh 
89     * \param shrinkMesh - the mesh defined on the shrink geometry
90     * \param theMesh - the final mesh with the combination of the shrink mesh and the viscous layer
91     * \param theShape - the original geometry
92     * \retval bool - Ok if success in the operation
93    */
94   bool AddLayers( SMESH_Mesh & shrinkMesh, SMESH_Mesh & theMesh, const TopoDS_Shape & theShape );
95
96   private:
97     
98     
99     StdMeshers_ViscousLayers2D*                     _hyp;
100     StdMeshers_Cartesian_VL::ViscousBuilder*  _vlBuilder;
101
102     BRepOffset_MakeOffset                     _makeOffset;
103     BRepOffset_Offset                     _makeFaceOffset;
104     TopoDS_Shape                             _offsetShape;
105 };
106
107 #endif