Salome HOME
PR: adaptation to new geometry and mesh packaging (geomBuilder, smeshBuilder)
[plugins/ghs3dprlplugin.git] / src / GHS3DPRLPlugin / GHS3DPRLPluginBuilder.py
1 # Copyright (C) 2007-2013  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 # @package GHS3DPRLPluginBuilder
22 # Python API for the GHS3DPRL meshing plug-in module.
23
24 from salome.smesh.smesh_algorithm import Mesh_Algorithm
25 from salome.smesh.smeshBuilder import AssureGeomPublished
26
27 # import GHS3DPRLPlugin module if possible
28 noGHS3DPRLPlugin = 0
29 try:
30     import GHS3DPRLPlugin
31 except ImportError:
32     noGHS3DPRLPlugin = 1
33     pass
34
35 # Optimization level of GHS3D
36 # V3.1
37 None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3
38 # V4.1 (partialy redefines V3.1). Issue 0020574
39 None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
40
41 #----------------------------
42 # Mesh algo type identifiers
43 #----------------------------
44
45 ## Algorithm type: GHS3DPRL tetrahedron 3D algorithm, see GHS3DPRL_Algorithm
46 GHS3DPRL = "GHS3DPRL_3D"
47
48 #----------------------------
49 # Algorithms
50 #----------------------------
51
52 ## Tetrahedron GHS3DPRL 3D algorithm
53 #
54 #  It is created by calling smesh.Mesh.Tetrahedron( smesh.GHS3DPRL, geom=0 )
55 class GHS3DPRL_Algorithm(Mesh_Algorithm):
56
57     ## name of the dynamic method in smesh.Mesh class
58     #  @internal
59     meshMethod = "Tetrahedron"
60     ## type of algorithm used with helper function in smesh.Mesh class
61     #  @internal
62     algoType   = GHS3DPRL
63     ## doc string of the method in smesh.Mesh class
64     #  @internal
65     docHelper  = "Creates tetrahedron 3D algorithm for volumes"
66
67     ## Private constructor.
68     #  @param mesh parent mesh object algorithm is assigned to
69     #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
70     #              if it is @c 0 (default), the algorithm is assigned to the main shape
71     def __init__(self, mesh, geom=0):
72         Mesh_Algorithm.__init__(self)
73         if noGHS3DPRLPlugin: print "Warning: GHS3DPRLPlugin module unavailable"
74         self.Create(mesh, geom, self.algoType, "libGHS3DPRLEngine.so")
75         pass
76
77     ## Defines hypothesis having several parameters
78     #  @return hypothesis object
79     def Parameters(self):
80         if not self.params:
81             self.params = self.Hypothesis("GHS3DPRL_Parameters", [],
82                                           "libGHS3DPRLEngine.so", UseExisting=0)
83             pass
84         return self.params
85
86     ## To keep working files or remove them. Log file remains in case of errors anyway.
87     #  @param toKeep "keep working files" flag value
88     def SetKeepFiles(self, toKeep):
89         self.Parameters().SetKeepFiles(toKeep)
90         pass
91     
92     ## Sets MED files name and path.
93     #  @param value MED file name
94     def SetMEDName(self, value):
95         self.Parameters().SetMEDName(value)
96         pass
97
98     ## Sets the number of partition of the initial mesh
99     #  @param value number of partition value
100     def SetNbPart(self, value):
101         self.Parameters().SetNbPart(value)
102         pass
103
104     ## When big mesh, start tepal in background
105     #  @param value "background mode" flag value
106     def SetBackground(self, value):
107         self.Parameters().SetBackground(value)
108         pass
109
110     ## To mesh "holes" in a solid or not. Default is to mesh.
111     #  @param toMesh "mesh holes" flag value
112     def SetToMeshHoles(self, toMesh):
113         self.Parameters().SetToMeshHoles(toMesh)
114         pass
115     
116     pass # end of GHS3DPRL_Algorithm class