Salome HOME
89f4d84a5a74d61673ad36ba0b5995fbeecd2f0a
[plugins/ghs3dprlplugin.git] / src / GHS3DPRLPlugin / GHS3DPRLPluginBuilder.py
1 # Copyright (C) 2007-2016  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, or (at your option) any later version.
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 MG-Tetra_HPC 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 MG-Tetra_HPC
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: MG-Tetra_HPC tetrahedron 3D algorithm, see GHS3DPRL_Algorithm
46 MG_Tetra_HPC = "MG-Tetra Parallel"
47 MG_Tetra_Parallel = MG_Tetra_HPC
48 GHS3DPRL          = MG_Tetra_HPC
49
50 #----------------------------
51 # Algorithms
52 #----------------------------
53
54 ## Tetrahedron MG-Tetra_HPC 3D algorithm
55 #
56 #  It can be created by calling smeshBuilder.Mesh.Tetrahedron( smeshBuilder.MG_Tetra_HPC )
57 class GHS3DPRL_Algorithm(Mesh_Algorithm):
58
59     ## name of the dynamic method in smeshBuilder.Mesh class
60     #  @internal
61     meshMethod = "Tetrahedron"
62     ## type of algorithm used with helper function in smeshBuilder.Mesh class
63     #  @internal
64     algoType   = MG_Tetra_HPC
65     ## doc string of the method in smeshBuilder.Mesh class
66     #  @internal
67     docHelper  = "Creates tetrahedron 3D algorithm for volumes"
68
69     ## Private constructor.
70     #  @param mesh parent mesh object algorithm is assigned to
71     #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
72     #              if it is @c 0 (default), the algorithm is assigned to the main shape
73     def __init__(self, mesh, geom=0):
74         Mesh_Algorithm.__init__(self)
75         if noGHS3DPRLPlugin: print("Warning: GHS3DPRLPlugin module unavailable")
76         self.Create(mesh, geom, self.algoType, "libGHS3DPRLEngine.so")
77         self.params = None
78         pass
79
80     ## Defines hypothesis having several parameters
81     #  @return hypothesis object
82     def Parameters(self):
83         if not self.params:
84             self.params = self.Hypothesis("MG-Tetra Parallel Parameters", [],
85                                           "libGHS3DPRLEngine.so", UseExisting=0)
86             pass
87         return self.params
88
89     ## To keep working files or remove them. Log file remains in case of errors anyway.
90     #  @param toKeep "keep working files" flag value
91     def SetKeepFiles(self, toKeep):
92         self.Parameters().SetKeepFiles(toKeep)
93         pass
94     
95     ## Sets MED files name and path.
96     #  @param value MED file name
97     def SetMEDName(self, value):
98         self.Parameters().SetMEDName(value)
99         pass
100
101     ## Sets the number of partition of the initial mesh
102     #  @param value number of partition value
103     def SetNbPart(self, value):
104         self.Parameters().SetNbPart(value)
105         pass
106
107     ## When big mesh, start tetra_hpc in background
108     #  @param value "background mode" flag value
109     def SetBackground(self, value):
110         self.Parameters().SetBackground(value)
111         pass
112
113     ## use multithread version
114     #  @param value "multithread mode" flag value
115     def SetMultithread(self, value):
116         self.Parameters().SetMultithread(value)
117         pass
118
119     ## To mesh "holes" in a solid or not. Default is to mesh.
120     #  @param toMesh "mesh holes" flag value
121     #def SetToMeshHoles(self, toMesh):
122     #    self.Parameters().SetToMeshHoles(toMesh)
123     #    pass
124     
125     ## Sets the neigbour cell gradation of the initial mesh
126     #  @param value number of partition value
127     def SetGradation(self, value):
128         self.Parameters().SetGradation(value)
129         pass
130
131     ## Sets the cell min size of the initial mesh
132     #  @param value number of partition value
133     def SetMinSize(self, value):
134         self.Parameters().SetMinSize(value)
135         pass
136
137     ## Sets the cell max size of the initial mesh
138     #  @param value number of partition value
139     def SetMaxSize(self, value):
140         self.Parameters().SetMaxSize(value)
141         pass
142     
143     ## Sets command line option as text.
144     #  @param option command line option
145     def SetAdvancedOption(self, option):
146         self.Parameters().SetAdvancedOption(option)
147         pass
148
149     pass # end of GHS3DPRL_Algorithm class