fastwater.general.meshTools module¶
Functions for the manipulation and interpolation of data on unstructured triangular meshes.
- fastwater.general.meshTools.getBarycentricWeights(p1, p2, p3, p)[source]¶
Calculate Barycentric weights for point p within triangle (p1,p2,p3)
- Parameters
- Returns
[w1, w2 ,w3] – barycentric weights for triangle (p1, p2, p3).
- Return type
- fastwater.general.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 – centroid Barycentric weights for triangle (p1, p2, p3).
- Return type
- fastwater.general.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]).
- fastwater.general.meshTools.getTriangleArea(p1, p2, p3)[source]¶
Calculate area of the triangle defined by the points (p1, p2, p3)
- fastwater.general.meshTools.getTriangleCentroid(p1, p2, p3)[source]¶
Calculate the centroid location for the triangle defined by the points (p1, p2, p3)
- Parameters
- Returns
centroid – centroid location for the triangle (p1, p2, p3).
- Return type
- fastwater.general.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 – interpolated variable value at point p.
- Return type