[SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D-2D-3D

Add new NETGEN parameters to Mesh_Triangle and Mesh_Tetrahedron algorithms
This commit is contained in:
eap 2008-09-16 08:59:29 +00:00
parent 006cdf3b49
commit 9b15ba1413

View File

@ -112,6 +112,8 @@ except ImportError:
REGULAR = 1 REGULAR = 1
PYTHON = 2 PYTHON = 2
COMPOSITE = 3 COMPOSITE = 3
SOLE = 0
SIMPLE = 1
MEFISTO = 3 MEFISTO = 3
NETGEN = 4 NETGEN = 4
@ -3185,11 +3187,10 @@ class Mesh_Triangle(Mesh_Algorithm):
if self.algoType == MEFISTO or self.algoType == NETGEN_2D: if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting, hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
CompareMethod=self.CompareMaxElementArea) CompareMethod=self.CompareMaxElementArea)
elif self.algoType == NETGEN:
hyp = self.Parameters(SIMPLE)
hyp.SetMaxElementArea(area) hyp.SetMaxElementArea(area)
return hyp return hyp
elif self.algoType == NETGEN:
print "Netgen 1D-2D algo doesn't support this hypothesis"
return None
## Checks if the given "MaxElementArea" hypothesis has the same parameters as the given arguments ## Checks if the given "MaxElementArea" hypothesis has the same parameters as the given arguments
def CompareMaxElementArea(self, hyp, args): def CompareMaxElementArea(self, hyp, args):
@ -3205,8 +3206,9 @@ class Mesh_Triangle(Mesh_Algorithm):
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp) hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
return hyp return hyp
elif self.algoType == NETGEN: elif self.algoType == NETGEN:
print "Netgen 1D-2D algo doesn't support this hypothesis" hyp = self.Parameters(SIMPLE)
return None hyp.LengthFromEdges()
return hyp
## Sets a way to define size of mesh elements to generate. ## Sets a way to define size of mesh elements to generate.
# @param thePhysicalMesh is: DefaultSize or Custom. # @param thePhysicalMesh is: DefaultSize or Custom.
@ -3320,22 +3322,25 @@ class Mesh_Triangle(Mesh_Algorithm):
self.params.SetQuadAllowed(toAllow) self.params.SetQuadAllowed(toAllow)
return return
## Defines "Netgen 2D Parameters" hypothesis ## Defines hypothesis having several parameters
# #
# @ingroup l3_hypos_netgen # @ingroup l3_hypos_netgen
def Parameters(self): def Parameters(self, which=SOLE):
# Only for algoType == NETGEN
if self.params: if self.params:
return self.params return self.params
if self.algoType == NETGEN: if self.algoType == NETGEN:
if which == SIMPLE:
self.params = self.Hypothesis("NETGEN_SimpleParameters_2D", [],
"libNETGENEngine.so", UseExisting=0)
else:
self.params = self.Hypothesis("NETGEN_Parameters_2D", [], self.params = self.Hypothesis("NETGEN_Parameters_2D", [],
"libNETGENEngine.so", UseExisting=0) "libNETGENEngine.so", UseExisting=0)
return self.params return self.params
elif self.algoType == MEFISTO: elif self.algoType == MEFISTO:
print "Mefisto algo doesn't support NETGEN_Parameters_2D hypothesis" print "Mefisto algo support no multi-parameter hypothesis"
return None return None
elif self.algoType == NETGEN_2D: elif self.algoType == NETGEN_2D:
print "NETGEN_2D_ONLY algo doesn't support 'NETGEN_Parameters_2D' hypothesis" print "NETGEN_2D_ONLY algo support no multi-parameter hypothesis"
print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones" print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
return None return None
elif self.algoType == BLSURF: elif self.algoType == BLSURF:
@ -3402,6 +3407,20 @@ class Mesh_Triangle(Mesh_Algorithm):
if self.Parameters(): if self.Parameters():
self.params.SetNbSegPerRadius(theVal) self.params.SetNbSegPerRadius(theVal)
## Sets number of segments overriding value set by SetLocalLength()
#
# Only for algoType == NETGEN
# @ingroup l3_hypos_netgen
def SetNumberOfSegments(self, theVal):
self.Parameters(SIMPLE).SetNumberOfSegments(theVal)
## Sets number of segments overriding value set by SetNumberOfSegments()
#
# Only for algoType == NETGEN
# @ingroup l3_hypos_netgen
def SetLocalLength(self, theVal):
self.Parameters(SIMPLE).SetLocalLength(theVal)
pass pass
@ -3476,30 +3495,39 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
# the same parameters, else (default) - creates a new one # the same parameters, else (default) - creates a new one
# @ingroup l3_hypos_maxvol # @ingroup l3_hypos_maxvol
def MaxElementVolume(self, vol, UseExisting=0): def MaxElementVolume(self, vol, UseExisting=0):
if self.algoType == NETGEN:
hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting, hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting,
CompareMethod=self.CompareMaxElementVolume) CompareMethod=self.CompareMaxElementVolume)
hyp.SetMaxElementVolume(vol) hyp.SetMaxElementVolume(vol)
return hyp return hyp
elif self.algoType == FULL_NETGEN:
self.Parameters(SIMPLE).SetMaxElementVolume(vol)
return None
## Checks if the given "MaxElementVolume" hypothesis has the same parameters as the given arguments ## Checks if the given "MaxElementVolume" hypothesis has the same parameters as the given arguments
def CompareMaxElementVolume(self, hyp, args): def CompareMaxElementVolume(self, hyp, args):
return IsEqual(hyp.GetMaxElementVolume(), args[0]) return IsEqual(hyp.GetMaxElementVolume(), args[0])
## Defines "Netgen 3D Parameters" hypothesis ## Defines hypothesis having several parameters
#
# @ingroup l3_hypos_netgen # @ingroup l3_hypos_netgen
def Parameters(self): def Parameters(self, which=SOLE):
if self.params: if self.params:
return self.params return self.params
if (self.algoType == FULL_NETGEN): if self.algoType == FULL_NETGEN:
if which == SIMPLE:
self.params = self.Hypothesis("NETGEN_SimpleParameters_3D", [],
"libNETGENEngine.so", UseExisting=0)
else:
self.params = self.Hypothesis("NETGEN_Parameters", [], self.params = self.Hypothesis("NETGEN_Parameters", [],
"libNETGENEngine.so", UseExisting=0) "libNETGENEngine.so", UseExisting=0)
return self.params return self.params
if (self.algoType == GHS3D): if self.algoType == GHS3D:
self.params = self.Hypothesis("GHS3D_Parameters", [], self.params = self.Hypothesis("GHS3D_Parameters", [],
"libGHS3DEngine.so", UseExisting=0) "libGHS3DEngine.so", UseExisting=0)
return self.params return self.params
print "Algo doesn't support this hypothesis" print "Algo support no multi-parameter hypothesis"
return None return None
## Sets MaxSize ## Sets MaxSize
@ -3546,6 +3574,39 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
def SetNbSegPerRadius(self, theVal): def SetNbSegPerRadius(self, theVal):
self.Parameters().SetNbSegPerRadius(theVal) self.Parameters().SetNbSegPerRadius(theVal)
## Sets number of segments overriding value set by SetLocalLength()
# Only for algoType == NETGEN_FULL
# @ingroup l3_hypos_netgen
def SetNumberOfSegments(self, theVal):
self.Parameters(SIMPLE).SetNumberOfSegments(theVal)
## Sets number of segments overriding value set by SetNumberOfSegments()
# Only for algoType == NETGEN_FULL
# @ingroup l3_hypos_netgen
def SetLocalLength(self, theVal):
self.Parameters(SIMPLE).SetLocalLength(theVal)
## Defines "MaxElementArea" parameter of NETGEN_SimpleParameters_3D hypothesis.
# Overrides value set by LengthFromEdges()
# Only for algoType == NETGEN_FULL
# @ingroup l3_hypos_netgen
def MaxElementArea(self, area):
self.Parameters(SIMPLE).SetMaxElementArea(area)
## Defines "LengthFromEdges" parameter of NETGEN_SimpleParameters_3D hypothesis
# Overrides value set by MaxElementArea()
# Only for algoType == NETGEN_FULL
# @ingroup l3_hypos_netgen
def LengthFromEdges(self):
self.Parameters(SIMPLE).LengthFromEdges()
## Defines "LengthFromFaces" parameter of NETGEN_SimpleParameters_3D hypothesis
# Overrides value set by MaxElementVolume()
# Only for algoType == NETGEN_FULL
# @ingroup l3_hypos_netgen
def LengthFromFaces(self):
self.Parameters(SIMPLE).LengthFromFaces()
## To mesh "holes" in a solid or not. Default is to mesh. ## To mesh "holes" in a solid or not. Default is to mesh.
# @ingroup l3_hypos_ghs3dh # @ingroup l3_hypos_ghs3dh
def SetToMeshHoles(self, toMesh): def SetToMeshHoles(self, toMesh):