Public Member Functions | Static Public Member Functions
PatchTools Class Reference

A collection of tools for searching, sorting PrimitivePatch information. More...

Public Member Functions

template<class Face , template< class > class FaceList, class PointField , class PointType >
Foam::labelList edgeOwner (const PrimitivePatch< Face, FaceList, PointField, PointType > &p)
 
template<class BoolListType , class Face , template< class > class FaceList, class PointField , class PointType >
Foam::label markZones (const PrimitivePatch< Face, FaceList, PointField, PointType > &p, const BoolListType &borderEdge, labelList &faceZone)
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
Foam::labelListList sortedEdgeFaces (const PrimitivePatch< Face, FaceList, PointField, PointType > &p)
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
Foam::tmp< Foam::pointFieldpointNormals (const polyMesh &mesh, const PrimitivePatch< Face, FaceList, PointField, PointType > &p)
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
Foam::tmp< Foam::pointFieldedgeNormals (const polyMesh &mesh, const PrimitivePatch< Face, FaceList, PointField, PointType > &p, const labelList &patchEdges, const labelList &coupledEdges)
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
Foam::labelListList sortedPointEdges (const PrimitivePatch< Face, FaceList, PointField, PointType > &p)
 

Static Public Member Functions

template<class Face , template< class > class FaceList, class PointField , class PointType >
static bool checkOrientation (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const bool report=false, labelHashSet *marked=0)
 Check for orientation issues. More...
 
template<class BoolListType , class Face , template< class > class FaceList, class PointField , class PointType >
static void markZone (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &borderEdge, const label faceI, const label currentZone, labelList &faceZone)
 Fill faceZone with currentZone for every face reachable. More...
 
template<class BoolListType , class Face , template< class > class FaceList, class PointField , class PointType >
static label markZones (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &borderEdge, labelList &faceZone)
 Size and fills faceZone with zone of face. More...
 
template<class BoolListType , class Face , template< class > class FaceList, class PointField , class PointType >
static void subsetMap (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &includeFaces, labelList &pointMap, labelList &faceMap)
 Determine the mapping for a sub-patch. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static labelListList sortedEdgeFaces (const PrimitivePatch< Face, FaceList, PointField, PointType > &)
 Return edge-face addressing sorted by angle around the edge. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static labelList edgeOwner (const PrimitivePatch< Face, FaceList, PointField, PointType > &)
 If 2 face neighbours: label of face where ordering of edge. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static bool checkOrientation (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const bool report=false, labelHashSet *marked=0)
 Check for orientation issues. More...
 
template<class BoolListType , class Face , template< class > class FaceList, class PointField , class PointType >
static void markZone (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &borderEdge, const label faceI, const label currentZone, labelList &faceZone)
 Fill faceZone with currentZone for every face reachable. More...
 
template<class BoolListType , class Face , template< class > class FaceList, class PointField , class PointType >
static label markZones (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &borderEdge, labelList &faceZone)
 Size and fills faceZone with zone of face. More...
 
template<class BoolListType , class Face , template< class > class FaceList, class PointField , class PointType >
static void subsetMap (const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &includeFaces, labelList &pointMap, labelList &faceMap)
 Determine the mapping for a sub-patch. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static void calcBounds (const PrimitivePatch< Face, FaceList, PointField, PointType > &p, boundBox &bb, label &nPoints)
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static labelListList sortedEdgeFaces (const PrimitivePatch< Face, FaceList, PointField, PointType > &)
 Return edge-face addressing sorted by angle around the edge. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static labelListList sortedPointEdges (const PrimitivePatch< Face, FaceList, PointField, PointType > &)
 Return point-edge addressing sorted by order around the point. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static labelList edgeOwner (const PrimitivePatch< Face, FaceList, PointField, PointType > &)
 If 2 face neighbours: label of face where ordering of edge. More...
 
template<class Face1 , template< class > class FaceList1, class PointField1 , class PointType1 , class Face2 , template< class > class FaceList2, class PointField2 , class PointType2 >
static void matchPoints (const PrimitivePatch< Face1, FaceList1, PointField1, PointType1 > &p1, const PrimitivePatch< Face2, FaceList2, PointField2, PointType2 > &p2, labelList &p1PointLabels, labelList &p2PointLabels)
 Find corresponding points on patches sharing the same points. More...
 
template<class Face1 , template< class > class FaceList1, class PointField1 , class PointType1 , class Face2 , template< class > class FaceList2, class PointField2 , class PointType2 >
static void matchEdges (const PrimitivePatch< Face1, FaceList1, PointField1, PointType1 > &p1, const PrimitivePatch< Face2, FaceList2, PointField2, PointType2 > &p2, labelList &p1EdgeLabels, labelList &p2EdgeLabels, PackedBoolList &sameOrientation)
 Find corresponding edges on patches sharing the same points. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static tmp< pointFieldpointNormals (const polyMesh &, const PrimitivePatch< Face, FaceList, PointField, PointType > &)
 Return parallel consistent point normals for patches using mesh points. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static tmp< pointFieldedgeNormals (const polyMesh &, const PrimitivePatch< Face, FaceList, PointField, PointType > &, const labelList &patchEdges, const labelList &coupledEdges)
 Return parallel consistent edge normals for patches using mesh points. More...
 
template<class Face , template< class > class FaceList, class PointField , class PointType >
static void gatherAndMerge (const scalar mergeDist, const PrimitivePatch< Face, FaceList, PointField, PointType > &p, Field< PointType > &mergedPoints, List< Face > &mergedFaces, labelList &pointMergeMap)
 Gather points and faces onto master and merge into single patch. More...
 

Detailed Description

A collection of tools for searching, sorting PrimitivePatch information.

The class could also be extended to include more that just static methods.

Source files

The class could also be extended to include more that just static methods.

Source files

Definition at line 55 of file PatchTools.H.

Member Function Documentation

◆ checkOrientation() [1/2]

bool checkOrientation ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p,
const bool  report = false,
labelHashSet marked = 0 
)
static

Check for orientation issues.

Returns true if problems were found. If a normal flips across an edge, places it in the HashSet

Compute normal from 3 points, use the first as the origin

minor warpage should not be a problem

Definition at line 40 of file PatchToolsCheck.C.

References Foam::constant::electromagnetic::e, Foam::endl(), f(), forAll, Foam::Info, HashSet< Key, Hash >::insert(), Foam::nl, p, and List::size().

Referenced by searchableSurfaces::checkNormalOrientation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ markZone() [1/2]

void markZone ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p,
const BoolListType &  borderEdge,
const label  faceI,
const label  currentZone,
labelList faceZone 
)
static

Fill faceZone with currentZone for every face reachable.

from faceI without crossing edge marked in borderEdge. Note: faceZone has to be sized nFaces before calling.

Definition at line 46 of file PatchToolsSearch.C.

References Foam::abort(), List::append(), Foam::FatalError, FatalErrorIn, forAll, p, List::size(), and List::transfer().

Here is the call graph for this function:

◆ markZones() [1/3]

static label markZones ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  ,
const BoolListType &  borderEdge,
labelList faceZone 
)
static

Size and fills faceZone with zone of face.

Zone is area reachable by edge crossing without crossing borderEdge. Returns number of zones.

Referenced by searchableSurfaces::checkNormalOrientation().

Here is the caller graph for this function:

◆ subsetMap() [1/2]

void subsetMap ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p,
const BoolListType &  includeFaces,
labelList pointMap,
labelList faceMap 
)
static

Determine the mapping for a sub-patch.

Only include faces for which bool-list entry is true.

Parameters
[in]includeFacesfaces to include
[out]pointMapmapping new to old localPoints
[out]faceMapmapping new to old faces

Definition at line 173 of file PatchToolsSearch.C.

References f(), Foam::faceMap(), forAll, p, List::setSize(), and List::size().

Here is the call graph for this function:

◆ sortedEdgeFaces() [1/3]

static labelListList sortedEdgeFaces ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  )
static

Return edge-face addressing sorted by angle around the edge.

Orientation is anticlockwise looking from edge.vec(localPoints())

◆ edgeOwner() [1/3]

static labelList edgeOwner ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  )
static

If 2 face neighbours: label of face where ordering of edge.

is consistent with righthand walk. If 1 neighbour: label of only face. If >2 neighbours: undetermined.

◆ checkOrientation() [2/2]

static bool checkOrientation ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  ,
const bool  report = false,
labelHashSet marked = 0 
)
static

Check for orientation issues.

Returns true if problems were found. If a normal flips across an edge, places it in the HashSet

◆ markZone() [2/2]

static void markZone ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  ,
const BoolListType &  borderEdge,
const label  faceI,
const label  currentZone,
labelList faceZone 
)
static

Fill faceZone with currentZone for every face reachable.

from faceI without crossing edge marked in borderEdge. Note: faceZone has to be sized nFaces before calling.

◆ markZones() [2/3]

static label markZones ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  ,
const BoolListType &  borderEdge,
labelList faceZone 
)
static

Size and fills faceZone with zone of face.

Zone is area reachable by edge crossing without crossing borderEdge. Returns number of zones.

◆ subsetMap() [2/2]

static void subsetMap ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  ,
const BoolListType &  includeFaces,
labelList pointMap,
labelList faceMap 
)
static

Determine the mapping for a sub-patch.

Only include faces for which bool-list entry is true.

Parameters
[in]includeFacesfaces to include
[out]pointMapmapping new to old localPoints
[out]faceMapmapping new to old faces

◆ calcBounds()

void calcBounds ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p,
boundBox bb,
label nPoints 
)
static

Definition at line 224 of file PatchToolsSearch.C.

References f(), forAll, boundBox::invertedBox, boundBox::max(), Foam::max(), boundBox::min(), Foam::min(), nPoints, p, points, and PackedBoolList::set().

Referenced by triSurfaceMesh::edgeTree(), triSurfaceSearch::tree(), triSurfaceRegionSearch::treeByRegion(), and distributedTriSurfaceMesh::writeStats().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortedEdgeFaces() [2/3]

static labelListList sortedEdgeFaces ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  )
static

Return edge-face addressing sorted by angle around the edge.

Orientation is anticlockwise looking from edge.vec(localPoints())

◆ sortedPointEdges() [1/2]

static labelListList sortedPointEdges ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  )
static

Return point-edge addressing sorted by order around the point.

◆ edgeOwner() [2/3]

static labelList edgeOwner ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  )
static

If 2 face neighbours: label of face where ordering of edge.

is consistent with righthand walk. If 1 neighbour: label of only face. If >2 neighbours: undetermined.

◆ matchPoints()

void matchPoints ( const PrimitivePatch< Face1, FaceList1, PointField1, PointType1 > &  p1,
const PrimitivePatch< Face2, FaceList2, PointField2, PointType2 > &  p2,
labelList p1PointLabels,
labelList p2PointLabels 
)
static

Find corresponding points on patches sharing the same points.

p1PointLabels : points on p1 that were matched p2PointLabels : corresponding points on p2

Definition at line 42 of file PatchToolsMatch.C.

References forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::meshPointMap(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), and List::setSize().

Here is the call graph for this function:

◆ matchEdges()

void matchEdges ( const PrimitivePatch< Face1, FaceList1, PointField1, PointType1 > &  p1,
const PrimitivePatch< Face2, FaceList2, PointField2, PointType2 > &  p2,
labelList p1EdgeLabels,
labelList p2EdgeLabels,
PackedBoolList sameOrientation 
)
static

Find corresponding edges on patches sharing the same points.

p1EdgeLabels : edges on p1 that were matched p2EdgeLabels : corresponding edges on p2 sameOrientation : same orientation?

Definition at line 88 of file PatchToolsMatch.C.

References Foam::constant::electromagnetic::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), HashTable::find(), forAll, HashTable::insert(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), List::setSize(), and PackedList::setSize().

Referenced by addPatchCellLayer::calcExtrudeInfo(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pointNormals() [1/2]

static tmp<pointField> pointNormals ( const polyMesh ,
const PrimitivePatch< Face, FaceList, PointField, PointType > &   
)
static

Return parallel consistent point normals for patches using mesh points.

Referenced by autoLayerDriver::getPatchDisplacement(), main(), and medialAxisMeshMover::update().

Here is the caller graph for this function:

◆ edgeNormals() [1/2]

static tmp<pointField> edgeNormals ( const polyMesh ,
const PrimitivePatch< Face, FaceList, PointField, PointType > &  ,
const labelList patchEdges,
const labelList coupledEdges 
)
static

Return parallel consistent edge normals for patches using mesh points.

Supply with patch matching info from matchEdges.

Referenced by main().

Here is the caller graph for this function:

◆ gatherAndMerge()

void gatherAndMerge ( const scalar  mergeDist,
const PrimitivePatch< Face, FaceList, PointField, PointType > &  p,
Field< PointType > &  mergedPoints,
List< Face > &  mergedFaces,
labelList pointMergeMap 
)
static

Gather points and faces onto master and merge into single patch.

Note: uses faces/points, not localFaces/localPoints.

Definition at line 43 of file PatchToolsGatherAndMerge.C.

References forAll, Foam::inplaceRenumber(), Foam::mergePoints(), p, Foam::ListListOps::subSizes(), and List::transfer().

Referenced by faceSource::combineSurfaceGeometry(), sampledSurfaces::update(), and cyclicPeriodicAMIPolyPatch::writeOBJ().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ edgeOwner() [3/3]

Foam::labelList edgeOwner ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p)

Definition at line 40 of file PatchToolsEdgeOwner.C.

References Foam::abort(), f(), Foam::FatalError, FatalErrorIn, forAll, Foam::nl, p, and List::size().

Here is the call graph for this function:

◆ markZones() [3/3]

Foam::label markZones ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p,
const BoolListType &  borderEdge,
labelList faceZone 
)

Definition at line 130 of file PatchToolsSearch.C.

References p, List::setSize(), and List::size().

Here is the call graph for this function:

◆ sortedEdgeFaces() [3/3]

Foam::labelListList sortedEdgeFaces ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p)

◆ pointNormals() [2/2]

Foam::tmp<Foam::pointField> pointNormals ( const polyMesh mesh,
const PrimitivePatch< Face, FaceList, PointField, PointType > &  p 
)

◆ edgeNormals() [2/2]

Foam::tmp<Foam::pointField> edgeNormals ( const polyMesh mesh,
const PrimitivePatch< Face, FaceList, PointField, PointType > &  p,
const labelList patchEdges,
const labelList coupledEdges 
)

◆ sortedPointEdges() [2/2]

Foam::labelListList sortedPointEdges ( const PrimitivePatch< Face, FaceList, PointField, PointType > &  p)

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