FreeFOAM The Cross-Platform CFD Toolkit
triSurfaceTools Class Reference

A collection of tools for triSurfaceMesh. More...

#include <meshTools/triSurfaceTools.H>


Detailed Description

List of all members.

Public Types

enum  sideType { UNKNOWN, INSIDE, OUTSIDE }
 on which side of surface More...

Public Member Functions

triSurface triangulateFaceCentre (const polyBoundaryMesh &mBesh, const labelHashSet &includePatches, const bool verbose=false)
 Face-centre triangulation of (selected patches of) boundaryMesh.

Static Public Member Functions

static void writeOBJ (const fileName &fName, const pointField &pts)
 Write pointField to OBJ format file.
static void writeOBJ (const triSurface &surf, const fileName &fName, const boolList &markedVerts)
 Write vertex subset to OBJ format file.
static void getVertexTriangles (const triSurface &surf, const label edgeI, labelList &edgeTris)
 Get all triangles using edge endpoint.
static labelList getVertexVertices (const triSurface &surf, const edge &e)
 Get all vertices (local numbering) connected to vertices of edge.
static label otherFace (const triSurface &surf, const label faceI, const label edgeI)
 Get face connected to edge not faceI.
static void otherEdges (const triSurface &surf, const label faceI, const label edgeI, label &e1, label &e2)
 Get the two edges on faceI counterclockwise after edgeI.
static void otherVertices (const triSurface &surf, const label faceI, const label vertI, label &vert1I, label &vert2I)
 Get the two vertices (local numbering) on faceI counterclockwise.
static label oppositeEdge (const triSurface &surf, const label faceI, const label vertI)
 Get edge opposite vertex (local numbering)
static label oppositeVertex (const triSurface &surf, const label faceI, const label edgeI)
 Get vertex (local numbering) opposite edge.
static label getEdge (const triSurface &surf, const label vert1I, const label vert2I)
 Returns edge label connecting v1, v2 (local numbering)
static label getTriangle (const triSurface &surf, const label e0I, const label e1I, const label e2I)
 Return index of triangle (or -1) using all three edges.
static triSurface collapseEdges (const triSurface &surf, const labelList &collapsableEdges)
 Create new triSurface by collapsing edges to edge mids.
static triSurface collapseEdges (const triSurface &surf, const labelList &collapsableEdges, const pointField &edgeMids, labelList &faceStatus)
 Create new triSurface by collapsing edges to specified.
static triSurface greenRefine (const triSurface &surf, const labelList &refineEdges)
 Refine edges by splitting to opposite vertex.
static triSurface redGreenRefine (const triSurface &surf, const labelList &refineFaces)
 Refine face by splitting all edges. Neighbouring face is.
static label minEdge (const triSurface &surf, const labelList &edgeIndices)
 Returns element in edgeIndices with minimum length.
static label maxEdge (const triSurface &surf, const labelList &edgeIndices)
 Returns element in edgeIndices with minimum length.
static triSurface mergePoints (const triSurface &surf, const scalar mergeTol)
 Merge points within distance.
static vector surfaceNormal (const triSurface &surf, const label nearestFaceI, const point &nearestPt)
 Triangle (unit) normal. If nearest point to triangle on edge use.
static 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
static sideType surfaceSide (const triSurface &surf, const point &sample, const label nearestFaceI, const point &nearestPt, const scalar tol)
 Given nearest point (to sample) on surface determines which side.
static triSurface triangulate (const polyBoundaryMesh &mBesh, const labelHashSet &includePatches, const bool verbose=false)
 Simple triangulation of (selected patches of) boundaryMesh. Needs.
static void calcInterpolationWeights (const triPointRef &, const point &, FixedList< scalar, 3 > &weights)
 Calculate linear interpolation weights for point (guaranteed to be.
static void calcInterpolationWeights (const triSurface &s, const pointField &samplePts, List< FixedList< label, 3 > > &verts, List< FixedList< scalar, 3 > > &weights)
static triSurface delaunay2D (const List< vector2D > &)
 Do unconstrained Delaunay of points. Returns triSurface with 3D.
static surfaceLocation classify (const triSurface &, const label triI, const point &trianglePoint)
 Test point on plane of triangle to see if on edge or point.
static surfaceLocation trackToEdge (const triSurface &, const surfaceLocation &start, const surfaceLocation &end, const plane &cutPlane)
 Track on surface to get closer to point. Possible situations:
static void track (const triSurface &, const surfaceLocation &endInfo, const plane &cutPlane, surfaceLocation &hitInfo)
 Track from edge to edge across surface. Uses trackToEdge.

Static Public Attributes

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

Member Enumeration Documentation

enum sideType

on which side of surface

Enumerator:
UNKNOWN 
INSIDE 
OUTSIDE 

Definition at line 437 of file triSurfaceTools.H.


Member Function Documentation

void writeOBJ ( const fileName fName,
const pointField pts 
)
static

Write pointField to OBJ format file.

Definition at line 1255 of file triSurfaceTools.C.

References Foam::endl(), forAll, Foam::Pout, List< T >::size(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

void writeOBJ ( const triSurface surf,
const fileName fName,
const boolList markedVerts 
)
static
Foam::label otherFace ( const triSurface surf,
const label  faceI,
const label  edgeI 
)
static

Get face connected to edge not faceI.

Definition at line 1432 of file triSurfaceTools.C.

References PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), and List< T >::size().

void otherEdges ( const triSurface surf,
const label  faceI,
const label  edgeI,
label &  e1,
label &  e2 
)
static
void otherVertices ( const triSurface surf,
const label  faceI,
const label  vertI,
label &  vert1I,
label &  vert2I 
)
static

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

vertI

Definition at line 1493 of file triSurfaceTools.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, and PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces().

Foam::label oppositeEdge ( const triSurface surf,
const label  faceI,
const label  vertI 
)
static
Foam::label oppositeVertex ( const triSurface surf,
const label  faceI,
const label  edgeI 
)
static
Foam::label getEdge ( const triSurface surf,
const label  vert1I,
const label  vert2I 
)
static
Foam::label getTriangle ( const triSurface surf,
const label  e0I,
const label  e1I,
const label  e2I 
)
static
Foam::triSurface collapseEdges ( const triSurface surf,
const labelList collapsableEdges,
const pointField edgeMids,
labelList faceStatus 
)
static
Foam::triSurface redGreenRefine ( const triSurface surf,
const labelList refineFaces 
)
static

Refine face by splitting all edges. Neighbouring face is.

greenRefine'd.

Definition at line 1886 of file triSurfaceTools.C.

References forAll, and List< T >::size().

Foam::label minEdge ( const triSurface surf,
const labelList edgeIndices 
)
static
Foam::label maxEdge ( const triSurface surf,
const labelList edgeIndices 
)
static
Foam::triSurfaceTools::sideType edgeSide ( const triSurface surf,
const point sample,
const point nearestPoint,
const label  edgeI 
)
static

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

sample is.

Definition at line 2164 of file triSurfaceTools.C.

References PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceNormals(), and List< T >::size().

void calcInterpolationWeights ( const triPointRef tri,
const point p,
FixedList< scalar, 3 > &  weights 
)
static

Calculate linear interpolation weights for point (guaranteed to be.

inside triangle)

Definition at line 2682 of file triSurfaceTools.C.

References triangle< Point, PointRef >::a(), triangle< Point, PointRef >::b(), triangle< Point, PointRef >::c(), Foam::mag(), and Foam::max().

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

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

points with z=0. All triangles in region 0.

Definition at line 2545 of file triSurfaceTools.C.

References UList< T >::begin(), dtris2(), forAll, points, and List< T >::size().

Foam::surfaceLocation trackToEdge ( const triSurface s,
const surfaceLocation start,
const surfaceLocation end,
const plane cutPlane 
)
static

Track on surface to get closer to point. Possible situations:

  • 1. reached endpoint

2. reached edge (normal situation)

  • 3. reached end of surface (edge on single face) Input:
  • starting position+triangle/edge/point (so has to be on surface!)
  • (optional) previous position+triangle/edge/point to prevent going back. Set index (of triangle/edge/point) to -1 if not used.
  • end position+triangle/edge/point (so has to be on surface!)
  • plane to follow. Has to go through end point! Returns:
  • true if end point reached (situation 1)
  • new position+triangle/edge/point Caller has to check for situation 3 by checking that triangle() is not set.

Definition at line 2886 of file triSurfaceTools.C.

References triangle< Point, PointRef >::EDGE, PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), surfaceLocation::elementType(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), triangle< Point, PointRef >::NONE, pFaces, PrimitivePatch< Face, FaceList, PointField, PointType >::pointFaces(), PointIndexHit< Point >::rawPoint(), PointIndexHit< Point >::setMiss(), and surfaceLocation::triangle().

void track ( const triSurface s,
const surfaceLocation endInfo,
const plane cutPlane,
surfaceLocation hitInfo 
)
static

Track from edge to edge across surface. Uses trackToEdge.

Not really useful by itself, more example of how to use trackToEdge. endInfo should be location on surface. hitInfo should be initialised to starting location (on surface as well). Upon return is set to end location.

Definition at line 2964 of file triSurfaceTools.C.

References PointIndexHit< Point >::hit(), and surfaceLocation::triangle().


Member Data Documentation

const Foam::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 367 of file triSurfaceTools.H.

const Foam::label NOEDGE = -2
static

Definition at line 368 of file triSurfaceTools.H.

const Foam::label COLLAPSED = -3
static

Definition at line 369 of file triSurfaceTools.H.


The documentation for this class was generated from the following files: