A collection of tools for searching, sorting PrimitivePatch information. More...
Public Member Functions | |
template<class FaceList , class PointField > | |
Foam::labelList | edgeOwner (const PrimitivePatch< FaceList, PointField > &p) |
template<class FaceList , class PointField > | |
Foam::tmp< Foam::pointField > | pointNormals (const polyMesh &mesh, const PrimitivePatch< FaceList, PointField > &p, const bitSet &pFlip) |
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) |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
template<class FaceList , class PointField > | |
static labelListList | sortedPointEdges (const PrimitivePatch< FaceList, PointField > &) |
Return point-edge addressing sorted by order around the point. More... | |
template<class FaceList , class PointField > | |
static labelList | edgeOwner (const PrimitivePatch< FaceList, PointField > &) |
If 2 face neighbours: label of face where ordering of edge. More... | |
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. More... | |
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. More... | |
template<class FaceList , class PointField > | |
static tmp< pointField > | pointNormals (const polyMesh &, const PrimitivePatch< FaceList, PointField > &, const bitSet &flipMap=bitSet::null()) |
Return parallel consistent point normals for patches using mesh points. More... | |
template<class FaceList , class PointField > | |
static tmp< pointField > | edgeNormals (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. More... | |
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. More... | |
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. More... | |
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. More... | |
A collection of tools for searching, sorting PrimitivePatch information.
The class could also be extended to include more that just static methods.
Definition at line 64 of file PatchTools.H.
|
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 29 of file PatchToolsCheck.C.
References Foam::constant::electromagnetic::e, Foam::endl(), f(), forAll, foundError, Foam::Info, HashSet< Key, Hash >::insert(), Foam::nl, p, p0, and UList< T >::size().
Referenced by searchableSurfaces::checkNormalOrientation().
|
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 34 of file PatchToolsSearch.C.
References Foam::abort(), List< T >::append(), Foam::FatalError, FatalErrorInFunction, forAll, p, UList< T >::size(), and List< T >::transfer().
|
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().
|
static |
Determine the mapping for a sub-patch.
Only include faces for which bool-list entry is true.
[in] | p | patch to be searched on |
[in] | includeFaces | faces to include |
[out] | pointMap | mapping new to old localPoints |
[out] | faceMap | mapping new to old faces |
Definition at line 136 of file PatchToolsSearch.C.
References List< T >::clear(), Foam::faceMap(), forAll, and p.
Referenced by UnsortedMeshedSurface< Face >::subsetMeshMap(), triSurface::subsetMeshMap(), and MeshedSurface< Foam::face >::subsetMeshMap().
|
static |
Definition at line 172 of file PatchToolsSearch.C.
References boundBox::add(), f(), nPoints, p, points, and boundBox::reset().
Referenced by triSurfaceMesh::edgeTree(), triSurfaceSearch::tree(), triSurfaceRegionSearch::treeByRegion(), and distributedTriSurfaceMesh::writeStats().
|
static |
Return edge-face addressing sorted by angle around the edge.
Orientation is anticlockwise looking from edge.vec(localPoints())
|
static |
Return point-edge addressing sorted by order around the point.
|
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.
|
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 32 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().
|
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 70 of file PatchToolsMatch.C.
References PrimitivePatch< FaceList, PointField >::edges(), forAll, PrimitivePatch< FaceList, PointField >::meshEdge(), PrimitivePatch< FaceList, PointField >::nEdges(), List< T >::resize(), PackedList< Width >::resize(), and bitSet::set().
Referenced by addPatchCellLayer::calcExtrudeInfo(), createShellMesh::calcPointRegions(), and meshRefinement::countEdgeFaces().
|
static |
Return parallel consistent point normals for patches using mesh points.
|
static |
Return parallel consistent edge normals for patches using mesh points.
Supply with patch matching info from matchEdges.
|
static |
Gather points and faces onto master and merge into single patch.
Note: Normally uses faces/points (not localFaces/localPoints)
[in] | mergeDist | Geometric merge tolerance for Foam::mergePoints |
[in] | pp | The patch to merge |
[out] | mergedPoints | merged points (master only, empty elsewhere) |
[out] | mergedFaces | merged faces (master only, empty elsewhere) |
[out] | pointAddr | Points globalIndex gather addressing (master only, empty elsewhere) |
[out] | faceAddr | Faces globalIndex gather addressing (master only, empty elsewhere) |
[out] | pointMergeMap | An old-to-new mapping from original point index to the index into merged points. |
[in] | useLocal | gather/merge patch localFaces/localPoints instead of faces/points |
Definition at line 31 of file PatchToolsGatherAndMerge.C.
References f(), globalIndex::gather(), Foam::identity(), Foam::inplaceMergePoints(), Foam::ListListOps::inplaceRenumber(), globalIndex::inplaceToGlobal(), Foam::notNull(), pp(), globalIndex::range(), globalIndex::reset(), globalIndex::subProcs(), and List< T >::transfer().
Referenced by mergedSurf::merge(), shortestPathSet::shortestPathSet(), and AMIWeights::writeWeightField().
|
static |
Gather points and faces onto master and merge into single patch.
Note: Normally uses faces/points (not localFaces/localPoints)
[in] | mergeDist | Geometric merge tolerance for Foam::mergePoints |
[in] | pp | The patch to merge |
[out] | mergedPoints | merged points (master only, empty elsewhere) |
[out] | mergedFaces | merged faces (master only, empty elsewhere) |
[out] | pointMergeMap | An old-to-new mapping from original point index to the index into merged points. |
[in] | useLocal | gather/merge patch localFaces/localPoints instead of faces/points |
Definition at line 152 of file PatchToolsGatherAndMerge.C.
References pp().
|
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:
On master only returns:
Definition at line 186 of file PatchToolsGatherAndMerge.C.
References f(), Foam::identity(), Foam::ListListOps::inplaceRenumber(), mesh, autoPtr< T >::reset(), and UList< T >::size().
Foam::labelList edgeOwner | ( | const PrimitivePatch< FaceList, PointField > & | p | ) |
Definition at line 29 of file PatchToolsEdgeOwner.C.
References Foam::abort(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, p, and UList< T >::size().
Foam::tmp<Foam::pointField> pointNormals | ( | const polyMesh & | mesh, |
const PrimitivePatch< FaceList, PointField > & | p, | ||
const bitSet & | pFlip | ||
) |
Definition at line 32 of file PatchToolsNormals.C.
References HashTable< T, Key, Hash >::cfind(), mapDistributeBase::constructSize(), globalMeshData::coupledPatch(), mapDistribute::distribute(), PackedList< Width >::empty(), f(), forAll, globalMeshData::globalPointSlaves(), globalMeshData::globalPointSlavesMap(), globalMeshData::globalPointTransformedSlaves(), globalMeshData::globalTransforms(), local, Foam::mag(), mesh, PrimitivePatch< FaceList, PointField >::meshPointMap(), n, Foam::New(), p, pFaces, mapDistribute::reverseDistribute(), List< T >::setSize(), UList< T >::size(), Foam::sum(), Foam::transform(), HashTable< T, Key, Hash >::const_iterator::val(), and Foam::Zero.
Foam::tmp<Foam::pointField> edgeNormals | ( | const polyMesh & | mesh, |
const PrimitivePatch< FaceList, PointField > & | p, | ||
const labelList & | patchEdges, | ||
const labelList & | coupledEdges, | ||
const bitSet & | pFlip | ||
) |
Construct with all data in consistent orientation
Definition at line 191 of file PatchToolsNormals.C.
References mapDistributeBase::constructSize(), PackedList< Width >::empty(), forAll, globalMeshData::globalEdgeSlaves(), globalMeshData::globalEdgeSlavesMap(), globalMeshData::globalEdgeTransformedSlaves(), globalMeshData::globalTransforms(), Foam::mag(), mesh, n, Foam::New(), p, globalMeshData::syncData(), and Foam::Zero.
Foam::label markZones | ( | const PrimitivePatch< FaceList, PointField > & | p, |
const BoolListType & | borderEdge, | ||
labelList & | faceZone | ||
) |
Definition at line 104 of file PatchToolsSearch.C.
References p, List< T >::setSize(), and UList< T >::size().
Foam::labelListList sortedEdgeFaces | ( | const PrimitivePatch< FaceList, PointField > & | p | ) |
Definition at line 31 of file PatchToolsSortEdges.C.
References Foam::constant::electromagnetic::e, f(), forAll, SortableList< T >::indices(), Foam::mag(), Foam::max(), Foam::normalised(), p, Foam::pseudoAngle(), UList< T >::size(), and SortableList< T >::sort().
Foam::labelListList sortedPointEdges | ( | const PrimitivePatch< FaceList, PointField > & | p | ) |
Definition at line 29 of file PatchToolsSortPoints.C.
References DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), edge::end(), Foam::endl(), forAll, UList< T >::found(), Foam::nl, p, DynamicList< T, SizeMin >::setCapacity(), UList< T >::size(), edge::start(), and WarningInFunction.