1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
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
21 // File : HexoticPlugin_Hexotic.hxx
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
25 #ifndef _HexoticPlugin_Hexotic_HXX_
26 #define _HexoticPlugin_Hexotic_HXX_
28 #include "HexoticPlugin_Defs.hxx"
29 #include "HexoticPlugin_Hypothesis.hxx"
31 #include "SMESH_Algo.hxx"
32 #include "SMESH_Mesh.hxx"
33 #include "Utils_SALOME_Exception.hxx"
35 #ifdef WITH_BLSURFPLUGIN
36 #include "BLSURFPlugin_Hypothesis.hxx"
41 #include "DriverGMF_Read.hxx"
42 #include "DriverGMF_Write.hxx"
44 #include <SALOMEconfig.h>
45 #include CORBA_CLIENT_HEADER(GEOM_Gen)
46 #include <SMESH_Gen_i.hxx>
49 class HexoticPlugin_Hypothesis;
50 class TCollection_AsciiString;
53 class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hexotic: public SMESH_3D_Algo
56 HexoticPlugin_Hexotic(int hypId, int studyId, SMESH_Gen* gen);
57 virtual ~HexoticPlugin_Hexotic();
59 #ifdef WITH_BLSURFPLUGIN
60 bool CheckBLSURFHypothesis(SMESH_Mesh& aMesh,
61 const TopoDS_Shape& aShape);
64 virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
65 const TopoDS_Shape& aShape,
66 SMESH_Hypothesis::Hypothesis_Status& aStatus);
68 void SetParameters(const HexoticPlugin_Hypothesis* hyp);
70 virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
72 virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
74 virtual void CancelCompute();
75 bool computeCanceled() { return _compute_canceled;};
77 virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
78 MapShapeNbElems& aResMap);
81 const HexoticPlugin_Hypothesis* _hypothesis;
85 std::string getHexoticCommand(const TCollection_AsciiString& Hexotic_In,
86 const TCollection_AsciiString& Hexotic_Out,
87 const TCollection_AsciiString& Hexotic_Sol) const;
89 GEOM::GEOM_Object_var entryToGeomObj(std::string entry);
90 TopoDS_Shape entryToShape(std::string entry);
92 std::vector<std::string> writeSizeMapFile(std::string fileName);
94 // Functions to get sample point from shapes
95 void createControlPoints( const TopoDS_Shape& theShape,
96 const double& theSize,
97 std::vector< Control_Pnt >& thePoints );
98 void createPointsSampleFromEdge( const TopoDS_Shape& aShape,
99 const double& theSize,
100 std::vector<Control_Pnt>& thePoints );
101 void createPointsSampleFromFace( const TopoDS_Shape& aShape,
102 const double& theSize,
103 std::vector<Control_Pnt>& thePoints );
104 void createPointsSampleFromSolid( const TopoDS_Shape& aShape,
105 const double& theSize,
106 std::vector<Control_Pnt>& thePoints );
108 // Some functions for surface sampling
109 void subdivideTriangle( const gp_Pnt& p1,
112 const double& theSize,
113 std::vector<Control_Pnt>& thePoints );
115 std::vector<gp_Pnt> computePointsForSplitting( const gp_Pnt& p1,
118 gp_Pnt tangencyPoint(const gp_Pnt& p1,
120 const gp_Pnt& Center);
127 double _hexesMinSize;
128 double _hexesMaxSize;
129 bool _hexoticIgnoreRidges;
130 bool _hexoticInvalidElements;
131 bool _hexoticFilesKept;
132 int _hexoticSharpAngleThreshold;
134 std::string _hexoticWorkingDirectory;
135 int _hexoticVerbosity;
136 int _hexoticMaxMemory;
138 HexoticPlugin_Hypothesis::THexoticSizeMaps _sizeMaps;
139 SMDS_MeshNode** _tabNode;
141 #ifdef WITH_BLSURFPLUGIN
142 const BLSURFPlugin_Hypothesis* _blsurfHypo;
146 volatile bool _compute_canceled;
148 SALOMEDS::Study_var myStudy;
149 SMESH_Gen_i* smeshGen_i;