Loading...
Searching...
No Matches
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.
vectorField calcBoxPointNormals (const primitivePatch &pp)
 Calculate point normals on a 'box' mesh (all edges aligned with.
vector normEdgeVec (const primitiveMesh &, const label edgeI)
 Normalized edge vector.
void writeOBJ (Ostream &os, const point &pt)
 Write obj representation of a point.
void writeOBJ (Ostream &os, const UList< point > &pts)
 Write obj representation of points.
void writeOBJ (Ostream &os, const triad &t, const point &origin)
 Write obj representation of a triad. Requires the origin of the.
void writeOBJ (Ostream &os, const point &p1, const point &p2, label &count)
 Write obj representation of a line connecting two points.
void writeOBJ (Ostream &os, const point &p1, const point &p2)
 Write obj representation of a point p1 with a vector from p1 to p2.
void writeOBJ (Ostream &os, const treeBoundBox &bb)
 Write obj representation of tree-bounding box as a series of lines.
template<class FaceType>
void writeOBJ (Ostream &os, const UList< FaceType > &faces, const UList< point > &points, const labelList &faceLabels)
 Write obj representation of faces subset.
template<class FaceType>
void writeOBJ (Ostream &os, const UList< FaceType > &faces, const UList< point > &points)
 Write obj representation of faces.
void writeOBJ (Ostream &os, const cellList &cells, const faceList &faces, const UList< point > &points, const labelList &cellLabels)
 Write obj representation of cell subset.
bool edgeOnCell (const primitiveMesh &mesh, const label celli, const label edgeI)
 Is edge used by cell.
bool edgeOnFace (const primitiveMesh &mesh, const label facei, const label edgeI)
 Is edge used by face.
bool faceOnCell (const primitiveMesh &mesh, const label celli, const label facei)
 Is face used by cell.
label findEdge (const edgeList &edges, const labelList &candidates, const label v0, const label v1)
 Return edge among candidates that uses the two vertices.
label findEdge (const primitiveMesh &mesh, const label v0, const label v1)
 Return edge between two mesh vertices. Returns -1 if no edge.
label getSharedEdge (const primitiveMesh &mesh, const label f0, const label f1)
 Return edge shared by two faces. Throws error if no edge found.
label getSharedFace (const primitiveMesh &mesh, const label cell0, const label cell1)
 Return face shared by two cells. Throws error if none found.
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.
label otherEdge (const primitiveMesh &mesh, const labelList &edgeLabels, const label thisEdgeI, const label thisVertI)
 Return label of other edge (out of candidates edgeLabels).
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.
label otherCell (const primitiveMesh &mesh, const label celli, const label facei)
 Return cell on other side of face. Throws error.
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.
void constrainToMeshCentre (const polyMesh &mesh, point &pt)
 Set the constrained components of position to mesh centre.
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.
void constrainDirection (const polyMesh &mesh, const Vector< label > &dirs, vectorField &d)
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.
vector edgeToCutDir (const primitiveMesh &mesh, const label celli, const label edgeI)
 Given edge on hex find all 'parallel' (i.e. non-connected).
label cutDirToEdge (const primitiveMesh &mesh, const label celli, const vector &cutDir)
 Reverse of edgeToCutDir: given direction find edge bundle and.
labelList bandCompression (const polyMesh &mesh)
 Renumber (mesh) addressing to reduce the band of the mesh connectivity, using the Cuthill-McKee algorithm.
labelList bandCompression (const CompactListList< label > &addressing)
 Renumber (mesh) addressing to reduce the band of the matrix, using the Cuthill-McKee algorithm.
labelList bandCompression (const labelListList &addressing)
 Renumber (mesh) addressing to reduce the band of the matrix, using the Cuthill-McKee algorithm.
labelList bandCompression (const labelUList &cellCells, const labelUList &offsets)
 Renumber with addressing in losort form (neighbour + start in neighbour), using the Cuthill-McKee algorithm.

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

◆ visNormal()

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 29 of file meshTools.C.

References faceLabels(), forAll, and n.

Referenced by calcBoxPointNormals().

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

◆ calcBoxPointNormals()

Foam::vectorField calcBoxPointNormals ( const primitivePatch & pp)

Calculate point normals on a 'box' mesh (all edges aligned with.

coordinate axes)

Definition at line 49 of file meshTools.C.

References Foam::endl(), forAll, Foam::mag(), mXmYmZ, mXmYmZMask, mXmYpZ, mXmYpZMask, mXpYmZ, mXpYmZMask, mXpYpZ, mXpYpZMask, n, Foam::nl, pFaces, pp(), pXmYmZ, pXmYmZMask, pXmYpZ, pXmYpZMask, pXpYmZ, pXpYmZMask, pXpYpZ, pXpYpZMask, visNormal(), WarningInFunction, and Foam::Zero.

Here is the call graph for this function:

◆ normEdgeVec()

Foam::vector normEdgeVec ( const primitiveMesh & mesh,
const label edgeI )

Normalized edge vector.

Definition at line 185 of file meshTools.C.

References mesh.

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

Here is the caller graph for this function:

◆ writeOBJ() [1/9]

◆ writeOBJ() [2/9]

void writeOBJ ( Ostream & os,
const UList< point > & pts )

Write obj representation of points.

Definition at line 205 of file meshTools.C.

References forAll, Foam::nl, os(), pts, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ writeOBJ() [3/9]

void writeOBJ ( Ostream & os,
const triad & t,
const point & origin )

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

triad to be supplied

Definition at line 220 of file meshTools.C.

References forAll, os(), and writeOBJ().

Here is the call graph for this function:

◆ writeOBJ() [4/9]

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 234 of file meshTools.C.

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

Here is the call graph for this function:

◆ writeOBJ() [5/9]

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(), Foam::nl, os(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ writeOBJ() [6/9]

void writeOBJ ( Ostream & os,
const treeBoundBox & bb )

Write obj representation of tree-bounding box as a series of lines.

Definition at line 265 of file meshTools.C.

References e, treeBoundBox::edges, Foam::nl, os(), treeBoundBox::points(), and writeOBJ().

Here is the call graph for this function:

◆ writeOBJ() [7/9]

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

Write obj representation of faces subset.

Definition at line 23 of file meshToolsTemplates.C.

References Foam::endl(), f(), faceLabels(), forAll, HashTable< T, Key, Hash >::insert(), os(), points, and writeOBJ().

Here is the call graph for this function:

◆ writeOBJ() [8/9]

template<class FaceType>
void writeOBJ ( Ostream & os,
const UList< FaceType > & faces,
const UList< point > & points )

Write obj representation of faces.

Definition at line 59 of file meshToolsTemplates.C.

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

Here is the call graph for this function:

◆ writeOBJ() [9/9]

void writeOBJ ( Ostream & os,
const cellList & cells,
const faceList & faces,
const UList< point > & points,
const labelList & cellLabels )

Write obj representation of cell subset.

Definition at line 280 of file meshTools.C.

References cells, HashSet< Key, Hash >::insert(), os(), points, UList< T >::size(), HashTable< T, Key, Hash >::toc(), and writeOBJ().

Here is the call graph for this function:

◆ edgeOnCell()

bool edgeOnCell ( const primitiveMesh & mesh,
const label celli,
const label edgeI )

Is edge used by cell.

Definition at line 300 of file meshTools.C.

References mesh.

Referenced by cellLooper::getVertEdgesNonFace().

Here is the caller graph for this function:

◆ edgeOnFace()

bool edgeOnFace ( const primitiveMesh & mesh,
const label facei,
const label edgeI )

Is edge used by face.

Definition at line 311 of file meshTools.C.

References mesh.

Referenced by cellFeatures::isFeatureVertex().

Here is the caller graph for this function:

◆ faceOnCell()

bool faceOnCell ( const primitiveMesh & mesh,
const label celli,
const label facei )

Is face used by cell.

Definition at line 322 of file meshTools.C.

References mesh.

Referenced by getEdgeFaces(), and cellLooper::getVertFacesNonEdge().

Here is the caller graph for this function:

◆ findEdge() [1/2]

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 351 of file meshTools.C.

References e, and forAll.

Referenced by edgeVertex::cutPairToEdge().

Here is the caller graph for this function:

◆ findEdge() [2/2]

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

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

Definition at line 374 of file meshTools.C.

References e, forAll, and mesh.

◆ getSharedEdge()

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 400 of file meshTools.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, and mesh.

Here is the call graph for this function:

◆ getSharedFace()

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 433 of file meshTools.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, and mesh.

Referenced by undoableMeshCutter::getSplitFaces().

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

◆ getEdgeFaces()

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 471 of file meshTools.C.

References Foam::abort(), faceOnCell(), Foam::FatalError, FatalErrorInFunction, forAll, and mesh.

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

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

◆ otherEdge()

Foam::label otherEdge ( const primitiveMesh & mesh,
const labelList & edgeLabels,
const label thisEdgeI,
const label thisVertI )

Return label of other edge (out of candidates edgeLabels).

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

Definition at line 513 of file meshTools.C.

References Foam::abort(), e, Foam::FatalError, FatalErrorInFunction, forAll, and mesh.

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

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

◆ otherFace()

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 547 of file meshTools.C.

References getEdgeFaces(), and mesh.

Referenced by edgeToCutDir(), getParallelEdges(), and directionInfo::updateCell().

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

◆ otherCell()

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 571 of file meshTools.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and mesh.

Here is the call graph for this function:

◆ walkFace()

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 595 of file meshTools.C.

References mesh, and otherEdge().

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

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

◆ constrainToMeshCentre() [1/2]

void constrainToMeshCentre ( const polyMesh & mesh,
point & pt )

Set the constrained components of position to mesh centre.

Definition at line 621 of file meshTools.C.

References Foam::max(), mesh, Foam::min(), and VectorSpace< Form, Cmpt, Ncmpts >::nComponents.

Referenced by twoDPointCorrector::correctDisplacement(), twoDPointCorrector::correctPoints(), particle< Type >::deviationFromMeshCentre(), InjectionModel< Foam::KinematicCloud< Foam::DSMCCloud< dsmcParcel > > >::info(), and InjectionModel< CloudType >::injectSteadyState().

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

◆ constrainToMeshCentre() [2/2]

void constrainToMeshCentre ( const polyMesh & mesh,
pointField & pt )

Definition at line 642 of file meshTools.C.

References forAll, Foam::max(), mesh, Foam::min(), VectorSpace< Form, Cmpt, Ncmpts >::nComponents, and pts.

Here is the call graph for this function:

◆ constrainDirection() [1/2]

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

◆ constrainDirection() [2/2]

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

Definition at line 696 of file meshTools.C.

References forAll, mesh, and VectorSpace< Form, Cmpt, Ncmpts >::nComponents.

◆ getParallelEdges()

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 729 of file meshTools.C.

References mesh, otherFace(), and walkFace().

Referenced by cutDirToEdge().

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

◆ edgeToCutDir()

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 755 of file meshTools.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, mesh, Vector< Cmpt >::normalise(), normEdgeVec(), otherFace(), hexMatcher::test(), and walkFace().

Referenced by cutDirToEdge().

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

◆ cutDirToEdge()

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 802 of file meshTools.C.

References Foam::abort(), edgeToCutDir(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, HashTable< T, Key, Hash >::found(), getParallelEdges(), HashSet< Key, Hash >::insert(), Foam::mag(), mesh, UList< T >::size(), and hexMatcher::test().

Referenced by hexCellLooper::cut().

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

◆ bandCompression() [1/4]

Foam::labelList bandCompression ( const polyMesh & mesh)

Renumber (mesh) addressing to reduce the band of the mesh connectivity, using the Cuthill-McKee algorithm.

Returns
order in which the cells are to be visited (ordered to original)

Definition at line 323 of file bandCompression.C.

References globalMeshData::calcCellCells(), and mesh.

Referenced by Foam::bandCompression(), Foam::bandCompression(), PrimitivePatch< List< face >, const pointField >::projectFaceCentres(), CuthillMcKeeRenumber::renumber(), CuthillMcKeeRenumber::renumber(), and CuthillMcKeeRenumber::renumber().

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

◆ bandCompression() [2/4]

Foam::labelList bandCompression ( const CompactListList< label > & addressing)

Renumber (mesh) addressing to reduce the band of the matrix, using the Cuthill-McKee algorithm.

Returns
order in which the cells are to be visited (ordered to original)

Definition at line 333 of file bandCompression.C.

◆ bandCompression() [3/4]

Foam::labelList bandCompression ( const labelListList & addressing)

Renumber (mesh) addressing to reduce the band of the matrix, using the Cuthill-McKee algorithm.

Returns
order in which the cells are to be visited (ordered to original)

Definition at line 342 of file bandCompression.C.

◆ bandCompression() [4/4]

Foam::labelList bandCompression ( const labelUList & cellCells,
const labelUList & offsets )

Renumber with addressing in losort form (neighbour + start in neighbour), using the Cuthill-McKee algorithm.

Returns
order in which the cells are to be visited (ordered to original)

Definition at line 171 of file bandCompression.C.

References CircularBuffer< T >::capacity(), DynamicList< T, SizeMin >::clear(), CircularBuffer< T >::empty(), CircularBuffer< T >::front(), Foam::labelMax, Foam::max(), Foam::nl, CircularBuffer< T >::pop_front(), Foam::Pout, CircularBuffer< T >::push_back(), DynamicList< T, SizeMin >::push_back(), DynamicList< T, SizeMin >::resize_nocopy(), UList< T >::size(), and Foam::sortedOrder().

Here is the call graph for this function:

Variable Documentation

◆ mXmYmZ

const label mXmYmZ = 0
static

Definition at line 62 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXmYmZ

const label pXmYmZ = 1
static

Definition at line 63 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ mXpYmZ

const label mXpYmZ = 2
static

Definition at line 64 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXpYmZ

const label pXpYmZ = 3
static

Definition at line 65 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ mXmYpZ

const label mXmYpZ = 4
static

Definition at line 67 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXmYpZ

const label pXmYpZ = 5
static

Definition at line 68 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ mXpYpZ

const label mXpYpZ = 6
static

Definition at line 69 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXpYpZ

const label pXpYpZ = 7
static

Definition at line 70 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ mXmYmZMask

const label mXmYmZMask = 1 << mXmYmZ
static

Definition at line 72 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXmYmZMask

const label pXmYmZMask = 1 << pXmYmZ
static

Definition at line 73 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ mXpYmZMask

const label mXpYmZMask = 1 << mXpYmZ
static

Definition at line 74 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXpYmZMask

const label pXpYmZMask = 1 << pXpYmZ
static

Definition at line 75 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ mXmYpZMask

const label mXmYpZMask = 1 << mXmYpZ
static

Definition at line 77 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXmYpZMask

const label pXmYpZMask = 1 << pXmYpZ
static

Definition at line 78 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ mXpYpZMask

const label mXpYpZMask = 1 << mXpYpZ
static

Definition at line 79 of file meshTools.H.

Referenced by calcBoxPointNormals().

◆ pXpYpZMask

const label pXpYpZMask = 1 << pXpYpZ
static

Definition at line 80 of file meshTools.H.

Referenced by calcBoxPointNormals().