ocmw.core.meshTools module¶
Functions for the manipulation and interpolation of data on unstructured triangular meshes.
Calculate Barycentric weights for point p within triangle (p1,p2,p3) |
|
Calculate area of the triangle defined by the points (p1, p2, p3) |
|
Calculate the centroid location for the triangle defined by the points (p1, p2, p3) |
|
Determine if the point p lies with in the triangle defeind by (p1, p2, p3) |
|
Use Barycentic weighting to interpolate variable data (v1, v2, v3) on triangle corner points (p1, p2, p3) onto the location p. |
|
Identify themesh element that contians the location [LocX,LocY] |
|
Get the mesh nodes of the element that contains the location [LocX,LocY] |
|
Get the nearest mesh node to the location [LocX,LocY] |
|
Get all mesh nodes that a connected to a specific mesh node. |
|
Convert a set of node barycentric weights to matrix for layered models. |
|
Calculate Barycentric weights for interpolating data on the centroid of the triange defined by the points (p1, p2, p3) |
|
Extract the information required to interpolate mesh data onto a specific location defined by the point (LocX, LocY) |
|
Calculate spatial gradient of a variable at a model node. |
|
Calculate mesh local mesh density based on element area |
Functions for the manipulation and interpolation of data on unstructured triangular meshes.
- ocmw.core.meshTools.getBarycentricWeights(p1, p2, p3, p)[source]¶
Calculate Barycentric weights for point p within triangle (p1,p2,p3)
- Parameters:
- Returns:
[w1, w2 ,w3] (list) – barycentric weights for triangle (p1, p2, p3).
- ocmw.core.meshTools.getTriangleArea(p1, p2, p3)[source]¶
Calculate area of the triangle defined by the points (p1, p2, p3)
- ocmw.core.meshTools.getTriangleCentroid(p1, p2, p3)[source]¶
Calculate the centroid location for the triangle defined by the points (p1, p2, p3)
- Parameters:
- Returns:
centroid (list[ float ]) – centroid location for the triangle (p1, p2, p3).
- ocmw.core.meshTools.isInsideTriangle(p1, p2, p3, p)[source]¶
Determine if the point p lies with in the triangle defeind by (p1, p2, p3)
- Parameters:
- Returns:
isInside (bool) – True/False flag defining whether p is inside (p1, p2, p3).
- ocmw.core.meshTools.interpTriangle(p1, p2, p3, p, v1, v2, v3)[source]¶
Use Barycentic weighting to interpolate variable data (v1, v2, v3) on triangle corner points (p1, p2, p3) onto the location p.
- Parameters:
p1 (list[ float ]) – [x, y] coordinates for triangle corner point p1.
p2 (list[ float ]) – [x, y] coordinates for triangle corner point p2.
p3 (list[ float ]) – [x, y] coordinates for triangle corner point p3.
v1 (float) – variable value at point p1.
v2 (floate) – variable value at point p2.
v3 (float) – variable value at point p3.
- Returns:
vp (float) – interpolated variable value at point p.
- ocmw.core.meshTools.getElemAroundLoc(meshx, meshy, meshElems, LocX, LocY, nLys=1)[source]¶
Identify themesh element that contians the location [LocX,LocY]
- ocmw.core.meshTools.getElemNodes(meshx, meshy, elems, LocX, LocY)[source]¶
Get the mesh nodes of the element that contains the location [LocX,LocY]
- ocmw.core.meshTools.getNearestNode(meshX, meshY, locX, locY, nLys=1, exclude=[])[source]¶
Get the nearest mesh node to the location [LocX,LocY]
- ocmw.core.meshTools.getNodesAroundNode(node, edges)[source]¶
Get all mesh nodes that a connected to a specific mesh node.
- ocmw.core.meshTools.weightsMatrix(nodeWghts, nLays)[source]¶
Convert a set of node barycentric weights to matrix for layered models.
- ocmw.core.meshTools.getCentroidWeights(p1, p2, p3)[source]¶
Calculate Barycentric weights for interpolating data on the centroid of the triange defined by the points (p1, p2, p3)
- Parameters:
- Returns:
centroidWghts (list[ float ]) – centroid Barycentric weights for triangle (p1, p2, p3).
- ocmw.core.meshTools.getNodesWeights(meshx, meshy, elems, LocX, LocY)[source]¶
Extract the information required to interpolate mesh data onto a specific location defined by the point (LocX, LocY)
- Parameters:
meshx (numpy.array, float) – mesh nodes x coordinate values.
meshy (numpy.array, float) – mesh nodes y coordinate values.
elems (numpy.ndarray, int) – mesh elements defninition matrix (nElems, 3).
LocX (float) – x coordinate of location of interest.
LocY (flaat) – y coordinate of location of interest.
- Returns:
NNodes (list[ int ]) – node indices of triangular element corner points.
NWghts (list[ float ]) – Barycentric weighting values for triangular element corner points.
NLocs (list[ list ]) – list of the triangular element corner point locations (p1[x,y], p2[x,y] ,p3[x,y]).