Base class for cellshape matchers (hexMatch, prismMatch, etc.). These are classes which given a mesh and cell number find out the orientation of the cellShape and construct cell-vertex to mesh-vertex mapping and cell-face to mesh-face mapping. More...
Public Member Functions | |
cellMatcher (const label vertPerCell, const label facePerCell, const label maxVertPerFace, const word &cellModelName) | |
Construct given mesh and shape factors. More... | |
virtual | ~cellMatcher () |
Destructor. More... | |
const Map< label > & | localPoint () const |
const faceList & | localFaces () const |
const labelList & | faceSize () const |
const labelList & | pointMap () const |
const labelList & | faceMap () const |
const labelList & | edgeFaces () const |
const labelListList & | pointFaceIndex () const |
const labelList & | vertLabels () const |
const labelList & | faceLabels () const |
const cellModel & | model () const |
void | write (Ostream &os) const |
virtual label | nVertPerCell () const =0 |
virtual label | nFacePerCell () const =0 |
virtual label | nMaxVertPerFace () const =0 |
virtual label | faceHashValue () const =0 |
Hash value of all face sizes of this shape. Can be used for. More... | |
virtual bool | faceSizeMatch (const faceList &, const labelList &) const =0 |
Check whether number of face sizes match the shape. More... | |
virtual bool | matchShape (const bool checkOnly, const faceList &faces, const labelList &faceOwner, const label celli, const labelList &myFaces)=0 |
Low level shape recognition. Return true if matches. More... | |
virtual bool | isA (const primitiveMesh &mesh, const label celli)=0 |
Exact match. Uses faceSizeMatch. More... | |
virtual bool | isA (const faceList &)=0 |
Exact match given all the faces forming a cell. No checks. More... | |
virtual bool | matches (const primitiveMesh &mesh, const label celli, cellShape &shape)=0 |
Like isA but also constructs a cellShape (if shape matches) More... | |
Protected Member Functions | |
label | calcLocalFaces (const faceList &faces, const labelList &myFaces) |
Calculates localFaces. Returns number of local vertices (or -1. More... | |
void | calcEdgeAddressing (const label numVert) |
Fill edge (start, end) to face number. More... | |
void | calcPointFaceIndex () |
Fill vertex/face to index in face data structure. More... | |
label | otherFace (const label numVert, const label v0, const label v1, const label localFacei) const |
Given start,end of edge lookup both faces sharing it and return. More... | |
Static Protected Member Functions | |
static label | edgeKey (const label numVert, const label v0, const label v1) |
Given start and end of edge generate unique key. More... | |
static label | nextVert (const label, const label, const bool) |
Step along face either in righthand or lefthand direction. More... | |
Protected Attributes | |
Map< label > | localPoint_ |
faceList | localFaces_ |
Faces using local vertex numbering. More... | |
labelList | faceSize_ |
Number of vertices per face in localFaces_. More... | |
labelList | pointMap_ |
Map from local to mesh vertex numbering. More... | |
labelList | faceMap_ |
Map from local to mesh face numbering. More... | |
labelList | edgeFaces_ |
Map from 'edge' to neighbouring faces. More... | |
labelListList | pointFaceIndex_ |
pointFaceIndex[localVertI][localFacei] is index in localFace More... | |
labelList | vertLabels_ |
After matching: holds mesh vertices in cellmodel order. More... | |
labelList | faceLabels_ |
After matching: holds mesh faces in cellmodel order. More... | |
const word | cellModelName_ |
CellModel name. More... | |
const cellModel * | cellModelPtr_ |
Base class for cellshape matchers (hexMatch, prismMatch, etc.). These are classes which given a mesh and cell number find out the orientation of the cellShape and construct cell-vertex to mesh-vertex mapping and cell-face to mesh-face mapping.
hexMatcher hex(mesh); cellShape shape; .. bool isHex = hex.match(celli, shape);
Now shape is set to the correct Hex cellShape (if isHex is true)
Alternatively there is direct access to the vertex and face mapping:
const labelList& hexVertLabels = hex.vertLabels(); const labelList& hexFaceLabels = hex.faceLabels();
Now
hexVertLabels
[n] is vertex label of hex vertex nhexFaceLabels
[n] is face label of hex vertex nProcess of cellShape recognition consists of following steps:
The whole calculation is done such that no lists are allocated during cell checking. E.g. localFaces_ are always sized to hold max. number of possible face vertices and a separate list is filled which holds the actusl face sizes.
For now all hex-degenerates implemented. Numbering taken from picture in demoGuide.
Definition at line 99 of file cellMatcher.H.
cellMatcher | ( | const label | vertPerCell, |
const label | facePerCell, | ||
const label | maxVertPerFace, | ||
const word & | cellModelName | ||
) |
Construct given mesh and shape factors.
Definition at line 38 of file cellMatcher.C.
References cellMatcher::calcLocalFaces(), f(), forAll, and List< T >::setSize().
|
inlinevirtual |
Destructor.
Definition at line 199 of file cellMatcher.H.
References cellMatcher::edgeFaces(), cellMatcher::faceHashValue(), cellMatcher::faceLabels(), cellMatcher::faceMap(), cellMatcher::faceSize(), cellMatcher::faceSizeMatch(), cellMatcher::isA(), cellMatcher::localFaces(), cellMatcher::localPoint(), cellMatcher::matches(), cellMatcher::matchShape(), mesh, cellMatcher::model(), cellMatcher::nFacePerCell(), cellMatcher::nMaxVertPerFace(), cellMatcher::nVertPerCell(), cellMatcher::pointFaceIndex(), cellMatcher::pointMap(), cellMatcher::vertLabels(), and cellMatcher::write().
|
inlinestaticprotected |
Given start and end of edge generate unique key.
Definition at line 100 of file cellMatcherI.H.
References cellMatcher::nextVert().
Referenced by cellMatcher::calcEdgeAddressing(), cellMatcher::model(), and cellMatcher::otherFace().
|
inlinestaticprotected |
Step along face either in righthand or lefthand direction.
Definition at line 112 of file cellMatcherI.H.
Referenced by cellMatcher::edgeKey(), wedgeMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), prismMatcher::matchShape(), and hexMatcher::matchShape().
|
protected |
Calculates localFaces. Returns number of local vertices (or -1.
if more than vertPerCell).
Definition at line 74 of file cellMatcher.C.
References HashTableCore::end(), f(), HashTable< T, Key, Hash >::find(), forAll, forAllConstIter(), and List< T >::size().
Referenced by cellMatcher::cellMatcher(), wedgeMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), prismMatcher::matchShape(), and hexMatcher::matchShape().
|
protected |
Fill edge (start, end) to face number.
Definition at line 138 of file cellMatcher.C.
References Foam::abort(), cellMatcher::edgeFaces_, cellMatcher::edgeKey(), f(), cellMatcher::faceSize_, Foam::FatalError, FatalErrorInFunction, forAll, and cellMatcher::localFaces_.
Referenced by hexMatcher::matchShape(), wedgeMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), and prismMatcher::matchShape().
|
protected |
Fill vertex/face to index in face data structure.
Definition at line 187 of file cellMatcher.C.
References f(), cellMatcher::faceSize_, forAll, cellMatcher::localFaces_, cellMatcher::otherFace(), and cellMatcher::pointFaceIndex_.
Referenced by hexMatcher::matchShape(), wedgeMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), and prismMatcher::matchShape().
|
protected |
Given start,end of edge lookup both faces sharing it and return.
face != localFacei
Definition at line 216 of file cellMatcher.C.
References Foam::abort(), cellMatcher::edgeFaces_, cellMatcher::edgeKey(), Foam::FatalError, and FatalErrorInFunction.
Referenced by cellMatcher::calcPointFaceIndex(), wedgeMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), prismMatcher::matchShape(), and hexMatcher::matchShape().
|
inline |
Definition at line 32 of file cellMatcherI.H.
References cellMatcher::localPoint_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 38 of file cellMatcherI.H.
References cellMatcher::localFaces_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 44 of file cellMatcherI.H.
References cellMatcher::faceSize_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 50 of file cellMatcherI.H.
References cellMatcher::pointMap_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 56 of file cellMatcherI.H.
References cellMatcher::faceMap_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 62 of file cellMatcherI.H.
References cellMatcher::edgeFaces_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 68 of file cellMatcherI.H.
References cellMatcher::pointFaceIndex_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 74 of file cellMatcherI.H.
References cellMatcher::vertLabels_.
Referenced by hexMatcher::matches(), wedgeMatcher::matches(), tetWedgeMatcher::matches(), tetMatcher::matches(), pyrMatcher::matches(), prismMatcher::matches(), and cellMatcher::~cellMatcher().
|
inline |
Definition at line 80 of file cellMatcherI.H.
References cellMatcher::faceLabels_.
Referenced by cellMatcher::~cellMatcher().
|
inline |
Definition at line 86 of file cellMatcherI.H.
References cellMatcher::cellModelName_, cellMatcher::cellModelPtr_, cellMatcher::edgeKey(), and cellModeller::lookup().
Referenced by hexMatcher::matches(), wedgeMatcher::matches(), tetWedgeMatcher::matches(), tetMatcher::matches(), pyrMatcher::matches(), prismMatcher::matches(), and cellMatcher::~cellMatcher().
void write | ( | Foam::Ostream & | os | ) | const |
Definition at line 247 of file cellMatcher.C.
References Foam::endl(), cellMatcher::faceMap_, cellMatcher::faceSize_, forAll, cellMatcher::localFaces_, and cellMatcher::pointMap_.
Referenced by cellMatcher::~cellMatcher().
|
pure virtual |
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
|
pure virtual |
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
|
pure virtual |
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
|
pure virtual |
Hash value of all face sizes of this shape. Can be used for.
quick initial recognition.
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
Check whether number of face sizes match the shape.
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
|
pure virtual |
Low level shape recognition. Return true if matches.
Works in detection mode only (checkOnly=true) or in exact matching. Returns true and sets vertLabels_. Needs faces, faceOwner of all faces in 'mesh' and cell number and labels of faces for this cell. celli only used in combination with faceOwner to detect owner status.
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
|
pure virtual |
Exact match. Uses faceSizeMatch.
Returns true if cell matches shape exactly.
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
|
pure virtual |
Exact match given all the faces forming a cell. No checks.
on whether faces match up and form a closed shape.
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
|
pure virtual |
Like isA but also constructs a cellShape (if shape matches)
Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.
Referenced by cellMatcher::~cellMatcher().
Definition at line 119 of file cellMatcher.H.
Referenced by cellMatcher::localPoint().
|
protected |
Faces using local vertex numbering.
Definition at line 122 of file cellMatcher.H.
Referenced by cellMatcher::calcEdgeAddressing(), cellMatcher::calcPointFaceIndex(), cellMatcher::localFaces(), tetMatcher::matchShape(), pyrMatcher::matchShape(), tetWedgeMatcher::matchShape(), hexMatcher::matchShape(), wedgeMatcher::matchShape(), prismMatcher::matchShape(), and cellMatcher::write().
|
protected |
Number of vertices per face in localFaces_.
Definition at line 125 of file cellMatcher.H.
Referenced by cellMatcher::calcEdgeAddressing(), cellMatcher::calcPointFaceIndex(), cellMatcher::faceSize(), tetMatcher::matchShape(), pyrMatcher::matchShape(), tetWedgeMatcher::matchShape(), hexMatcher::matchShape(), wedgeMatcher::matchShape(), prismMatcher::matchShape(), and cellMatcher::write().
|
protected |
Map from local to mesh vertex numbering.
Definition at line 128 of file cellMatcher.H.
Referenced by hexMatcher::matchShape(), prismMatcher::matchShape(), tetWedgeMatcher::matchShape(), wedgeMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), cellMatcher::pointMap(), and cellMatcher::write().
|
protected |
Map from local to mesh face numbering.
Definition at line 131 of file cellMatcher.H.
Referenced by cellMatcher::faceMap(), prismMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), wedgeMatcher::matchShape(), hexMatcher::matchShape(), and cellMatcher::write().
|
protected |
Map from 'edge' to neighbouring faces.
Definition at line 134 of file cellMatcher.H.
Referenced by cellMatcher::calcEdgeAddressing(), cellMatcher::edgeFaces(), and cellMatcher::otherFace().
|
protected |
pointFaceIndex[localVertI][localFacei] is index in localFace
where localVertI is.
Definition at line 138 of file cellMatcher.H.
Referenced by cellMatcher::calcPointFaceIndex(), prismMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), wedgeMatcher::matchShape(), hexMatcher::matchShape(), and cellMatcher::pointFaceIndex().
|
protected |
After matching: holds mesh vertices in cellmodel order.
Definition at line 141 of file cellMatcher.H.
Referenced by hexMatcher::matchShape(), wedgeMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), prismMatcher::matchShape(), and cellMatcher::vertLabels().
|
protected |
After matching: holds mesh faces in cellmodel order.
Definition at line 144 of file cellMatcher.H.
Referenced by cellMatcher::faceLabels(), wedgeMatcher::matchShape(), tetWedgeMatcher::matchShape(), tetMatcher::matchShape(), pyrMatcher::matchShape(), prismMatcher::matchShape(), and hexMatcher::matchShape().
|
protected |
|
mutableprotected |
Definition at line 149 of file cellMatcher.H.
Referenced by cellMatcher::model().