1 // Copyright (c) 2013 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _BRepMesh_IncrementalMesh_HeaderFile
15 #define _BRepMesh_IncrementalMesh_HeaderFile
17 #include <BRepMesh_DiscretRoot.hxx>
18 #include <IMeshTools_Parameters.hxx>
20 //! Builds the mesh of a shape with respect of their
21 //! correctly triangulated parts
22 class BRepMesh_IncrementalMesh : public BRepMesh_DiscretRoot
24 public: //! @name mesher API
26 //! Default constructor
27 Standard_EXPORT BRepMesh_IncrementalMesh();
30 Standard_EXPORT virtual ~BRepMesh_IncrementalMesh();
33 //! Automatically calls method Perform.
34 //! @param theShape shape to be meshed.
35 //! @param theLinDeflection linear deflection.
36 //! @param isRelative if TRUE deflection used for discretization of
37 //! each edge will be <theLinDeflection> * <size of edge>. Deflection
38 //! used for the faces will be the maximum deflection of their edges.
39 //! @param theAngDeflection angular deflection.
40 //! @param isInParallel if TRUE shape will be meshed in parallel.
41 Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
42 const Standard_Real theLinDeflection,
43 const Standard_Boolean isRelative = Standard_False,
44 const Standard_Real theAngDeflection = 0.5,
45 const Standard_Boolean isInParallel = Standard_False);
48 //! Automatically calls method Perform.
49 //! @param theShape shape to be meshed.
50 //! @param theParameters - parameters of meshing
51 Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
52 const IMeshTools_Parameters& theParameters);
54 //! Performs meshing ot the shape.
55 Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
57 public: //! @name accessing to parameters.
59 //! Returns meshing parameters
60 inline const IMeshTools_Parameters& Parameters() const
65 //! Returns modifiable meshing parameters
66 inline IMeshTools_Parameters& ChangeParameters()
71 //! Returns modified flag.
72 inline Standard_Boolean IsModified() const
77 //! Returns accumulated status flags faced during meshing.
78 inline Standard_Integer GetStatusFlags() const
85 //! Initializes specific parameters
86 inline void initParameters()
88 if (myParameters.DeflectionInterior < Precision::Confusion())
90 myParameters.DeflectionInterior = myParameters.Deflection;
93 if (myParameters.MinSize < Precision::Confusion())
95 myParameters.MinSize =
96 Max(IMeshTools_Parameters::RelMinSize() * Min(myParameters.Deflection,
97 myParameters.DeflectionInterior),
98 Precision::Confusion());
101 if (myParameters.AngleInterior < Precision::Angular())
103 myParameters.AngleInterior = 2.0 * myParameters.Angle;
107 public: //! @name plugin API
109 //! Plugin interface for the Mesh Factories.
110 //! Initializes meshing algorithm with the given parameters.
111 //! @param theShape shape to be meshed.
112 //! @param theLinDeflection linear deflection.
113 //! @param theAngDeflection angular deflection.
114 //! @param[out] theAlgo pointer to initialized algorithm.
115 Standard_EXPORT static Standard_Integer Discret(const TopoDS_Shape& theShape,
116 const Standard_Real theLinDeflection,
117 const Standard_Real theAngDeflection,
118 BRepMesh_DiscretRoot* &theAlgo);
120 //! Returns multi-threading usage flag set by default in
121 //! Discret() static method (thus applied only to Mesh Factories).
122 Standard_EXPORT static Standard_Boolean IsParallelDefault();
124 //! Setup multi-threading usage flag set by default in
125 //! Discret() static method (thus applied only to Mesh Factories).
126 Standard_EXPORT static void SetParallelDefault(const Standard_Boolean isInParallel);
128 DEFINE_STANDARD_RTTI_INLINE(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
132 IMeshTools_Parameters myParameters;
133 Standard_Boolean myModified;
134 Standard_Integer myStatus;