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