]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx
Salome HOME
Merge from BR_EDF_PAL_1456
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_BLSURF.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D
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.
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 // ---
21 // File    : BLSURFPlugin_BLSURF.hxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 //           & Aurelien ALLEAUME (DISTENE)
24 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
25 // ---
26 //
27 #ifndef _BLSURFPlugin_BLSURF_HXX_
28 #define _BLSURFPlugin_BLSURF_HXX_
29
30 #include <TopoDS.hxx>
31 #include <TopoDS_Vertex.hxx>
32 #include <TopoDS_Edge.hxx>
33 #include <TopoDS_Wire.hxx>
34 #include <TopoDS_Face.hxx>
35 #include <TopoDS_Shape.hxx>
36
37 #include <Python.h>
38 #include "SMESH_2D_Algo.hxx"
39 #include "SMESH_Mesh.hxx"
40 #include <SMESHDS_Mesh.hxx>
41 #include <SMDS_MeshElement.hxx>
42 #include <SMDS_MeshNode.hxx>
43 #include <SMESH_Gen_i.hxx>
44 #include <SALOMEconfig.h>
45 #include CORBA_CLIENT_HEADER(SALOMEDS)
46 #include CORBA_CLIENT_HEADER(GEOM_Gen)
47 #include "Utils_SALOME_Exception.hxx"
48
49 extern "C"{
50 #include "distene/blsurf.h"
51 #include "distene/api.h"
52 }
53
54 #include <BRepClass_FaceClassifier.hxx>
55 #include <BRepAdaptor_Surface.hxx>
56 #include <BRepTools.hxx>
57 #include <BRepAdaptor_HSurface.hxx>
58
59 #include "BLSURFPlugin_Hypothesis.hxx"
60
61 class TopoDS_Shape;
62
63 class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
64   public:
65     BLSURFPlugin_BLSURF(int hypId, int studyId, SMESH_Gen* gen);
66
67     virtual ~BLSURFPlugin_BLSURF();
68
69     virtual bool CheckHypothesis(SMESH_Mesh&                          aMesh,
70                                  const TopoDS_Shape&                  aShape,
71                                  SMESH_Hypothesis::Hypothesis_Status& aStatus);
72
73     void SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsurf_session_t *bls,SMESH_Mesh& aMesh);
74
75     virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
76
77     virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
78                           MapShapeNbElems& aResMap);
79
80     ostream & SaveTo(ostream & save);
81     istream & LoadFrom(istream & load);
82     friend ostream & operator << (ostream & save, BLSURFPlugin_BLSURF & hyp);
83     friend istream & operator >> (istream & load, BLSURFPlugin_BLSURF & hyp);
84
85   protected:
86     const BLSURFPlugin_Hypothesis* _hypothesis;
87
88   private:
89     TopoDS_Shape entryToShape(std::string entry);
90     void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList);
91     void Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* node, const TopoDS_Shape& ed);
92     void BRepClass_FaceClassifierPerform(BRepClass_FaceClassifier* fc, const TopoDS_Face& face, const gp_Pnt& P, const Standard_Real Tol);
93
94   private:
95       PyObject *          main_mod;
96       PyObject *          main_dict;
97       SALOMEDS::Study_var myStudy;
98       SMESH_Gen_i*        smeshGen_i;
99 };
100
101 #endif