Loading...
Searching...
No Matches
PatchTools Class Reference

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

#include <PatchTools.H>

Public Member Functions

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

Static Public Member Functions

template<class FaceList, class PointField>
static bool checkOrientation (const PrimitivePatch< FaceList, PointField > &, const bool report=false, labelHashSet *marked=0)
 Check for orientation issues.
template<class BoolListType, class FaceList, class PointField>
static void markZone (const PrimitivePatch< FaceList, PointField > &, const BoolListType &borderEdge, const label facei, const label currentZone, labelList &faceZone)
 Fill faceZone with currentZone for every face reachable.
template<class BoolListType, class FaceList, class PointField>
static label markZones (const PrimitivePatch< FaceList, PointField > &, const BoolListType &borderEdge, labelList &faceZone)
 Size and fills faceZone with zone of face.
template<class BoolListType, class FaceList, class PointField>
static void subsetMap (const PrimitivePatch< FaceList, PointField > &p, const BoolListType &includeFaces, labelList &pointMap, labelList &faceMap)
 Determine the mapping for a sub-patch.
template<class FaceList, class PointField>
static void calcBounds (const PrimitivePatch< FaceList, PointField > &p, boundBox &bb, label &nPoints)
template<class FaceList, class PointField>
static labelListList sortedEdgeFaces (const PrimitivePatch< FaceList, PointField > &)
 Return edge-face addressing sorted by angle around the edge.
template<class FaceList, class PointField>
static labelListList sortedPointEdges (const PrimitivePatch< FaceList, PointField > &)
 Return point-edge addressing sorted by order around the point.
template<class FaceList, class PointField>
static labelList edgeOwner (const PrimitivePatch< FaceList, PointField > &)
 If 2 face neighbours: label of face where ordering of edge.
template<class FaceList1, class PointField1, class FaceList2, class PointField2>
static void matchPoints (const PrimitivePatch< FaceList1, PointField1 > &p1, const PrimitivePatch< FaceList2, PointField2 > &p2, labelList &p1PointLabels, labelList &p2PointLabels)
 Find corresponding points on patches sharing the same points.
template<class FaceList1, class PointField1, class FaceList2, class PointField2>
static void matchEdges (const PrimitivePatch< FaceList1, PointField1 > &p1, const PrimitivePatch< FaceList2, PointField2 > &p2, labelList &p1EdgeLabels, labelList &p2EdgeLabels, bitSet &sameOrientation)
 Find corresponding edges on patches sharing the same points.
template<class FaceList, class PointField>
static tmp< pointFieldpointNormals (const polyMesh &, const PrimitivePatch< FaceList, PointField > &, const bitSet &flipMap=bitSet::null())
 Return parallel consistent point normals for patches using mesh points.
template<class FaceList, class PointField>
static tmp< pointFieldpointNormals (const polyMesh &, const PrimitivePatch< FaceList, PointField > &, const pointField &localPoints, const bitSet &flipMap=bitSet::null())
 Return parallel consistent point normals for patches using mesh points.
template<class FaceList, class PointField>
static tmp< pointFieldedgeNormals (const polyMesh &, const PrimitivePatch< FaceList, PointField > &, const labelList &patchEdges, const labelList &coupledEdges, const bitSet &flipMap=bitSet::null())
 Return parallel consistent edge normals for patches using mesh points.
template<class FaceList, class PointField>
static tmp< pointFieldedgeNormals (const polyMesh &, const PrimitivePatch< FaceList, PointField > &, const pointField &localPoints, const labelList &patchEdges, const labelList &coupledEdges, const bitSet &flipMap=bitSet::null())
 Return parallel consistent edge normals for patches using mesh points.
template<class FaceList, class PointField>
static void gatherAndMerge (const scalar mergeDist, const PrimitivePatch< FaceList, PointField > &pp, Field< typename PrimitivePatch< FaceList, PointField >::point_type > &mergedPoints, List< typename PrimitivePatch< FaceList, PointField >::face_type > &mergedFaces, globalIndex &pointAddr, globalIndex &faceAddr, labelList &pointMergeMap=const_cast< labelList & >(labelList::null()), const bool useLocal=false)
 Gather points and faces onto master and merge into single patch.
template<class FaceList, class PointField>
static void gatherAndMerge (const scalar mergeDist, const PrimitivePatch< FaceList, PointField > &pp, Field< typename PrimitivePatch< FaceList, PointField >::point_type > &mergedPoints, List< typename PrimitivePatch< FaceList, PointField >::face_type > &mergedFaces, labelList &pointMergeMap=const_cast< labelList & >(labelList::null()), const bool useLocal=false)
 Gather points and faces onto master and merge into single patch.
template<class FaceList>
static void gatherAndMerge (const polyMesh &mesh, const FaceList &faces, const labelList &meshPoints, const Map< label > &meshPointMap, labelList &pointToGlobal, labelList &uniqueMeshPointLabels, autoPtr< globalIndex > &globalPoints, autoPtr< globalIndex > &globalFaces, List< typename FaceList::value_type > &mergedFaces, pointField &mergedPoints)
 Gather (mesh!) points and faces onto master and merge collocated.

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

Definition at line 64 of file PatchTools.H.

Member Function Documentation

◆ checkOrientation()

template<class FaceList, class PointField>
bool checkOrientation ( const PrimitivePatch< FaceList, PointField > & 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 28 of file PatchToolsCheck.C.

References e, Foam::endl(), f(), forAll, foundError, Foam::Info, HashSet< Key, Hash >::insert(), Foam::nl, p, p0, and UList< T >::size().

Referenced by searchableSurfaces::checkNormalOrientation().

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

◆ markZone()

template<class BoolListType, class FaceList, class PointField>
void markZone ( const PrimitivePatch< FaceList, PointField > & 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 33 of file PatchToolsSearch.C.

References Foam::abort(), DynamicList< T, SizeMin >::append(), UList< T >::empty(), Foam::FatalError, FatalErrorInFunction, forAll, p, UList< T >::size(), and List< T >::transfer().

Referenced by markZones().

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

◆ markZones() [1/2]

template<class BoolListType, class FaceList, class PointField>
label markZones ( const PrimitivePatch< FaceList, PointField > & ,
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.

References Foam::faceMap(), nPoints, and p.

Referenced by searchableSurfaces::checkNormalOrientation().

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

◆ subsetMap()

template<class BoolListType, class FaceList, class PointField>
void subsetMap ( const PrimitivePatch< FaceList, PointField > & 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]ppatch to be searched on
[in]includeFacesfaces to include
[out]pointMapmapping new to old localPoints
[out]faceMapmapping new to old faces

Definition at line 135 of file PatchToolsSearch.C.

References List< T >::clear(), Foam::faceMap(), forAll, p, bitSet::set(), and bitSet::sortedToc().

Referenced by MeshedSurface< face >::subsetMeshMap(), triSurface::subsetMeshMap(), and UnsortedMeshedSurface< face >::subsetMeshMap().

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

◆ calcBounds()

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

Definition at line 171 of file PatchToolsSearch.C.

References boundBox::add(), f(), nPoints, p, points, boundBox::reset(), and bitSet::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() [1/2]

template<class FaceList, class PointField>
labelListList sortedEdgeFaces ( const PrimitivePatch< FaceList, PointField > & )
static

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

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

Referenced by sortedEdgeFaces(), and extendedEdgeMesh::sortPointsAndEdges().

Here is the caller graph for this function:

◆ sortedPointEdges() [1/2]

template<class FaceList, class PointField>
labelListList sortedPointEdges ( const PrimitivePatch< FaceList, PointField > & )
static

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

Referenced by sortedPointEdges(), and extendedEdgeMesh::sortPointsAndEdges().

Here is the caller graph for this function:

◆ edgeOwner() [1/2]

template<class FaceList, class PointField>
labelList edgeOwner ( const PrimitivePatch< FaceList, PointField > & )
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.

Referenced by edgeOwner().

Here is the caller graph for this function:

◆ matchPoints()

template<class FaceList1, class PointField1, class FaceList2, class PointField2>
void matchPoints ( const PrimitivePatch< FaceList1, PointField1 > & p1,
const PrimitivePatch< FaceList2, PointField2 > & 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 31 of file PatchToolsMatch.C.

References HashTable< T, Key, Hash >::cfind(), forAll, PrimitivePatch< FaceList, PointField >::meshPointMap(), PrimitivePatch< FaceList, PointField >::meshPoints(), PrimitivePatch< FaceList, PointField >::nPoints(), and List< T >::resize().

Here is the call graph for this function:

◆ matchEdges()

template<class FaceList1, class PointField1, class FaceList2, class PointField2>
void matchEdges ( const PrimitivePatch< FaceList1, PointField1 > & p1,
const PrimitivePatch< FaceList2, PointField2 > & p2,
labelList & p1EdgeLabels,
labelList & p2EdgeLabels,
bitSet & sameOrientation )
static

◆ pointNormals() [1/4]

template<class FaceList, class PointField>
tmp< pointField > pointNormals ( const polyMesh & ,
const PrimitivePatch< FaceList, PointField > & ,
const bitSet & flipMap = bitSet::null() )
static

Return parallel consistent point normals for patches using mesh points.

References bitSet::null().

Referenced by snappySnapDriver::doSnap(), and pointMeshTools::featurePointsEdges().

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

◆ pointNormals() [2/4]

template<class FaceList, class PointField>
tmp< pointField > pointNormals ( const polyMesh & ,
const PrimitivePatch< FaceList, PointField > & ,
const pointField & localPoints,
const bitSet & flipMap = bitSet::null() )
static

Return parallel consistent point normals for patches using mesh points.

Get all geometry from provided patch local points. (assumed to be consistent across coupled patches)

References bitSet::null().

Here is the call graph for this function:

◆ edgeNormals() [1/4]

template<class FaceList, class PointField>
tmp< pointField > edgeNormals ( const polyMesh & ,
const PrimitivePatch< FaceList, PointField > & ,
const labelList & patchEdges,
const labelList & coupledEdges,
const bitSet & flipMap = bitSet::null() )
static

Return parallel consistent edge normals for patches using mesh points.

Supply with patch matching info from matchEdges.

References bitSet::null().

Referenced by edgeNormals(), and edgeNormals().

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

◆ edgeNormals() [2/4]

template<class FaceList, class PointField>
tmp< pointField > edgeNormals ( const polyMesh & ,
const PrimitivePatch< FaceList, PointField > & ,
const pointField & localPoints,
const labelList & patchEdges,
const labelList & coupledEdges,
const bitSet & flipMap = bitSet::null() )
static

Return parallel consistent edge normals for patches using mesh points.

Get all geometry from provided patch local points. (assumed to be consistent across coupled patches) Supply with patch matching info from matchEdges.

References mesh, bitSet::null(), List< label >::null(), and pp().

Here is the call graph for this function:

◆ gatherAndMerge() [1/3]

template<class FaceList, class PointField>
void gatherAndMerge ( const scalar mergeDist,
const PrimitivePatch< FaceList, PointField > & pp,
Field< typename PrimitivePatch< FaceList, PointField >::point_type > & mergedPoints,
List< typename PrimitivePatch< FaceList, PointField >::face_type > & mergedFaces,
globalIndex & pointAddr,
globalIndex & faceAddr,
labelList & pointMergeMap = const_cast<labelList&>(labelList::null()),
const bool useLocal = false )
static

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

Note: Normally uses faces/points (not localFaces/localPoints)

Parameters
[in]mergeDistGeometric merge tolerance for Foam::mergePoints
[in]ppThe patch to merge
[out]mergedPointsmerged points (master only, empty elsewhere)
[out]mergedFacesmerged faces (master only, empty elsewhere)
[out]pointAddrPoints globalIndex gather addressing (master only, empty elsewhere)
[out]faceAddrFaces globalIndex gather addressing (master only, empty elsewhere)
[out]pointMergeMapAn old-to-new mapping from original point index to the index into merged points.
[in]useLocalgather/merge patch localFaces/localPoints instead of faces/points
Note
  • OpenFOAM-v2112 and earlier: geometric merge on all patch points.
  • OpenFOAM-v2206 and later: geometric merge on patch boundary points.

Definition at line 30 of file PatchToolsGatherAndMerge.C.

References f(), globalIndex::gather(), Foam::identity(), Foam::inplaceMergePoints(), Foam::inplaceRenumber(), globalIndex::inplaceToGlobal(), UPstream::master(), Foam::notNull(), UPstream::parRun(), pp(), globalIndex::range(), globalIndex::reset(), globalIndex::subProcs(), and List< T >::transfer().

Referenced by gatherAndMerge(), mergedSurf::merge(), shortestPathSet::shortestPathSet(), and AMIWeights::writeWeightField().

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

◆ gatherAndMerge() [2/3]

template<class FaceList, class PointField>
void gatherAndMerge ( const scalar mergeDist,
const PrimitivePatch< FaceList, PointField > & pp,
Field< typename PrimitivePatch< FaceList, PointField >::point_type > & mergedPoints,
List< typename PrimitivePatch< FaceList, PointField >::face_type > & mergedFaces,
labelList & pointMergeMap = const_cast<labelList&>(labelList::null()),
const bool useLocal = false )
static

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

Note: Normally uses faces/points (not localFaces/localPoints)

Parameters
[in]mergeDistGeometric merge tolerance for Foam::mergePoints
[in]ppThe patch to merge
[out]mergedPointsmerged points (master only, empty elsewhere)
[out]mergedFacesmerged faces (master only, empty elsewhere)
[out]pointMergeMapAn old-to-new mapping from original point index to the index into merged points.
[in]useLocalgather/merge patch localFaces/localPoints instead of faces/points
Note
  • OpenFOAM-v2112 and earlier: geometric merge on all patch points.
  • OpenFOAM-v2206 and later: geometric merge on patch boundary points.

Definition at line 151 of file PatchToolsGatherAndMerge.C.

References gatherAndMerge(), and pp().

Here is the call graph for this function:

◆ gatherAndMerge() [3/3]

template<class FaceList>
void gatherAndMerge ( const polyMesh & mesh,
const FaceList & faces,
const labelList & meshPoints,
const Map< label > & meshPointMap,
labelList & pointToGlobal,
labelList & uniqueMeshPointLabels,
autoPtr< globalIndex > & globalPoints,
autoPtr< globalIndex > & globalFaces,
List< typename FaceList::value_type > & mergedFaces,
pointField & mergedPoints )
static

Gather (mesh!) points and faces onto master and merge collocated.

points into a single patch. Uses coupled point mesh structure so does not need tolerances. On master and sub-ranks returns:

  • pointToGlobal : for every local point index the global point index
  • uniqueMeshPointLabels : my local mesh points
  • globalPoints : global numbering for the global points
  • globalFaces : global numbering for the faces

On master only returns:

  • mergedFaces : the merged faces
  • mergedPoints : the merged points

Definition at line 185 of file PatchToolsGatherAndMerge.C.

References f(), Foam::identity(), Foam::inplaceRenumber(), mesh, UPstream::parRun(), autoPtr< T >::reset(), and UList< T >::size().

Here is the call graph for this function:

◆ edgeOwner() [2/2]

template<class FaceList, class PointField>
Foam::labelList edgeOwner ( const PrimitivePatch< FaceList, PointField > & p)

Definition at line 28 of file PatchToolsEdgeOwner.C.

References Foam::abort(), edgeOwner(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, p, and UList< T >::size().

Here is the call graph for this function:

◆ pointNormals() [3/4]

◆ edgeNormals() [3/4]

template<class FaceList, class PointField>
Foam::tmp< Foam::pointField > edgeNormals ( const polyMesh & mesh,
const PrimitivePatch< FaceList, PointField > & p,
const labelList & patchEdges,
const labelList & coupledEdges,
const bitSet & pFlip )

◆ pointNormals() [4/4]

◆ edgeNormals() [4/4]

template<class FaceList, class PointField>
Foam::tmp< Foam::pointField > edgeNormals ( const polyMesh & mesh,
const PrimitivePatch< FaceList, PointField > & p,
const pointField & localPoints,
const labelList & patchEdges,
const labelList & coupledEdges,
const bitSet & pFlip )

◆ markZones() [2/2]

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

Definition at line 103 of file PatchToolsSearch.C.

References markZone(), p, List< T >::setSize(), and UList< T >::size().

Here is the call graph for this function:

◆ sortedEdgeFaces() [2/2]

template<class FaceList, class PointField>
Foam::labelListList sortedEdgeFaces ( const PrimitivePatch< FaceList, PointField > & p)

◆ sortedPointEdges() [2/2]


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