Container for information needed to couple to meshes. When constructed from two meshes and a geometric tolerance finds the corresponding boundary faces. More...
Public Member Functions | |
ClassName ("faceCoupleInfo") | |
Runtime type information. More... | |
faceCoupleInfo (const polyMesh &mesh0, const polyMesh &mesh1, const scalar absTol, const bool perfectMatch) | |
Construct from two meshes and absolute tolerance. More... | |
faceCoupleInfo (const polyMesh &masterMesh, const labelList &masterAddressing, const polyMesh &slaveMesh, const labelList &slaveAddressing, const scalar absTol, const bool perfectMatch, const bool orderedFaces, const bool patchDivision) | |
Construct from meshes and subset of mesh faces. More... | |
~faceCoupleInfo () | |
Destructor. More... | |
const indirectPrimitivePatch & | masterPatch () const |
Addressing engine for coupled faces on mesh0. More... | |
const indirectPrimitivePatch & | slavePatch () const |
Addressing engine for coupled faces on mesh1. More... | |
const primitiveFacePatch & | cutFaces () const |
Addressing engine for combined set of faces. More... | |
const pointField & | cutPoints () const |
Points for combined set of faces. More... | |
const labelList & | cutToMasterFaces () const |
Master face for every face on cut. Will always be at least. More... | |
const labelList & | masterToCutPoints () const |
const labelList & | cutToSlaveFaces () const |
const labelList & | slaveToCutPoints () const |
const edgeLookup & | cutEdgeToPoints () const |
From two cut points (original edge) to list of inserted. More... | |
template<template< class > class FaceList> | |
Foam::pointField | calcFaceCentres (const FaceList< face > &faces, const pointField &points, const label start, const label size) |
Static Public Member Functions | |
static labelList | faceLabels (const polyPatch &) |
Utility functions. More... | |
static Map< label > | makeMap (const labelList &) |
Create Map from List. More... | |
static Map< labelList > | makeMap (const labelListList &) |
Private Member Functions | |
void | writePointsFaces () const |
Write connections between corresponding points and faces. More... | |
void | writeEdges (const labelList &, const labelList &) const |
Write connections between corresponding edges as .obj files. More... | |
labelList | findMappedEdges (const edgeList &edges, const labelList &pointMap, const indirectPrimitivePatch &) |
Find corresponding edges on patch when having only a map for. More... | |
bool | regionEdge (const polyMesh &, const label slaveEdgeI) const |
Check if edge on slavePatch corresponds to an edge between faces. More... | |
label | mostAlignedCutEdge (const bool report, const polyMesh &slaveMesh, const bool patchDivision, const labelList &cutToMasterEdges, const labelList &cutToSlaveEdges, const label pointI, const label edgeStart, const label edgeEnd) const |
Finds edge connected to point most aligned with master edge. More... | |
void | setCutEdgeToPoints (const labelList &cutToMasterEdges) |
From (many-to-one) map of cut edges to master edges determine. More... | |
label | growCutFaces (const labelList &, Map< labelList > &) |
Grow cutToMasterFace across 'internal' edges. More... | |
void | checkMatch (const labelList &cutToMasterEdges) const |
label | matchEdgeFaces (const labelList &, Map< labelList > &candidates) |
Gets a list of cutFaces (that use a master edge) and the. More... | |
label | geometricMatchEdgeFaces (Map< labelList > &candidates) |
Gets a list of cutFaces (that use a master edge) and the. More... | |
void | perfectSlavePointMatch (const scalar absTol) |
Used by perfectPointMatch. Determine match from cut points to. More... | |
void | perfectPointMatch (const scalar absTol, const bool) |
Find point and edge correspondence for perfect matching faces. More... | |
void | subDivisionMatch (const polyMesh &slaveMesh, const bool patchDivision, const scalar absTol) |
Find point and edge correspondence for slaves being subdivision of. More... | |
Static Private Member Functions | |
template<template< class > class FaceList> | |
static pointField | calcFaceCentres (const FaceList< face > &, const pointField &, const label start, const label size) |
Calculate face centres from (subset of) faces. More... | |
static void | writeOBJ (const fileName &fName, const edgeList &edges, const pointField &points, const bool compact=true) |
Write edges. More... | |
static void | writeOBJ (const fileName &fName, const pointField &points0, const pointField &points1) |
Write edges. More... | |
static label | matchFaces (const scalar absTol, const pointField &points0, const face &f0, const pointField &points1, const face &f1, const bool sameOrientation) |
Matches two faces.Determines rotation for f1 to match up. More... | |
static bool | matchPointsThroughFaces (const scalar absTol, const pointField &cutPoints, const faceList &cutFaces, const pointField &patchPoints, const faceList &patchFaces, const bool sameOrientation, labelList &patchToCutPoints, labelList &cutToCompact, labelList &compactToCut) |
Matches points on patch to points on cut. More... | |
static scalar | maxDistance (const face &cutF, const pointField &cutPoints, const face &masterF, const pointField &masterPoints) |
Returns max distance to masterF of any point on cutF. More... | |
static void | findPerfectMatchingFaces (const primitiveMesh &mesh0, const primitiveMesh &mesh1, const scalar absTol, labelList &mesh0Faces, labelList &mesh1Faces) |
Finds matching (boundary)face centres. More... | |
static void | findSlavesCoveringMaster (const primitiveMesh &mesh0, const primitiveMesh &mesh1, const scalar absTol, labelList &mesh0Faces, labelList &mesh1Faces) |
Find matching (boundary)faces. Matching if slave is on top of. More... | |
Private Attributes | |
autoPtr< indirectPrimitivePatch > | masterPatchPtr_ |
Master patch. More... | |
autoPtr< indirectPrimitivePatch > | slavePatchPtr_ |
Slave patch. More... | |
pointField | cutPoints_ |
Description of cut. More... | |
autoPtr< primitiveFacePatch > | cutFacesPtr_ |
labelList | cutToMasterFaces_ |
Additional point coupling information. Is between points on. More... | |
labelList | masterToCutPoints_ |
labelList | cutToSlaveFaces_ |
slave More... | |
labelList | slaveToCutPoints_ |
edgeLookup | cutEdgeToPoints_ |
For edges originating from splitting of edges: More... | |
Static Private Attributes | |
static const scalar | angleTol_ = 1e-3 |
Angle matching tolerance. More... | |
Container for information needed to couple to meshes. When constructed from two meshes and a geometric tolerance finds the corresponding boundary faces.
The information it keeps is the set of faces&points (cutFaces, cutPoints) that should replace a set of faces on the master (masterPatch) and a set of faces on the slave (slavePatch)
Uses same tolerance to match faces and points on matched faces since they both originate from the same points and the tolerance usually comes from writing these points with limited precision (6 by default)
e.g. master: +--+ | | | | +--+ +--+ | | | | +--+ slave: +--+ | | | | +--+ +--+ | | | | +--+
adding both together creates a singly connected 2x2 cavity so suddenly the duplicate master points and the duplicate slave points all become a single cut point.
Notes on multiple slave faces per master:
As long as
So master: +-------+ | | | | | | | | | | | | | | +-------+ slave: +---+---+ |\ | /| | \ | / | | \|/ | +---+---+ | /|\ | | / | \ | |/ | \| +---+---+ is ok.
For this kind of matching the order is:
Note: matching refined faces onto master is a bit dodgy and will probably only work for unwarped faces. Also it will fail if e.g. face is split into 3x3 since then middle face has no point/edge in common with master. (problem is in face matching (findSlavesCoveringMaster), probably point/edge matching might just work)
Definition at line 157 of file faceCoupleInfo.H.
faceCoupleInfo | ( | const polyMesh & | mesh0, |
const polyMesh & | mesh1, | ||
const scalar | absTol, | ||
const bool | perfectMatch | ||
) |
Construct from two meshes and absolute tolerance.
Finds out matches geometrically. No checking for nonsense match. Tolerance is absolute one so use with care. perfectMatch : each point/edge/face has corresponding point on other side if this is false then assumes slave is subdivision. Matching then will work only for non-warped faces since does nearest-to-face comparison with absTol.
Definition at line 1886 of file faceCoupleInfo.C.
References polyMesh::faces(), and polyMesh::points().
faceCoupleInfo | ( | const polyMesh & | masterMesh, |
const labelList & | masterAddressing, | ||
const polyMesh & | slaveMesh, | ||
const labelList & | slaveAddressing, | ||
const scalar | absTol, | ||
const bool | perfectMatch, | ||
const bool | orderedFaces, | ||
const bool | patchDivision | ||
) |
Construct from meshes and subset of mesh faces.
(i.e. indirectPrimitivePatch addressing) All faces in patch are considered matched (but don't have to be ordered) perfectMatch : each point/edge/face has corresponding point on other side orderedFaces : faces in patch are ordered (so masterAddressing[i] matches slaveAddressing[i]) patchDivision: faces in slave mesh that originate from the same master face have the same patch. Used by some triangulation methods.
Definition at line 1976 of file faceCoupleInfo.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, Foam::min(), primitiveMesh::nInternalFaces(), Foam::nl, and List::size().
~faceCoupleInfo | ( | ) |
Destructor.
Definition at line 2064 of file faceCoupleInfo.C.
|
staticprivate |
Calculate face centres from (subset of) faces.
|
staticprivate |
Write edges.
Definition at line 49 of file faceCoupleInfo.C.
References Foam::constant::electromagnetic::e, forAll, Foam::identity(), Foam::nl, points, and writeOBJ().
Referenced by faceCoupleInfo::writePointsFaces().
|
staticprivate |
Write edges.
Writes edges.
Definition at line 102 of file faceCoupleInfo.C.
References Foam::endl(), forAll, Foam::nl, Foam::Pout, and writeOBJ().
|
private |
Write connections between corresponding points and faces.
Writes face and point connectivity as .obj files.
as .obj files.
Definition at line 126 of file faceCoupleInfo.C.
References Foam::constant::universal::c, faceCoupleInfo::cutFaces(), faceCoupleInfo::cutPoints(), faceCoupleInfo::cutToMasterFaces(), faceCoupleInfo::cutToSlaveFaces(), Foam::endl(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), faceCoupleInfo::masterPatch(), faceCoupleInfo::masterToCutPoints_, OFstream::name(), PrimitivePatch< Face, FaceList, PointField, PointType >::points(), Foam::Pout, s(), faceCoupleInfo::slavePatch(), faceCoupleInfo::slaveToCutPoints_, WarningInFunction, Foam::meshTools::writeOBJ(), faceCoupleInfo::writeOBJ(), and Vector< scalar >::zero.
|
private |
Write connections between corresponding edges as .obj files.
Definition at line 228 of file faceCoupleInfo.C.
References Foam::constant::universal::c, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), Foam::endl(), forAll, Foam::invert(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), OFstream::name(), Foam::nl, Foam::Pout, s(), and Foam::meshTools::writeOBJ().
|
private |
Find corresponding edges on patch when having only a map for.
the points.
Definition at line 309 of file faceCoupleInfo.C.
References Foam::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), Foam::meshTools::findEdge(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::pointEdges(), and List::size().
Check if edge on slavePatch corresponds to an edge between faces.
in two different polyPatches on the mesh.
Definition at line 340 of file faceCoupleInfo.C.
References polyMesh::boundaryMesh(), forAll, List::size(), and polyBoundaryMesh::whichPatch().
|
private |
Finds edge connected to point most aligned with master edge.
Definition at line 384 of file faceCoupleInfo.C.
References Foam::e, Foam::endl(), forAll, Foam::mag(), Foam::Pout, and WarningInFunction.
|
private |
From (many-to-one) map of cut edges to master edges determine.
points inbetween. I.e. just string up the edges. Stores this all on cutEdgeToPoints_
Definition at line 503 of file faceCoupleInfo.C.
References Foam::abort(), DynamicList::append(), Foam::e, Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::invertOneToMany(), Foam::nl, List::resize(), DynamicList::shrink(), and List::size().
|
staticprivate |
Matches two faces.Determines rotation for f1 to match up.
with f0, i.e. the index in f0 of the first point of f1.
Definition at line 638 of file faceCoupleInfo.C.
References Foam::abort(), f1, Foam::FatalError, FatalErrorInFunction, forAll, Foam::magSqr(), Foam::nl, List::size(), and Foam::sqr().
|
staticprivate |
Matches points on patch to points on cut.
Definition at line 722 of file faceCoupleInfo.C.
References DynamicList::append(), forAll, Foam::min(), patchFaces(), List::setSize(), and List::size().
|
staticprivate |
Returns max distance to masterF of any point on cutF.
Definition at line 870 of file faceCoupleInfo.C.
References PointHit::distance(), forAll, Foam::max(), and face::nearestPoint().
|
staticprivate |
Finds matching (boundary)face centres.
Since faces identical uses geometric match on face centres.
Definition at line 892 of file faceCoupleInfo.C.
References Foam::endl(), primitiveMesh::faces(), forAll, Foam::matchPoints(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), primitiveMesh::points(), Foam::Pout, List::setSize(), and Foam::Warning.
|
staticprivate |
Find matching (boundary)faces. Matching if slave is on top of.
master face (slaves is subdivision of master)
Definition at line 978 of file faceCoupleInfo.C.
References Foam::e, Foam::endl(), treeBoundBox::extend(), f1, primitiveMesh::faces(), indexedOctree::findNearest(), forAll, HashSet< Key, Hash >::insert(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), primitiveMesh::points(), Foam::Pout, rndGen(), indexedOctree::shapes(), HashTable::size(), Foam::sqr(), and HashTable::toc().
|
private |
Grow cutToMasterFace across 'internal' edges.
Definition at line 1078 of file faceCoupleInfo.C.
References Foam::abort(), Foam::e, Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, face::points(), and Foam::Pout.
|
private |
Definition at line 1191 of file faceCoupleInfo.C.
References Foam::abort(), Foam::e, Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, and face::points().
|
private |
Gets a list of cutFaces (that use a master edge) and the.
candidate master faces. Checks among these master faces if there is only one remaining unmatched one.
Definition at line 1250 of file faceCoupleInfo.C.
References DynamicList::append(), Foam::endl(), Foam::findIndex(), forAll, Foam::Pout, DynamicList::shrink(), and List::size().
|
private |
Gets a list of cutFaces (that use a master edge) and the.
candidate master faces. Finds most aligned master face.
Definition at line 1355 of file faceCoupleInfo.C.
References Foam::endl(), forAll, forAllConstIter(), Foam::invertOneToMany(), points, and Foam::Pout.
|
private |
Used by perfectPointMatch. Determine match from cut points to.
slave points (for perfect matching faces)
|
private |
Find point and edge correspondence for perfect matching faces.
Definition at line 1444 of file faceCoupleInfo.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::identity(), Foam::inplaceRenumber(), Foam::matchPoints(), Foam::nl, points, Foam::Pout, Foam::renumber(), Foam::reorder(), and List::size().
|
private |
Find point and edge correspondence for slaves being subdivision of.
master.
Definition at line 1574 of file faceCoupleInfo.C.
References Foam::abort(), Foam::e, Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::identity(), Foam::matchPoints(), OFstream::name(), Foam::nl, nPoints, points, Foam::Pout, writeEdges(), writeOBJ(), and Foam::meshTools::writeOBJ().
ClassName | ( | "faceCoupleInfo" | ) |
Runtime type information.
|
static |
Utility functions.
Get patch face labels
Definition at line 2070 of file faceCoupleInfo.C.
References forAll, and polyPatch::start().
|
static |
Definition at line 2084 of file faceCoupleInfo.C.
References forAll, and List::size().
|
static |
Definition at line 2100 of file faceCoupleInfo.C.
References forAll, and List::size().
|
inline |
Addressing engine for coupled faces on mesh0.
Definition at line 441 of file faceCoupleInfo.H.
References faceCoupleInfo::masterPatchPtr_.
Referenced by polyMeshAdder::mergePrimitives(), and faceCoupleInfo::writePointsFaces().
|
inline |
Addressing engine for coupled faces on mesh1.
Definition at line 447 of file faceCoupleInfo.H.
References faceCoupleInfo::slavePatchPtr_.
Referenced by polyMeshAdder::mergePrimitives(), and faceCoupleInfo::writePointsFaces().
|
inline |
Addressing engine for combined set of faces.
Definition at line 453 of file faceCoupleInfo.H.
References faceCoupleInfo::cutFacesPtr_.
Referenced by polyMeshAdder::add(), polyMeshAdder::mergePrimitives(), and faceCoupleInfo::writePointsFaces().
|
inline |
Points for combined set of faces.
Definition at line 459 of file faceCoupleInfo.H.
References faceCoupleInfo::cutPoints_.
Referenced by polyMeshAdder::mergePrimitives(), and faceCoupleInfo::writePointsFaces().
|
inline |
Master face for every face on cut. Will always be at least.
one but there might be multiple cut faces pointing to the same master
Definition at line 470 of file faceCoupleInfo.H.
Referenced by polyMeshAdder::mergePrimitives(), and faceCoupleInfo::writePointsFaces().
|
inline |
Definition at line 474 of file faceCoupleInfo.H.
References faceCoupleInfo::masterToCutPoints_.
Referenced by polyMeshAdder::mergePrimitives().
|
inline |
Definition at line 479 of file faceCoupleInfo.H.
References faceCoupleInfo::cutToSlaveFaces_.
Referenced by polyMeshAdder::mergePrimitives(), and faceCoupleInfo::writePointsFaces().
|
inline |
Definition at line 483 of file faceCoupleInfo.H.
References faceCoupleInfo::slaveToCutPoints_.
Referenced by polyMeshAdder::mergePrimitives().
|
inline |
From two cut points (original edge) to list of inserted.
points
Definition at line 490 of file faceCoupleInfo.H.
Referenced by polyMeshAdder::mergePrimitives().
Foam::pointField calcFaceCentres | ( | const FaceList< face > & | faces, |
const pointField & | points, | ||
const label | start, | ||
const label | size | ||
) |
Definition at line 33 of file faceCoupleInfoTemplates.C.
|
staticprivate |
Angle matching tolerance.
Definition at line 162 of file faceCoupleInfo.H.
|
private |
Master patch.
Definition at line 165 of file faceCoupleInfo.H.
Referenced by faceCoupleInfo::masterPatch().
|
private |
Slave patch.
Definition at line 168 of file faceCoupleInfo.H.
Referenced by faceCoupleInfo::slavePatch().
|
private |
Description of cut.
cut is the finest of master and slave. It can never be coarser than either one of them. (so face addressing we keep is cut-to-master and cut-to-slave)
Definition at line 184 of file faceCoupleInfo.H.
Referenced by faceCoupleInfo::cutPoints().
|
private |
Definition at line 185 of file faceCoupleInfo.H.
Referenced by faceCoupleInfo::cutFaces().
|
private |
Additional point coupling information. Is between points on.
boundary of both meshes. master
Definition at line 193 of file faceCoupleInfo.H.
|
private |
Definition at line 194 of file faceCoupleInfo.H.
Referenced by faceCoupleInfo::masterToCutPoints(), and faceCoupleInfo::writePointsFaces().
|
private |
slave
Definition at line 197 of file faceCoupleInfo.H.
Referenced by faceCoupleInfo::cutToSlaveFaces().
|
private |
Definition at line 198 of file faceCoupleInfo.H.
Referenced by faceCoupleInfo::slaveToCutPoints(), and faceCoupleInfo::writePointsFaces().
|
private |
For edges originating from splitting of edges:
given the two endpoints of the unsplit edge give the list of inbetween vertices
Definition at line 203 of file faceCoupleInfo.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.