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(*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.

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.

setShadowedId(id)

Accessor to the object’s shadowed id.

setVisibility(visible)

Accessor to the object’s visibility state.

__init__(*args)

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

build(*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()

Accessor to the object’s name.

Returns
class_namestr

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

getDiscretization()

Accessor to the discretization.

Returns
discretizationIndices

Discretization of the bounding box of the level sets.

getId()

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOptimizationAlgorithm()

Accessor to the optimization solver.

Returns
solverOptimizationAlgorithm

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

getShadowedId()

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

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

setDiscretization(discretization)

Accessor to the discretization.

Parameters
discretizationsequence of int

Discretization of the bounding box of the level sets.

setName(name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setOptimizationAlgorithm(solver)

Accessor to the optimization solver.

Parameters
solverOptimizationAlgorithm

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

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.