1 // Copyright (C) 2012-2015 ALNEOS
2 // Copyright (C) 2016-2023 EDF R&D
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.alneos.com/ or email : contact@alneos.fr
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef _GMSHPlugin_Mesher_HXX_
23 #define _GMSHPlugin_Mesher_HXX_
26 #include "GmshVersion.h"
27 #if GMSH_MAJOR_VERSION >=4
32 #include "GmshConfig.h"
33 #include "GModelIO_OCC.h"
34 #include "GModelIO_GEO.h"
36 #if GMSH_MAJOR_VERSION >=4
40 #include "GEdgeCompound.h"
41 #include "GFaceCompound.h"
45 #include "GMSHPlugin_Defs.hxx"
46 #include "SMESH_Algo.hxx"
55 //class TopTools_DataMapOfShapeShape;
56 //class TopTools_IndexedMapOfShape;
57 class GMSHPlugin_Hypothesis;
60 //=============================================================================
62 * \brief This class calls the GMSH mesher of OCC geometry
64 //=============================================================================
66 class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher
69 // ---------- PUBLIC METHODS ----------
71 GMSHPlugin_Mesher (SMESH_Mesh* mesh, const TopoDS_Shape& aShape, bool is2D, bool is3D);
73 void SetParameters(const GMSHPlugin_Hypothesis* hyp);
77 bool Evaluate(MapShapeNbElems& aResMap);
79 static float DistBoundingBox(const SBoundingBox3d& bounds, const SPoint3& point);
85 const TopoDS_Shape& _shape;
95 double _minSize, _maxSize;
96 bool _secondOrder, _useIncomplElem;
100 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
103 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
104 double _meshCurvatureSize;
107 std::set<std::string> _compounds;
109 std::map< const MVertex *, const SMDS_MeshNode* > _nodeMap;
111 const SMDS_MeshNode* Node( const MVertex* v );
112 SMESHDS_SubMesh* HasSubMesh( const TopoDS_Shape& s );
114 void SetGmshOptions();
115 void CreateGmshCompounds();
117 void HideComputedEntities( GModel* gModel );
118 void RestoreVisibility( GModel* gModel );
119 void Set1DSubMeshes( GModel* );
120 void Set2DSubMeshes( GModel* );
121 void toPython( GModel* );
122 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
123 void SetMaxThreadsGmsh();
124 void SetCompoundMeshVisibility();
126 class mymsg : public GmshMessage
131 mymsg(GModel* _gModel) : GmshMessage(), _gModel(_gModel) {}
132 void operator()(std::string level, std::string msg);