Loading...
Searching...
No Matches
cellMatcher Class Referenceabstract

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...

#include <cellMatcher.H>

Inheritance diagram for cellMatcher:
Collaboration diagram for cellMatcher:

Public Member Functions

 cellMatcher (const label vertPerCell, const label facePerCell, const label maxVertPerFace, const word &cellModelName)
 Construct for shape factors.
virtual ~cellMatcher ()=default
 Destructor.
const Map< label > & localPoint () const
const faceListlocalFaces () const
const labelListfaceSize () const
const labelListpointMap () const
const labelListfaceMap () const
const labelListedgeFaces () const
const labelListListpointFaceIndex () const
const labelListvertLabels () const
const labelListfaceLabels () const
const cellModelmodel () 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.
virtual bool faceSizeMatch (const faceList &, const labelList &) const =0
 Check whether number of face sizes match the shape.
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.
virtual bool isA (const primitiveMesh &mesh, const label celli)=0
 Exact match. Uses faceSizeMatch.
virtual bool isA (const faceList &)=0
 Exact match given all the faces forming a cell. No checks.
virtual bool matches (const primitiveMesh &mesh, const label celli, cellShape &shape)=0
 Like isA but also constructs a cellShape (if shape matches).

Protected Member Functions

label calcLocalFaces (const faceList &faces, const labelList &myFaces)
 Calculates localFaces. Returns number of local vertices (or -1.
void calcEdgeAddressing (const label numVert)
 Fill edge (start, end) to face number.
void calcPointFaceIndex ()
 Fill vertex/face to index in face data structure.
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.
 cellMatcher (const cellMatcher &)=delete
 No copy construct.
cellMatcheroperator= (const cellMatcher &)=delete
 No copy assignment.

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.
static label nextVert (const label, const label, const bool)
 Step along face either in righthand or lefthand direction.

Protected Attributes

Map< label > localPoint_
faceList localFaces_
 Faces using local vertex numbering.
labelList faceSize_
 Number of vertices per face in localFaces_.
labelList pointMap_
 Map from local to mesh vertex numbering.
labelList faceMap_
 Map from local to mesh face numbering.
labelList edgeFaces_
 Map from 'edge' to neighbouring faces.
labelListList pointFaceIndex_
 pointFaceIndex[localVertI][localFacei] is index in localFace
labelList vertLabels_
 After matching: holds mesh vertices in cellmodel order.
labelList faceLabels_
 After matching: holds mesh faces in cellmodel order.
const word cellModelName_
 CellModel name.
const cellModelcellModelPtr_

Detailed Description

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.

For example,

    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 n
  • hexFaceLabels[n] is face label of hex vertex n

Process of cellShape recognition consists of following steps:

  • renumber vertices of cell to local vertex numbers
  • construct (local to cell) addressing edge-to-faces
  • construct (local to cell) addressing vertex and face to index in face
  • find most unique face shape (e.g. triangle for prism)
  • walk (following either vertices in face or jumping from face to other face) to other faces and checking face sizes.
  • if necessary try other rotations of this face (only necessary for wedge, tet-wedge)
  • if necessary try other faces which most unique face shape (never necessary for hex degenerates)

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.

Source files

Definition at line 95 of file cellMatcher.H.

Constructor & Destructor Documentation

◆ cellMatcher() [1/2]

cellMatcher ( const cellMatcher & )
protecteddelete

No copy construct.

References cellMatcher().

Referenced by cellMatcher(), hexMatcher::hexMatcher(), operator=(), prismMatcher::prismMatcher(), pyrMatcher::pyrMatcher(), tetMatcher::tetMatcher(), tetWedgeMatcher::tetWedgeMatcher(), and wedgeMatcher::wedgeMatcher().

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

◆ cellMatcher() [2/2]

cellMatcher ( const label vertPerCell,
const label facePerCell,
const label maxVertPerFace,
const word & cellModelName )

Construct for shape factors.

Definition at line 32 of file cellMatcher.C.

References cellModelName_, cellModelPtr_, edgeFaces_, f(), faceLabels_, faceMap_, faceSize_, localFaces_, localPoint_, pointFaceIndex_, pointMap_, and vertLabels_.

Here is the call graph for this function:

◆ ~cellMatcher()

virtual ~cellMatcher ( )
virtualdefault

Destructor.

References os().

Here is the call graph for this function:

Member Function Documentation

◆ edgeKey()

Foam::label edgeKey ( const label numVert,
const label v0,
const label v1 )
inlinestaticprotected

Given start and end of edge generate unique key.

Definition at line 89 of file cellMatcherI.H.

Referenced by calcEdgeAddressing(), and otherFace().

Here is the caller graph for this function:

◆ nextVert()

Foam::label nextVert ( const label localVertI,
const label size,
const bool rightHand )
inlinestaticprotected

Step along face either in righthand or lefthand direction.

Definition at line 101 of file cellMatcherI.H.

Referenced by hexMatcher::matchShape(), prismMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), tetWedgeMatcher::matchShape(), and wedgeMatcher::matchShape().

Here is the caller graph for this function:

◆ calcLocalFaces()

Foam::label calcLocalFaces ( const faceList & faces,
const labelList & myFaces )
protected

Calculates localFaces. Returns number of local vertices (or -1.

if more than vertPerCell).

Definition at line 66 of file cellMatcher.C.

References f(), faceMap_, faceSize_, forAll, forAllConstIters, localFaces_, localPoint_, and pointMap_.

Referenced by hexMatcher::matchShape(), prismMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), tetWedgeMatcher::matchShape(), and wedgeMatcher::matchShape().

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

◆ calcEdgeAddressing()

void calcEdgeAddressing ( const label numVert)
protected

Fill edge (start, end) to face number.

Definition at line 130 of file cellMatcher.C.

References Foam::abort(), edgeFaces_, edgeKey(), f(), faceSize_, Foam::FatalError, FatalErrorInFunction, forAll, and localFaces_.

Referenced by hexMatcher::matchShape(), prismMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), tetWedgeMatcher::matchShape(), and wedgeMatcher::matchShape().

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

◆ calcPointFaceIndex()

void calcPointFaceIndex ( )
protected

Fill vertex/face to index in face data structure.

Definition at line 179 of file cellMatcher.C.

References f(), faceSize_, forAll, localFaces_, and pointFaceIndex_.

Referenced by hexMatcher::matchShape(), prismMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), tetWedgeMatcher::matchShape(), and wedgeMatcher::matchShape().

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

◆ otherFace()

Foam::label otherFace ( const label numVert,
const label v0,
const label v1,
const label localFacei ) const
protected

Given start,end of edge lookup both faces sharing it and return.

face != localFacei

Definition at line 205 of file cellMatcher.C.

References Foam::abort(), edgeFaces_, edgeKey(), Foam::FatalError, and FatalErrorInFunction.

Referenced by hexMatcher::matchShape(), prismMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), tetWedgeMatcher::matchShape(), and wedgeMatcher::matchShape().

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

◆ operator=()

cellMatcher & operator= ( const cellMatcher & )
protecteddelete

No copy assignment.

References cellMatcher().

Here is the call graph for this function:

◆ localPoint()

const Foam::Map< Foam::label > & localPoint ( ) const
inline

Definition at line 23 of file cellMatcherI.H.

References localPoint_.

◆ localFaces()

const Foam::faceList & localFaces ( ) const
inline

Definition at line 29 of file cellMatcherI.H.

References localFaces_.

◆ faceSize()

const Foam::labelList & faceSize ( ) const
inline

Definition at line 35 of file cellMatcherI.H.

References faceSize_.

◆ pointMap()

const Foam::labelList & pointMap ( ) const
inline

Definition at line 41 of file cellMatcherI.H.

References pointMap_.

◆ faceMap()

const Foam::labelList & faceMap ( ) const
inline

Definition at line 47 of file cellMatcherI.H.

References faceMap_.

◆ edgeFaces()

const Foam::labelList & edgeFaces ( ) const
inline

Definition at line 53 of file cellMatcherI.H.

References edgeFaces_.

◆ pointFaceIndex()

const Foam::labelListList & pointFaceIndex ( ) const
inline

Definition at line 59 of file cellMatcherI.H.

References pointFaceIndex_.

◆ vertLabels()

const Foam::labelList & vertLabels ( ) const
inline

Definition at line 65 of file cellMatcherI.H.

References vertLabels_.

Referenced by hexMatcher::matches(), prismMatcher::matches(), pyrMatcher::matches(), tetMatcher::matches(), tetWedgeMatcher::matches(), and wedgeMatcher::matches().

Here is the caller graph for this function:

◆ faceLabels()

const Foam::labelList & faceLabels ( ) const
inline

Definition at line 71 of file cellMatcherI.H.

References faceLabels_.

◆ model()

const Foam::cellModel & model ( ) const
inline

Definition at line 77 of file cellMatcherI.H.

References cellModelName_, cellModelPtr_, and cellModel::ptr().

Referenced by hexMatcher::matches(), prismMatcher::matches(), pyrMatcher::matches(), tetMatcher::matches(), tetWedgeMatcher::matches(), and wedgeMatcher::matches().

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

◆ write()

void write ( Foam::Ostream & os) const

Definition at line 235 of file cellMatcher.C.

References Foam::endl(), faceMap_, faceSize_, forAll, localFaces_, Foam::nl, os(), and pointMap_.

Here is the call graph for this function:

◆ nVertPerCell()

virtual label nVertPerCell ( ) const
pure virtual

◆ nFacePerCell()

virtual label nFacePerCell ( ) const
pure virtual

◆ nMaxVertPerFace()

virtual label nMaxVertPerFace ( ) const
pure virtual

◆ faceHashValue()

virtual label faceHashValue ( ) const
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.

◆ faceSizeMatch()

virtual bool faceSizeMatch ( const faceList & ,
const labelList &  ) const
pure virtual

Check whether number of face sizes match the shape.

Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.

◆ matchShape()

virtual bool matchShape ( const bool checkOnly,
const faceList & faces,
const labelList & faceOwner,
const label celli,
const labelList & myFaces )
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.

◆ isA() [1/2]

virtual bool isA ( const primitiveMesh & mesh,
const label celli )
pure virtual

Exact match. Uses faceSizeMatch.

Returns true if cell matches shape exactly.

Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.

References mesh.

◆ isA() [2/2]

virtual bool isA ( const faceList & )
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.

◆ matches()

virtual bool matches ( const primitiveMesh & mesh,
const label celli,
cellShape & shape )
pure virtual

Like isA but also constructs a cellShape (if shape matches).

Implemented in hexMatcher, prismMatcher, pyrMatcher, tetMatcher, tetWedgeMatcher, and wedgeMatcher.

References mesh.

Member Data Documentation

◆ localPoint_

Map<label> localPoint_
protected

Definition at line 120 of file cellMatcher.H.

Referenced by calcLocalFaces(), cellMatcher(), and localPoint().

◆ localFaces_

◆ faceSize_

◆ pointMap_

◆ faceMap_

◆ edgeFaces_

labelList edgeFaces_
protected

Map from 'edge' to neighbouring faces.

Definition at line 145 of file cellMatcher.H.

Referenced by calcEdgeAddressing(), cellMatcher(), edgeFaces(), and otherFace().

◆ pointFaceIndex_

labelListList pointFaceIndex_
protected

pointFaceIndex[localVertI][localFacei] is index in localFace

where localVertI is.

Definition at line 152 of file cellMatcher.H.

Referenced by calcPointFaceIndex(), cellMatcher(), hexMatcher::matchShape(), prismMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), tetWedgeMatcher::matchShape(), wedgeMatcher::matchShape(), and pointFaceIndex().

◆ vertLabels_

labelList vertLabels_
protected

◆ faceLabels_

labelList faceLabels_
protected

◆ cellModelName_

const word cellModelName_
protected

CellModel name.

Definition at line 167 of file cellMatcher.H.

Referenced by cellMatcher(), and model().

◆ cellModelPtr_

const cellModel* cellModelPtr_
mutableprotected

Definition at line 169 of file cellMatcher.H.

Referenced by cellMatcher(), and model().


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