1 # Copyright (C) 2007-2013 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.
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 # @package HexoticPLUGINBuilder
22 # Python API for the Hexotic meshing plug-in module.
24 from salome.smesh.smesh_algorithm import Mesh_Algorithm
25 from salome.smesh.smeshBuilder import AssureGeomPublished
27 # import HexoticPlugin module if possible
35 #----------------------------
36 # Mesh algo type identifiers
37 #----------------------------
39 ## Algorithm type: Hexotic hexahedron 3D algorithm, see Hexotic_Algorithm
40 Hexotic = "Hexotic_3D"
42 #----------------------------
44 #----------------------------
46 ## Defines a hexahedron 3D algorithm
48 # It is created by calling smeshBuilder.Mesh.Hexahedron( smeshBuilder.Hexotic, geom=0 )
49 class Hexotic_Algorithm(Mesh_Algorithm):
51 ## name of the dynamic method in smeshBuilder.Mesh class
53 meshMethod = "Hexahedron"
54 ## type of algorithm used with helper function in smeshBuilder.Mesh class
57 ## doc string of the method in smeshBuilder.Mesh class
59 docHelper = "Creates hexahedron 3D algorithm for volumes"
61 ## Private constructor.
62 # @param mesh parent mesh object algorithm is assigned to
63 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
64 # if it is @c 0 (default), the algorithm is assigned to the main shape
65 def __init__(self, mesh, geom=0):
66 Mesh_Algorithm.__init__(self)
67 if noHexoticPlugin: print "Warning: HexoticPlugin module unavailable"
68 self.Create(mesh, geom, Hexotic, "libHexoticEngine.so")
72 ## Defines "SetMinMaxHexes" hypothesis to give two hexotic parameters
73 # @param min minimal level of recursive partitioning on the initial octree cube
74 # @param max maximal level of recursive partitioning on the initial octree cube
75 # @return hypothesis object
76 def SetMinMaxHexes(self, min=3, max=8):
77 self.Parameters().SetHexesMinLevel(min)
78 self.Parameters().SetHexesMaxLevel(max)
79 return self.Parameters()
81 ## Defines "SetMinMaxSize" hypothesis to give two hexotic parameters
82 # @param min minimal element's size
83 # @param max maximal element's size
84 # @return hypothesis object
85 def SetMinMaxSize(self, min, max):
86 self.Parameters().SetMinSize(min)
87 self.Parameters().SetMaxSize(max)
88 return self.Parameters()
91 # @param theObject geometrical object to assign local size to
92 # @param theSize local size on the given object
93 # @return hypothesis object
94 def SetSizeMap(self, theObject, theSize):
95 AssureGeomPublished( self.mesh, theObject )
96 self.Parameters().SetSizeMap(theObject, theSize)
97 return self.Parameters()
99 ## Unsets a size map : this is meant to be used only by the dump
100 # @param theObject geometrical object to unassign local size
101 # @return hypothesis object
102 def UnsetSizeMap(self, theObject, theSize):
103 AssureGeomPublished( self.mesh, theObject )
104 self.Parameters().UnsetSizeMap(theObject)
105 return self.Parameters()
107 ## (OBSOLETE) Defines "MinMaxQuad" hypothesis to give three hexotic parameters
108 # @param min minimal level of recursive partitioning on the initial octree cube
109 # @param max maximal level of recursive partitioning on the initial octree cube
110 # @param quad not documented
111 # @return hypothesis object
112 def MinMaxQuad(self, min=3, max=8, quad=True):
113 print "WARNING: Function MinMaxQuad is deprecated, use SetMinMaxHexes instead"
114 return self.SetMinMaxHexes(min, max)
116 ## Defines hypothesis having several parameters
117 # @return hypothesis object
118 def Parameters(self):
120 self.params = self.Hypothesis("Hexotic_Parameters", [],
121 "libHexoticEngine.so", UseExisting=0)
126 pass # end of Hexotic_Algorithm class