Functions | Variables
Foam::meshTools Namespace Reference

Collection of static functions to do various simple mesh related things. More...

Functions

bool visNormal (const vector &n, const vectorField &faceNormals, const labelList &faceLabels)
 Check if n is in same direction as normals of all faceLabels. More...
 
vectorField calcBoxPointNormals (const primitivePatch &pp)
 Calculate point normals on a 'box' mesh (all edges aligned with. More...
 
vector normEdgeVec (const primitiveMesh &, const label edgeI)
 Normalized edge vector. More...
 
void writeOBJ (Ostream &os, const point &pt)
 Write obj representation of point. More...
 
void writeOBJ (Ostream &os, const triad &t, const point &pt)
 Write obj representation of a triad. Requires the location of the. More...
 
void writeOBJ (Ostream &os, const point &p1, const point &p2, label &count)
 Write obj representation of a line connecting two points. More...
 
void writeOBJ (Ostream &os, const point &p1, const point &p2)
 Write obj representation of a point p1 with a vector from p1 to p2. More...
 
template<class FaceType >
void writeOBJ (Ostream &os, const UList< FaceType > &, const pointField &, const labelList &faceLabels)
 Write obj representation of faces subset. More...
 
template<class FaceType >
void writeOBJ (Ostream &os, const UList< FaceType > &, const pointField &)
 Write obj representation of faces. More...
 
void writeOBJ (Ostream &os, const cellList &, const faceList &, const pointField &, const labelList &cellLabels)
 Write obj representation of cell subset. More...
 
bool edgeOnCell (const primitiveMesh &, const label cellI, const label edgeI)
 Is edge used by cell. More...
 
bool edgeOnFace (const primitiveMesh &, const label faceI, const label edgeI)
 Is edge used by face. More...
 
bool faceOnCell (const primitiveMesh &, const label cellI, const label faceI)
 Is face used by cell. More...
 
label findEdge (const edgeList &edges, const labelList &candidates, const label v0, const label v1)
 Return edge among candidates that uses the two vertices. More...
 
label findEdge (const primitiveMesh &, const label v0, const label v1)
 Return edge between two vertices. Returns -1 if no edge. More...
 
label getSharedEdge (const primitiveMesh &, const label f0, const label f1)
 Return edge shared by two faces. Throws error if no edge found. More...
 
label getSharedFace (const primitiveMesh &, const label cell0, const label cell1)
 Return face shared by two cells. Throws error if none found. More...
 
void getEdgeFaces (const primitiveMesh &, const label cellI, const label edgeI, label &face0, label &face1)
 Get faces on cell using edgeI. Throws error if no two found. More...
 
label otherEdge (const primitiveMesh &, const labelList &edgeLabels, const label edgeI, const label vertI)
 Return label of other edge (out of candidates edgeLabels) More...
 
label otherFace (const primitiveMesh &, const label cellI, const label faceI, const label edgeI)
 Return face on cell using edgeI but not faceI. Throws error. More...
 
label otherCell (const primitiveMesh &, const label cellI, const label faceI)
 Return cell on other side of face. Throws error. More...
 
label walkFace (const primitiveMesh &, const label faceI, const label startEdgeI, const label startVertI, const label nEdges)
 Returns label of edge nEdges away from startEdge (in the direction. More...
 
void constrainToMeshCentre (const polyMesh &mesh, point &pt)
 Set the constrained components of position to mesh centre. More...
 
void constrainToMeshCentre (const polyMesh &mesh, pointField &pt)
 
void constrainDirection (const polyMesh &mesh, const Vector< label > &dirs, vector &d)
 Set the constrained components of directions/velocity to zero. More...
 
void constrainDirection (const polyMesh &mesh, const Vector< label > &dirs, vectorField &d)
 
void getParallelEdges (const primitiveMesh &, const label cellI, const label e0, label &, label &, label &)
 Given edge on hex find other 'parallel', non-connected edges. More...
 
vector edgeToCutDir (const primitiveMesh &, const label cellI, const label edgeI)
 Given edge on hex find all 'parallel' (i.e. non-connected) More...
 
label cutDirToEdge (const primitiveMesh &, const label cellI, const vector &cutDir)
 Reverse of edgeToCutDir: given direction find edge bundle and. More...
 

Variables

static const label mXmYmZ = 0
 
static const label pXmYmZ = 1
 
static const label mXpYmZ = 2
 
static const label pXpYmZ = 3
 
static const label mXmYpZ = 4
 
static const label pXmYpZ = 5
 
static const label mXpYpZ = 6
 
static const label pXpYpZ = 7
 
static const label mXmYmZMask = 1 << mXmYmZ
 
static const label pXmYmZMask = 1 << pXmYmZ
 
static const label mXpYmZMask = 1 << mXpYmZ
 
static const label pXpYmZMask = 1 << pXpYmZ
 
static const label mXmYpZMask = 1 << mXmYpZ
 
static const label pXmYpZMask = 1 << pXmYpZ
 
static const label mXpYpZMask = 1 << mXpYpZ
 
static const label pXpYpZMask = 1 << pXpYpZ
 

Detailed Description

Collection of static functions to do various simple mesh related things.

Source files

Function Documentation

bool visNormal ( const vector n,
const vectorField faceNormals,
const labelList faceLabels 
)

Check if n is in same direction as normals of all faceLabels.

Definition at line 34 of file meshTools.C.

References forAll.

Referenced by calcBoxPointNormals().

Here is the caller graph for this function:

Foam::vectorField calcBoxPointNormals ( const primitivePatch pp)
Foam::vector normEdgeVec ( const primitiveMesh mesh,
const label  edgeI 
)

Normalized edge vector.

Definition at line 195 of file meshTools.C.

References primitiveMesh::edges(), Foam::mag(), primitiveMesh::points(), and writeOBJ().

Referenced by calcBoxPointNormals(), edgeToCutDir(), and cellLooper::getMisAlignedEdge().

Here is the call graph for this function:

Here is the caller graph for this function:

void writeOBJ ( Ostream os,
const point pt 
)

Write obj representation of point.

Definition at line 209 of file meshTools.C.

References Foam::endl(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Referenced by mappedPatchBase::calcAMI(), polyDualMesh::calcFeatures(), processorPolyPatch::calcGeometry(), mappedPatchBase::calcMapping(), cyclicPolyPatch::calcTransforms(), triSurface::checkEdges(), hexCellLooper::cut(), meshRefinement::dumpIntersections(), edgeSurface::edgeSurface(), processorPolyPatch::initOrder(), NamedEnum< Enum, nEnum >::names(), surfaceFeatures::nearestEdges(), surfaceFeatures::nearestSamples(), cellCuts::nonAnchorPoints(), normEdgeVec(), ifEqEqOp< value >::operator()(), nearestEqOp::operator()(), oldCyclicPolyPatch::order(), processorPolyPatch::order(), cyclicPolyPatch::order(), dynamicIndexedOctree< Type >::print(), cyclicAMIPolyPatch::resetAMI(), motionSmootherAlgo::setDisplacementPatchFields(), duplicatePoints::setRefinement(), refinementIterator::setRefinement(), faceCollapser::setRefinement(), removeFaces::setRefinement(), hexRef8::setRefinement(), wallBoundedParticle::wallBoundedParticle(), AMIInterpolation< SourcePatch, TargetPatch >::wordTointerpolationMethod(), cellCuts::writeCellOBJ(), AMIInterpolation< SourcePatch, TargetPatch >::writeFaceConnectivity(), AMIMethod< SourcePatch, TargetPatch >::writeIntersectionOBJ(), writeOBJ(), coupledPolyPatch::writeOBJ(), enrichedPatch::writeOBJ(), surfaceFeatures::writeObj(), and cellCuts::writeOBJ().

Here is the call graph for this function:

Here is the caller graph for this function:

void writeOBJ ( Ostream os,
const triad t,
const point pt 
)

Write obj representation of a triad. Requires the location of the.

triad to be supplied

Definition at line 219 of file meshTools.C.

References forAll, and writeOBJ().

Here is the call graph for this function:

void writeOBJ ( Ostream os,
const point p1,
const point p2,
label count 
)

Write obj representation of a line connecting two points.

Need to keep track of points that have been added. count starts at 0

Definition at line 233 of file meshTools.C.

References Foam::endl(), writeOBJ(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

void writeOBJ ( Ostream os,
const point p1,
const point p2 
)

Write obj representation of a point p1 with a vector from p1 to p2.

Definition at line 250 of file meshTools.C.

References Foam::endl(), writeOBJ(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

void writeOBJ ( Ostream os,
const UList< FaceType > &  faces,
const pointField points,
const labelList faceLabels 
)

Write obj representation of faces subset.

Definition at line 28 of file meshToolsTemplates.C.

References Foam::endl(), f(), forAll, List< T >::size(), and writeOBJ().

Here is the call graph for this function:

void writeOBJ ( Ostream os,
const UList< FaceType > &  faces,
const pointField points 
)

Write obj representation of faces.

Definition at line 64 of file meshToolsTemplates.C.

References forAll, UList< T >::size(), and writeOBJ().

Here is the call graph for this function:

void writeOBJ ( Ostream os,
const cellList cells,
const faceList faces,
const pointField points,
const labelList cellLabels 
)

Write obj representation of cell subset.

Definition at line 266 of file meshTools.C.

References edgeOnCell(), forAll, List< T >::size(), and writeOBJ().

Here is the call graph for this function:

bool edgeOnCell ( const primitiveMesh mesh,
const label  cellI,
const label  edgeI 
)

Is edge used by cell.

Definition at line 291 of file meshTools.C.

References primitiveMesh::edgeCells(), edgeOnFace(), and Foam::findIndex().

Referenced by cellLooper::getVertEdgesNonFace(), and writeOBJ().

Here is the call graph for this function:

Here is the caller graph for this function:

bool edgeOnFace ( const primitiveMesh mesh,
const label  faceI,
const label  edgeI 
)

Is edge used by face.

Definition at line 302 of file meshTools.C.

References primitiveMesh::faceEdges(), faceOnCell(), and Foam::findIndex().

Referenced by edgeOnCell(), and cellFeatures::isFeatureVertex().

Here is the call graph for this function:

Here is the caller graph for this function:

bool faceOnCell ( const primitiveMesh mesh,
const label  cellI,
const label  faceI 
)

Is face used by cell.

Definition at line 314 of file meshTools.C.

References primitiveMesh::faceNeighbour(), primitiveMesh::faceOwner(), findEdge(), and primitiveMesh::isInternalFace().

Referenced by edgeOnFace(), getEdgeFaces(), cellLooper::getVertFacesNonEdge(), and cellCuts::nonAnchorPoints().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label findEdge ( const edgeList edges,
const labelList candidates,
const label  v0,
const label  v1 
)

Return edge among candidates that uses the two vertices.

Definition at line 343 of file meshTools.C.

References Foam::constant::electromagnetic::e, and forAll.

Referenced by edgeVertex::cutPairToEdge(), faceOnCell(), hexRef8::getAnchorLevel(), and cellCuts::nonAnchorPoints().

Here is the caller graph for this function:

Foam::label findEdge ( const primitiveMesh mesh,
const label  v0,
const label  v1 
)

Return edge between two vertices. Returns -1 if no edge.

Definition at line 366 of file meshTools.C.

References Foam::constant::electromagnetic::e, primitiveMesh::edges(), edge::end(), forAll, getSharedEdge(), primitiveMesh::pointEdges(), and edge::start().

Here is the call graph for this function:

Foam::label getSharedEdge ( const primitiveMesh mesh,
const label  f0,
const label  f1 
)

Return edge shared by two faces. Throws error if no edge found.

Definition at line 392 of file meshTools.C.

References Foam::abort(), f1, primitiveMesh::faceEdges(), Foam::FatalError, FatalErrorIn, forAll, and getSharedFace().

Referenced by findEdge().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label getSharedFace ( const primitiveMesh mesh,
const label  cell0,
const label  cell1 
)

Return face shared by two cells. Throws error if none found.

Definition at line 428 of file meshTools.C.

References Foam::abort(), primitiveMesh::cells(), primitiveMesh::faceNeighbour(), primitiveMesh::faceOwner(), Foam::FatalError, FatalErrorIn, forAll, getEdgeFaces(), and primitiveMesh::isInternalFace().

Referenced by getSharedEdge(), and undoableMeshCutter::getSplitFaces().

Here is the call graph for this function:

Here is the caller graph for this function:

void getEdgeFaces ( const primitiveMesh mesh,
const label  cellI,
const label  edgeI,
label face0,
label face1 
)

Get faces on cell using edgeI. Throws error if no two found.

Definition at line 470 of file meshTools.C.

References Foam::abort(), primitiveMesh::edgeFaces(), primitiveMesh::edges(), faceOnCell(), Foam::FatalError, FatalErrorIn, forAll, and otherEdge().

Referenced by hexCellLooper::cut(), topoCellLooper::cut(), directionInfo::edgeToFaceIndex(), getSharedFace(), cellLooper::getVertFacesNonEdge(), and otherFace().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label otherEdge ( const primitiveMesh mesh,
const labelList edgeLabels,
const label  edgeI,
const label  vertI 
)

Return label of other edge (out of candidates edgeLabels)

connected to vertex but not edgeI. Throws error if none found.

Definition at line 516 of file meshTools.C.

References Foam::abort(), Foam::constant::electromagnetic::e, primitiveMesh::edges(), edge::end(), Foam::FatalError, FatalErrorIn, forAll, otherFace(), and edge::start().

Referenced by getEdgeFaces(), directionInfo::updateCell(), and walkFace().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label otherFace ( const primitiveMesh mesh,
const label  cellI,
const label  faceI,
const label  edgeI 
)

Return face on cell using edgeI but not faceI. Throws error.

if none found.

Definition at line 554 of file meshTools.C.

References getEdgeFaces(), and otherCell().

Referenced by particle< Type >::crossEdgeConnectedFace(), edgeToCutDir(), getParallelEdges(), otherEdge(), and directionInfo::updateCell().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label otherCell ( const primitiveMesh mesh,
const label  cellI,
const label  faceI 
)

Return cell on other side of face. Throws error.

if face not internal.

Definition at line 579 of file meshTools.C.

References Foam::abort(), primitiveMesh::faceNeighbour(), primitiveMesh::faceOwner(), Foam::FatalError, FatalErrorIn, primitiveMesh::isInternalFace(), and walkFace().

Referenced by otherFace().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label walkFace ( const primitiveMesh mesh,
const label  faceI,
const label  startEdgeI,
const label  startVertI,
const label  nEdges 
)

Returns label of edge nEdges away from startEdge (in the direction.

of startVertI)

Definition at line 608 of file meshTools.C.

References constrainToMeshCentre(), primitiveMesh::edges(), primitiveMesh::faceEdges(), and otherEdge().

Referenced by edgeToCutDir(), directionInfo::edgeToFaceIndex(), getParallelEdges(), and otherCell().

Here is the call graph for this function:

Here is the caller graph for this function:

void constrainToMeshCentre ( const polyMesh mesh,
point pt 
)

Set the constrained components of position to mesh centre.

Definition at line 634 of file meshTools.C.

References polyMesh::bounds(), polyMesh::geometricD(), boundBox::max(), Foam::max(), boundBox::min(), and Foam::min().

Referenced by twoDPointCorrector::correctDisplacement(), twoDPointCorrector::correctPoints(), InjectionModel< CloudType >::inject(), InjectionModel< CloudType >::injectSteadyState(), DSMCParcel< ParcelType >::move(), KinematicParcel< ParcelType >::move(), and walkFace().

Here is the call graph for this function:

Here is the caller graph for this function:

void constrainToMeshCentre ( const polyMesh mesh,
pointField pt 
)

Definition at line 655 of file meshTools.C.

References polyMesh::bounds(), constrainDirection(), forAll, polyMesh::geometricD(), boundBox::max(), Foam::max(), boundBox::min(), and Foam::min().

Here is the call graph for this function:

void constrainDirection ( const polyMesh mesh,
const Vector< label > &  dirs,
vector d 
)

Set the constrained components of directions/velocity to zero.

Definition at line 693 of file meshTools.C.

Referenced by KinematicParcel< ParcelType >::calcVelocity(), constrainToMeshCentre(), InjectionModel< CloudType >::inject(), InjectionModel< CloudType >::injectSteadyState(), DSMCParcel< ParcelType >::move(), and ThermoSurfaceFilm< CloudType >::splashInteraction().

Here is the caller graph for this function:

void constrainDirection ( const polyMesh mesh,
const Vector< label > &  dirs,
vectorField d 
)

Definition at line 710 of file meshTools.C.

References forAll, and getParallelEdges().

Here is the call graph for this function:

void getParallelEdges ( const primitiveMesh mesh,
const label  cellI,
const label  e0,
label e1,
label e2,
label e3 
)

Given edge on hex find other 'parallel', non-connected edges.

Definition at line 743 of file meshTools.C.

References primitiveMesh::edges(), edgeToCutDir(), UList< T >::end(), otherFace(), and walkFace().

Referenced by constrainDirection(), and cutDirToEdge().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::vector edgeToCutDir ( const primitiveMesh mesh,
const label  cellI,
const label  edgeI 
)

Given edge on hex find all 'parallel' (i.e. non-connected)

edges and average direction of them

Definition at line 769 of file meshTools.C.

References Foam::abort(), cutDirToEdge(), primitiveMesh::edges(), UList< T >::end(), Foam::FatalError, FatalErrorIn, Foam::isA(), Foam::mag(), normEdgeVec(), otherFace(), and walkFace().

Referenced by cutDirToEdge(), getParallelEdges(), and NamedEnum< Enum, nEnum >::names().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label cutDirToEdge ( const primitiveMesh mesh,
const label  cellI,
const vector cutDir 
)

Reverse of edgeToCutDir: given direction find edge bundle and.

return one of them.

Definition at line 819 of file meshTools.C.

References Foam::abort(), primitiveMesh::cellEdges(), edgeToCutDir(), Foam::endl(), Foam::FatalError, FatalErrorIn, forAll, getParallelEdges(), Foam::isA(), Foam::mag(), and List< T >::size().

Referenced by hexCellLooper::cut(), edgeToCutDir(), and NamedEnum< Enum, nEnum >::names().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const label mXmYmZ = 0
static

Definition at line 63 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXmYmZ = 1
static

Definition at line 64 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label mXpYmZ = 2
static

Definition at line 65 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXpYmZ = 3
static

Definition at line 66 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label mXmYpZ = 4
static

Definition at line 68 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXmYpZ = 5
static

Definition at line 69 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label mXpYpZ = 6
static

Definition at line 70 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXpYpZ = 7
static

Definition at line 71 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label mXmYmZMask = 1 << mXmYmZ
static

Definition at line 73 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXmYmZMask = 1 << pXmYmZ
static

Definition at line 74 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label mXpYmZMask = 1 << mXpYmZ
static

Definition at line 75 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXpYmZMask = 1 << pXpYmZ
static

Definition at line 76 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label mXmYpZMask = 1 << mXmYpZ
static

Definition at line 78 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXmYpZMask = 1 << pXmYpZ
static

Definition at line 79 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label mXpYpZMask = 1 << mXpYpZ
static

Definition at line 80 of file meshTools.H.

Referenced by calcBoxPointNormals().

const label pXpYpZMask = 1 << pXpYpZ
static

Definition at line 81 of file meshTools.H.

Referenced by calcBoxPointNormals().