LevelSetMesher

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

../../_images/LevelSetMesher.png
class LevelSetMesher(*args)

Creation of mesh of box type.

Available constructor:

LevelSetMesher(discretization)

Parameters
discretizationsequence of int, of dimension \leq 3.

Discretization of the level set bounding box.

solverOptimizationAlgorithm

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, ot.LessOrEqual(), level)
>>> mesh = mesher.build(levelSet, ot.Interval([-2.0]*2, [2.0]*2))

Methods

build(self, \*args)

Build the mesh of level set type.

getClassName(self)

Accessor to the object’s name.

getDiscretization(self)

Accessor to the discretization.

getId(self)

Accessor to the object’s id.

getName(self)

Accessor to the object’s name.

getOptimizationAlgorithm(self)

Accessor to the optimization solver.

getShadowedId(self)

Accessor to the object’s shadowed id.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

setDiscretization(self, discretization)

Accessor to the discretization.

setName(self, name)

Accessor to the object’s name.

setOptimizationAlgorithm(self, solver)

Accessor to the optimization solver.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, *args)

Initialize self. See help(type(self)) for accurate signature.

build(self, *args)

Build the mesh of level set type.

Parameters
levelSetLevelSet

The level set to be meshed, of dimension equal to the dimension of discretization.

boundingBoxInterval

The bounding box used to mesh the level set.

projectbool

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
meshMesh

The mesh built.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getDiscretization(self)

Accessor to the discretization.

Returns
discretizationIndices

Discretization of the bounding box of the level sets.

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOptimizationAlgorithm(self)

Accessor to the optimization solver.

Returns
solverOptimizationAlgorithm

The optimization solver used to project vertices onto the level set.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

setDiscretization(self, discretization)

Accessor to the discretization.

Parameters
discretizationsequence of int

Discretization of the bounding box of the level sets.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setOptimizationAlgorithm(self, solver)

Accessor to the optimization solver.

Parameters
solverOptimizationAlgorithm

The optimization solver used to project vertices onto the level set.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.