OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

Foam::triSurfaceTools Namespace Reference


Enumerations

enum  refineType { NONE, RED, GREEN }
enum  sideType { UNKNOWN, INSIDE, OUTSIDE }
 on which side of surface More...

Functions

void writeOBJ (const fileName &fName, const pointField &pts)
 Write pointField to OBJ format file.
void writeOBJ (const triSurface &surf, const fileName &fName, const boolList &markedVerts)
 Write vertex subset to OBJ format file.
void getVertexTriangles (const triSurface &surf, const label edgeI, labelList &edgeTris)
 Get all triangles using edge endpoint.
labelList getVertexVertices (const triSurface &surf, const edge &e)
 Get all vertices (local numbering) connected to vertices of edge.
FixedList< label, 3 > sortedFaceEdges (const triSurface &surf, const label faceI)
 Get all edges of triangle in face ordering (elem 0 is edge between.
void orderVertices (const labelledTri &f, const label v1, const label v2, label &vA, label &vB)
 Order vertices consistent with face.
label otherFace (const triSurface &surf, const label faceI, const label edgeI)
 Get face connected to edge not faceI.
void otherEdges (const triSurface &surf, const label faceI, const label edgeI, label &e1, label &e2)
 Get the two edges on faceI counterclockwise after edgeI.
void otherVertices (const triSurface &surf, const label faceI, const label vertI, label &vert1I, label &vert2I)
 Get the two vertices (local numbering) on faceI counterclockwise vertI.
label oppositeEdge (const triSurface &surf, const label faceI, const label vertI)
 Get edge opposite vertex (local numbering).
label oppositeVertex (const triSurface &surf, const label faceI, const label edgeI)
 Get vertex (local numbering) opposite edge.
label getEdge (const triSurface &surf, const label vert1I, const label vert2I)
 Returns edge label connecting v1, v2 (local numbering).
label getTriangle (const triSurface &surf, const label e0I, const label e1I, const label e2I)
 Return index of triangle (or -1) using all three edges.
label minEdge (const triSurface &surf, const labelList &edgeIndices)
 Returns element in edgeIndices with minimum length.
label maxEdge (const triSurface &surf, const labelList &edgeIndices)
 Returns element in edgeIndices with minimum length.
scalar faceCosAngle (const point &pStart, const point &pEnd, const point &pLeft, const point &pRight)
scalar pseudoAngle (const vector &e0, const vector &e1, const vector &vec)
 Estimate angle of vec in coordinate system (e0, e1, e0^e1).
labelHashSet getCollapsedFaces (const triSurface &surf, label edgeI)
 faces to collapse because of edge collapse
label vertexUsesFace (const triSurface &surf, const labelHashSet &faceUsed, const label vertI)
void getMergedEdges (const triSurface &surf, const label edgeI, const labelHashSet &collapsedFaces, HashTable< label, label, Hash< label > > &edgeToEdge, HashTable< label, label, Hash< label > > &edgeToFace)
scalar edgeCosAngle (const triSurface &surf, const label v1, const point &pt, const labelHashSet &collapsedFaces, const HashTable< label, label, Hash< label > > &edgeToEdge, const HashTable< label, label, Hash< label > > &edgeToFace, const label faceI, const label edgeI)
 Calculates (cos of) angle across edgeI of faceI,.
scalar collapseMinCosAngle (const triSurface &surf, const label v1, const point &pt, const labelHashSet &collapsedFaces, const HashTable< label, label, Hash< label > > &edgeToEdge, const HashTable< label, label, Hash< label > > &edgeToFace)
 Calculate minimum (cos of) edge angle using addressing from collapsing.
bool collapseCreatesFold (const triSurface &surf, const label v1, const point &pt, const labelHashSet &collapsedFaces, const HashTable< label, label, Hash< label > > &edgeToEdge, const HashTable< label, label, Hash< label > > &edgeToFace, const scalar minCos)
 Like collapseMinCosAngle but return true for value < minCos.
void protectNeighbours (const triSurface &surf, const label vertI, labelList &faceStatus)
triSurface collapseEdges (const triSurface &surf, const labelList &collapsableEdges)
 Create new triSurface by collapsing edges to edge mids.
triSurface collapseEdges (const triSurface &surf, const labelList &collapsableEdges, const pointField &edgeMids, labelList &faceStatus)
 Create new triSurface by collapsing edges to specified.
void calcRefineStatus (const triSurface &surf, const label faceI, labelList &refine)
void greenRefine (const triSurface &surf, const label faceI, const label edgeI, const label newPointI, DynamicList< labelledTri > &newFaces)
triSurface greenRefine (const triSurface &surf, const labelList &refineEdges)
 Refine edges by splitting to opposite vertex.
triSurface doRefine (const triSurface &surf, const labelList &refineStatus)
triSurface redGreenRefine (const triSurface &surf, const labelList &refineFaces)
 Refine face by splitting all edges. Neighbouring face is greenRefine'd.
triSurface mergePoints (const triSurface &surf, const scalar mergeTol)
 Merge points within distance.
vector surfaceNormal (const triSurface &surf, const label nearestFaceI, const point &nearestPt)
 Triangle (unit) normal. If nearest point to triangle on edge use edge.
sideType edgeSide (const triSurface &surf, const point &sample, const point &nearestPoint, const label edgeI)
 if nearest point is on edgeI, determine on which side of surface sample
sideType surfaceSide (const triSurface &surf, const point &sample, const label nearestFaceI, const point &nearestPt)
 Given nearest point (to sample) on surface determines which side.
triSurface triangulate (const polyBoundaryMesh &mBesh, const labelHashSet &includePatches, const bool verbose=false)
 Simple triangulation of (selected patches of) boundaryMesh. Needs.
triSurface triangulateFaceCentre (const polyBoundaryMesh &mBesh, const labelHashSet &includePatches, const bool verbose=false)
 Face-centre triangulation of (selected patches of) boundaryMesh. Needs.
void calcInterpolationWeights (const triPointRef &, const point &, FixedList< scalar, 3 > &weights)
 Calculate linear interpolation weights for point (guaranteed to be.
void calcInterpolationWeights (const triSurface &s, const pointField &samplePts, List< FixedList< label, 3 > > &verts, List< FixedList< scalar, 3 > > &weights)
triSurface delaunay2D (const List< vector2D > &)
 Do unconstrained Delaunay of points. Returns triSurface with 3D points.

Variables

static const label ANYEDGE = -1
 Face collapse status.
static const label NOEDGE = -2
static const label COLLAPSED = -3

Enumeration Type Documentation

enum refineType

Enumerator:
NONE 
RED 
GREEN 

Definition at line 341 of file triSurfaceTools.H.

enum sideType

on which side of surface

Enumerator:
UNKNOWN 
INSIDE 
OUTSIDE 

Definition at line 404 of file triSurfaceTools.H.


Function Documentation

void Foam::triSurfaceTools::writeOBJ ( const fileName &  fName,
const pointField &  pts 
)

Write pointField to OBJ format file.

void Foam::triSurfaceTools::writeOBJ ( const triSurface &  surf,
const fileName &  fName,
const boolList &  markedVerts 
)

Write vertex subset to OBJ format file.

void Foam::triSurfaceTools::getVertexTriangles ( const triSurface &  surf,
const label  edgeI,
labelList &  edgeTris 
)

Get all triangles using edge endpoint.

labelList Foam::triSurfaceTools::getVertexVertices ( const triSurface &  surf,
const edge &  e 
)

Get all vertices (local numbering) connected to vertices of edge.

FixedList<label, 3> Foam::triSurfaceTools::sortedFaceEdges ( const triSurface &  surf,
const label  faceI 
)

Get all edges of triangle in face ordering (elem 0 is edge between.

f[0] .. f[1], elem1 between f[1]..f[2] etc)

void Foam::triSurfaceTools::orderVertices ( const labelledTri &  f,
const label  v1,
const label  v2,
label &  vA,
label &  vB 
)

Order vertices consistent with face.

label Foam::triSurfaceTools::otherFace ( const triSurface &  surf,
const label  faceI,
const label  edgeI 
)

Get face connected to edge not faceI.

void Foam::triSurfaceTools::otherEdges ( const triSurface &  surf,
const label  faceI,
const label  edgeI,
label &  e1,
label &  e2 
)

Get the two edges on faceI counterclockwise after edgeI.

void Foam::triSurfaceTools::otherVertices ( const triSurface &  surf,
const label  faceI,
const label  vertI,
label &  vert1I,
label &  vert2I 
)

Get the two vertices (local numbering) on faceI counterclockwise vertI.

label Foam::triSurfaceTools::oppositeEdge ( const triSurface &  surf,
const label  faceI,
const label  vertI 
)

Get edge opposite vertex (local numbering).

label Foam::triSurfaceTools::oppositeVertex ( const triSurface &  surf,
const label  faceI,
const label  edgeI 
)

Get vertex (local numbering) opposite edge.

label Foam::triSurfaceTools::getEdge ( const triSurface &  surf,
const label  vert1I,
const label  vert2I 
)

Returns edge label connecting v1, v2 (local numbering).

label Foam::triSurfaceTools::getTriangle ( const triSurface &  surf,
const label  e0I,
const label  e1I,
const label  e2I 
)

Return index of triangle (or -1) using all three edges.

label Foam::triSurfaceTools::minEdge ( const triSurface &  surf,
const labelList &  edgeIndices 
)

Returns element in edgeIndices with minimum length.

label Foam::triSurfaceTools::maxEdge ( const triSurface &  surf,
const labelList &  edgeIndices 
)

Returns element in edgeIndices with minimum length.

scalar Foam::triSurfaceTools::faceCosAngle ( const point &  pStart,
const point &  pEnd,
const point &  pLeft,
const point &  pRight 
)

scalar Foam::triSurfaceTools::pseudoAngle ( const vector &  e0,
const vector &  e1,
const vector &  vec 
)

Estimate angle of vec in coordinate system (e0, e1, e0^e1).

Is guaranteed to return increasing number but is not correct angle. Used for sorting angles. All input vectors need to be normalized.

labelHashSet Foam::triSurfaceTools::getCollapsedFaces ( const triSurface &  surf,
label  edgeI 
)

faces to collapse because of edge collapse

label Foam::triSurfaceTools::vertexUsesFace ( const triSurface &  surf,
const labelHashSet &  faceUsed,
const label  vertI 
)

void Foam::triSurfaceTools::getMergedEdges ( const triSurface &  surf,
const label  edgeI,
const labelHashSet &  collapsedFaces,
HashTable< label, label, Hash< label > > &  edgeToEdge,
HashTable< label, label, Hash< label > > &  edgeToFace 
)

scalar Foam::triSurfaceTools::edgeCosAngle ( const triSurface &  surf,
const label  v1,
const point &  pt,
const labelHashSet &  collapsedFaces,
const HashTable< label, label, Hash< label > > &  edgeToEdge,
const HashTable< label, label, Hash< label > > &  edgeToFace,
const label  faceI,
const label  edgeI 
)

Calculates (cos of) angle across edgeI of faceI,.

taking into account updated addressing (resulting from edge collapse)

scalar Foam::triSurfaceTools::collapseMinCosAngle ( const triSurface &  surf,
const label  v1,
const point &  pt,
const labelHashSet &  collapsedFaces,
const HashTable< label, label, Hash< label > > &  edgeToEdge,
const HashTable< label, label, Hash< label > > &  edgeToFace 
)

Calculate minimum (cos of) edge angle using addressing from collapsing.

edge to v1 at pt. Returns 1 if v1 is on edge without neighbours (and hence no edge angle can be defined)

bool Foam::triSurfaceTools::collapseCreatesFold ( const triSurface &  surf,
const label  v1,
const point &  pt,
const labelHashSet &  collapsedFaces,
const HashTable< label, label, Hash< label > > &  edgeToEdge,
const HashTable< label, label, Hash< label > > &  edgeToFace,
const scalar  minCos 
)

Like collapseMinCosAngle but return true for value < minCos.

void Foam::triSurfaceTools::protectNeighbours ( const triSurface &  surf,
const label  vertI,
labelList &  faceStatus 
)

triSurface Foam::triSurfaceTools::collapseEdges ( const triSurface &  surf,
const labelList &  collapsableEdges 
)

Create new triSurface by collapsing edges to edge mids.

triSurface Foam::triSurfaceTools::collapseEdges ( const triSurface &  surf,
const labelList &  collapsableEdges,
const pointField &  edgeMids,
labelList &  faceStatus 
)

Create new triSurface by collapsing edges to specified.

positions. faceStatus allows explicit control over which faces need to be protected (see above). faceStatus gets updated to protect collapsing already collapsed faces.

void Foam::triSurfaceTools::calcRefineStatus ( const triSurface &  surf,
const label  faceI,
labelList &  refine 
)

void Foam::triSurfaceTools::greenRefine ( const triSurface &  surf,
const label  faceI,
const label  edgeI,
const label  newPointI,
DynamicList< labelledTri > &  newFaces 
)

triSurface Foam::triSurfaceTools::greenRefine ( const triSurface &  surf,
const labelList &  refineEdges 
)

Refine edges by splitting to opposite vertex.

triSurface Foam::triSurfaceTools::doRefine ( const triSurface &  surf,
const labelList &  refineStatus 
)

triSurface Foam::triSurfaceTools::redGreenRefine ( const triSurface &  surf,
const labelList &  refineFaces 
)

Refine face by splitting all edges. Neighbouring face is greenRefine'd.

triSurface Foam::triSurfaceTools::mergePoints ( const triSurface &  surf,
const scalar  mergeTol 
)

Merge points within distance.

vector Foam::triSurfaceTools::surfaceNormal ( const triSurface &  surf,
const label  nearestFaceI,
const point &  nearestPt 
)

Triangle (unit) normal. If nearest point to triangle on edge use edge.

normal (calculated on the fly); if on vertex use vertex normal. Uses planarTol.

sideType Foam::triSurfaceTools::edgeSide ( const triSurface &  surf,
const point &  sample,
const point &  nearestPoint,
const label  edgeI 
)

if nearest point is on edgeI, determine on which side of surface sample

is.

sideType Foam::triSurfaceTools::surfaceSide ( const triSurface &  surf,
const point &  sample,
const label  nearestFaceI,
const point &  nearestPt 
)

Given nearest point (to sample) on surface determines which side.

sample is. Uses either face normal, edge normal or point normal (non-trivial). Feed in output of e.g. triangle::classify.

triSurface Foam::triSurfaceTools::triangulate ( const polyBoundaryMesh &  mBesh,
const labelHashSet &  includePatches,
const bool  verbose = false 
)

Simple triangulation of (selected patches of) boundaryMesh. Needs.

polyMesh (or polyBoundaryMesh) since only at this level are the triangles on neighbouring patches connected.

triSurface Foam::triSurfaceTools::triangulateFaceCentre ( const polyBoundaryMesh &  mBesh,
const labelHashSet &  includePatches,
const bool  verbose = false 
)

Face-centre triangulation of (selected patches of) boundaryMesh. Needs.

polyMesh (or polyBoundaryMesh) since only at this level are the triangles on neighbouring patches connected.

void Foam::triSurfaceTools::calcInterpolationWeights ( const triPointRef &  ,
const point &  ,
FixedList< scalar, 3 > &  weights 
)

Calculate linear interpolation weights for point (guaranteed to be.

inside triangle)

void Foam::triSurfaceTools::calcInterpolationWeights ( const triSurface &  s,
const pointField &  samplePts,
List< FixedList< label, 3 > > &  verts,
List< FixedList< scalar, 3 > > &  weights 
)

triSurface Foam::triSurfaceTools::delaunay2D ( const List< vector2D > &   ) 

Do unconstrained Delaunay of points. Returns triSurface with 3D points.

with z=0. All triangles in region 0.


Variable Documentation

const label ANYEDGE = -1 [static]

Face collapse status.

anyEdge: any edge can be collapsed noEdge: no edge can be collapsed collapsed: already collapsed >0: edge label that can be collapsed

Definition at line 309 of file triSurfaceTools.H.

const label NOEDGE = -2 [static]

Definition at line 310 of file triSurfaceTools.H.

const label COLLAPSED = -3 [static]

Definition at line 311 of file triSurfaceTools.H.

Copyright © 2000-2007 OpenCFD Ltd