LevelSetMesher¶
(Source code, png, hires.png, pdf)

class
LevelSetMesher
(*args)¶ Creation of mesh of box type.
 Available constructor:
 LevelSetMesher(discretization)
Parameters: discretization : sequence of int, of dimension .
Discretization of the level set bounding box.
solver :
OptimizationAlgorithm
Optimization solver used to project the vertices onto the level set. It must be able to solve nearest point problems. Default is
AbdoRackwitz
.Notes
The meshing algorithm is based on the
IntervalMesher
class. First, the bounding box of the level set (provided by the user or automatically computed) is meshed. Then, all the simplices with all vertices outside of the level set are rejected, while the simplices with all vertices inside of the level set are kept. The remaining simplices are adapted the following way : The mean point of the vertices inside of the level set is computed
 Each vertex outside of the level set is projected onto the level set using a linear interpolation
 If the project flag is True, then the projection is refined using an optimization solver.
Examples
Create a mesh:
>>> import openturns as ot >>> mesher = ot.LevelSetMesher([5, 10]) >>> level = 1.0 >>> function = ot.SymbolicFunction(['x0', 'x1'], ['x0^2+x1^2']) >>> levelSet = ot.LevelSet(function, level) >>> mesh = mesher.build(levelSet)
Methods
build
(*args)Build the mesh of level set type. getClassName
()Accessor to the object’s name. getDiscretization
()Accessor to the discretization. getId
()Accessor to the object’s id. getName
()Accessor to the object’s name. getOptimizationAlgorithm
()Accessor to the optimization solver. getOptimizationSolver
()getShadowedId
()Accessor to the object’s shadowed id. getVisibility
()Accessor to the object’s visibility state. hasName
()Test if the object is named. hasVisibleName
()Test if the object has a distinguishable name. setDiscretization
(discretization)Accessor to the discretization. setName
(name)Accessor to the object’s name. setOptimizationAlgorithm
(solver)Accessor to the optimization solver. setOptimizationSolver
(solver)setShadowedId
(id)Accessor to the object’s shadowed id. setVisibility
(visible)Accessor to the object’s visibility state. 
__init__
(*args)¶

build
(*args)¶ Build the mesh of level set type.
Parameters: levelSet :
LevelSet
The level set to be meshed, of dimension equal to the dimension of discretization.
boundingBox :
Interval
The bounding box used to mesh the level set. By default it is automatically computed from the elements of the given level set.
project : bool
Flag to tell if the vertices outside of the level set of a simplex partially included into the level set have to be projected onto the level set. Default is True.
Returns: mesh :
Mesh
The mesh built.

getClassName
()¶ Accessor to the object’s name.
Returns: class_name : str
The object class name (object.__class__.__name__).

getDiscretization
()¶ Accessor to the discretization.
Returns: discretization :
Indices
Discretization of the bounding box of the level sets.

getId
()¶ Accessor to the object’s id.
Returns: id : int
Internal unique identifier.

getName
()¶ Accessor to the object’s name.
Returns: name : str
The name of the object.

getOptimizationAlgorithm
()¶ Accessor to the optimization solver.
Returns: solver :
OptimizationAlgorithm
The optimization solver used to project vertices onto the level set.

getShadowedId
()¶ Accessor to the object’s shadowed id.
Returns: id : int
Internal unique identifier.

getVisibility
()¶ Accessor to the object’s visibility state.
Returns: visible : bool
Visibility flag.

hasName
()¶ Test if the object is named.
Returns: hasName : bool
True if the name is not empty.

hasVisibleName
()¶ Test if the object has a distinguishable name.
Returns: hasVisibleName : bool
True if the name is not empty and not the default one.

setDiscretization
(discretization)¶ Accessor to the discretization.
Parameters: discretization : sequence of int
Discretization of the bounding box of the level sets.

setName
(name)¶ Accessor to the object’s name.
Parameters: name : str
The name of the object.

setOptimizationAlgorithm
(solver)¶ Accessor to the optimization solver.
Parameters: solver :
OptimizationAlgorithm
The optimization solver used to project vertices onto the level set.

setShadowedId
(id)¶ Accessor to the object’s shadowed id.
Parameters: id : int
Internal unique identifier.

setVisibility
(visible)¶ Accessor to the object’s visibility state.
Parameters: visible : bool
Visibility flag.