NaiveEnclosingSimplex¶
- class NaiveEnclosingSimplex(*args)¶
Naive implementation of point location.
This class implements a naive implementation of point location, by looking into all its simplices. It works well for convex domains, but may be slow otherwise.
- Available constructors:
NaiveEnclosingSimplex(vertices, simplices)
- Parameters:
- vertices
Sample
Vertices.
- simplices
IndicesCollection
Simplices.
- vertices
See also
Notes
In order to speed-up point location, a first pass is performed by looping over all simplices containing the nearest point. If query point is not found in those simplices, then all simplices are looked for.
Examples
>>> import openturns as ot >>> mesher = ot.IntervalMesher([5, 10]) >>> lowerbound = [0.0, 0.0] >>> upperBound = [2.0, 4.0] >>> interval = ot.Interval(lowerbound, upperBound) >>> mesh = mesher.build(interval) >>> locator = ot.NaiveEnclosingSimplex(mesh.getVertices(), mesh.getSimplices()) >>> simplex = locator.query([0.1, 0.2])
Methods
Accessor to the object's name.
getId
()Accessor to the object's id.
getName
()Accessor to the object's name.
Accessor to the nearest neighbour algorithm.
Accessor to the object's shadowed id.
Collection of simplex accessor.
Collection of vertices accessor.
Accessor to the object's visibility state.
hasName
()Test if the object is named.
Test if the object has a distinguishable name.
query
(*args)Get the index of the enclosing simplex of the given point.
setName
(name)Accessor to the object's name.
setNearestNeighbourAlgorithm
(nearestNeighbour)Accessor to the nearest neighbour algorithm.
setShadowedId
(id)Accessor to the object's shadowed id.
setVerticesAndSimplices
(vertices, simplices)Rebuild a new data structure for these vertices and simplices.
setVisibility
(visible)Accessor to the object's visibility state.
- __init__(*args)¶
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- 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.
- getNearestNeighbourAlgorithm()¶
Accessor to the nearest neighbour algorithm.
- Returns:
- nearestNeighbour
NearestNeighbourAlgorithm
Algorithm used during first pass to locate the nearest point.
- nearestNeighbour
- getShadowedId()¶
Accessor to the object’s shadowed id.
- Returns:
- idint
Internal unique identifier.
- getSimplices()¶
Collection of simplex accessor.
- Returns:
- simplices
IndicesCollection
Collection of simplices.
- simplices
- 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.
- query(*args)¶
Get the index of the enclosing simplex of the given point.
- Available usages:
query(point)
query(sample)
- Parameters:
- pointsequence of float
Given point.
- sample2-d sequence of float
Given points.
- Returns:
- indexint
If point is enclosed in a simplex, return its index; otherwise return an int which is at least greater than the number of simplices.
- indices
Indices
Index of enclosing simplex of each point of the sample. If there is no enclosing simplex, value is an int which is at least greater than the number of simplices.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setNearestNeighbourAlgorithm(nearestNeighbour)¶
Accessor to the nearest neighbour algorithm.
- Parameters:
- nearestNeighbour
NearestNeighbourAlgorithm
Algorithm to use during first pass to locate the nearest point.
- nearestNeighbour
- setShadowedId(id)¶
Accessor to the object’s shadowed id.
- Parameters:
- idint
Internal unique identifier.
- setVerticesAndSimplices(vertices, simplices)¶
Rebuild a new data structure for these vertices and simplices.
- Parameters:
- vertices
Sample
Vertices.
- simplices
IndicesCollection
Simplices.
- vertices
- setVisibility(visible)¶
Accessor to the object’s visibility state.
- Parameters:
- visiblebool
Visibility flag.