1 // Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : StdMeshers_ViscousLayersBuilder.hxx
23 #ifndef _SMESH_ViscourLayerBuilder_HXX_
24 #define _SMESH_ViscourLayerBuilder_HXX_
26 #include <BRepOffset_MakeOffset.hxx>
27 #include <BRepOffset_Offset.hxx>
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"
36 class STDMESHERS_EXPORT StdMeshers_ViscousLayerBuilder: public SMESH_2D_Algo
39 StdMeshers_ViscousLayerBuilder(int hypId, SMESH_Gen* gen);
40 ~StdMeshers_ViscousLayerBuilder();
42 virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
43 const TopoDS_Shape& aShape,
44 SMESH_Hypothesis::Hypothesis_Status& aStatus);
46 virtual bool Compute(SMESH_Mesh& /*aMesh*/, const TopoDS_Shape& /*aShape*/ );
48 virtual bool Evaluate(SMESH_Mesh & /*aMesh*/, const TopoDS_Shape & /*aShape*/,
49 MapShapeNbElems& /*aResMap*/ );
52 * \brief Check if the algo is applicable to the geometry and dimension
54 virtual bool IsApplicable( const TopoDS_Shape &S, bool /*toCheckAll*/, int algoDim );
56 void SetBndShapes(const std::vector<int>& shapeIds, bool toIgnore);
57 // std::vector<int> GetBndShapes() const { return _shapeIds; }
58 // bool IsToIgnoreShapes() const { return _isToIgnoreShapes; }
60 void SetTotalThickness(double thickness);
61 // double GetTotalThickness() const { return _thickness; }
63 void SetNumberLayers(int nb);
64 // int GetNumberLayers() const { return _nbLayers; }
66 void SetStretchFactor(double factor);
67 // double GetStretchFactor() const { return _stretchFactor; }
69 void SetMethod( StdMeshers_ViscousLayers::ExtrusionMethod how );
70 // StdMeshers_ViscousLayers::ExtrusionMethod GetMethod() const { return _method; }
72 // name of a group to create
73 void SetGroupName(const std::string& name);
74 // const std::string& GetGroupName() const { return _groupName; }
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
85 TopoDS_Shape GetShrinkGeometry( SMESH_Mesh & theMesh, const TopoDS_Shape & theShape );
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
94 bool AddLayers( SMESH_Mesh & shrinkMesh, SMESH_Mesh & theMesh, const TopoDS_Shape & theShape );
99 StdMeshers_ViscousLayers2D* _hyp;
100 StdMeshers_Cartesian_VL::ViscousBuilder* _vlBuilder;
102 BRepOffset_MakeOffset _makeOffset;
103 BRepOffset_Offset _makeFaceOffset;
104 TopoDS_Shape _offsetShape;