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 a point. More... | |
void | writeOBJ (Ostream &os, const UList< point > &pts) |
Write obj representation of points. More... | |
void | writeOBJ (Ostream &os, const triad &t, const point &origin) |
Write obj representation of a triad. Requires the origin 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... | |
void | writeOBJ (Ostream &os, const treeBoundBox &bb) |
Write obj representation of tree-bounding box as a series of lines. More... | |
template<class FaceType > | |
void | writeOBJ (Ostream &os, const UList< FaceType > &faces, const UList< point > &points, const labelList &faceLabels) |
Write obj representation of faces subset. More... | |
template<class FaceType > | |
void | writeOBJ (Ostream &os, const UList< FaceType > &faces, const UList< point > &points) |
Write obj representation of faces. More... | |
void | writeOBJ (Ostream &os, const cellList &cells, const faceList &faces, const UList< point > &points, const labelList &cellLabels) |
Write obj representation of cell subset. More... | |
bool | edgeOnCell (const primitiveMesh &mesh, const label celli, const label edgeI) |
Is edge used by cell. More... | |
bool | edgeOnFace (const primitiveMesh &mesh, const label facei, const label edgeI) |
Is edge used by face. More... | |
bool | faceOnCell (const primitiveMesh &mesh, 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 &mesh, const label v0, const label v1) |
Return edge between two mesh vertices. Returns -1 if no edge. More... | |
label | getSharedEdge (const primitiveMesh &mesh, const label f0, const label f1) |
Return edge shared by two faces. Throws error if no edge found. More... | |
label | getSharedFace (const primitiveMesh &mesh, const label cell0, const label cell1) |
Return face shared by two cells. Throws error if none found. More... | |
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. More... | |
label | otherEdge (const primitiveMesh &mesh, const labelList &edgeLabels, const label thisEdgeI, const label thisVertI) |
Return label of other edge (out of candidates edgeLabels) More... | |
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. More... | |
label | otherCell (const primitiveMesh &mesh, const label celli, const label facei) |
Return cell on other side of face. Throws error. More... | |
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. 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 &mesh, const label celli, const label e0, label &e1, label &e2, label &e3) |
Given edge on hex find other 'parallel', non-connected edges. More... | |
vector | edgeToCutDir (const primitiveMesh &mesh, const label celli, const label edgeI) |
Given edge on hex find all 'parallel' (i.e. non-connected) More... | |
label | cutDirToEdge (const primitiveMesh &mesh, const label celli, const vector &cutDir) |
Reverse of edgeToCutDir: given direction find edge bundle and. More... | |
labelList | bandCompression (const CompactListList< label > &addressing) |
labelList | bandCompression (const labelListList &addressing) |
labelList | bandCompression (const labelUList &cellCells, const labelUList &offsets) |
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 |
Collection of static functions to do various simple mesh related things.
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 36 of file meshTools.C.
References faceNormals(), forAll, and n.
Referenced by calcBoxPointNormals().
Foam::vectorField calcBoxPointNormals | ( | const primitivePatch & | pp | ) |
Calculate point normals on a 'box' mesh (all edges aligned with.
coordinate axes)
Definition at line 56 of file meshTools.C.
References Foam::endl(), PrimitivePatch< FaceList, PointField >::faceNormals(), faceNormals(), forAll, Foam::mag(), PrimitivePatch< FaceList, PointField >::meshPoints(), n, Foam::nl, PrimitivePatch< FaceList, PointField >::nPoints(), pFaces, PrimitivePatch< FaceList, PointField >::pointFaces(), PrimitivePatch< FaceList, PointField >::pointNormals(), PrimitivePatch< FaceList, PointField >::points(), visNormal(), and WarningInFunction.
Foam::vector normEdgeVec | ( | const primitiveMesh & | mesh, |
const label | edgeI | ||
) |
Normalized edge vector.
Definition at line 192 of file meshTools.C.
References mesh.
Referenced by edgeToCutDir(), and cellLooper::getMisAlignedEdge().
Write obj representation of a point.
Definition at line 202 of file meshTools.C.
References Foam::endl(), os(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Referenced by mappedPatchBase::calcAMI(), polyDualMesh::calcFeatures(), mappedPatchBase::calcMapping(), hexCellLooper::cut(), Foam::drawHitProblem(), meshRefinement::dumpIntersections(), surfaceFeatures::nearestEdges(), surfaceFeatures::nearestSamples(), Foam::operator<<(), cyclicAMIPolyPatch::resetAMI(), motionSmootherAlgo::setDisplacement(), hexRef8::setRefinement(), faceCollapser::setRefinement(), removeFaces::setRefinement(), refinementIterator::setRefinement(), duplicatePoints::setRefinement(), box::writeBoxes(), AMIInterpolation::writeFaceConnectivity(), advancingFrontAMI::writeIntersectionOBJ(), enrichedPatch::writeOBJ(), surfaceFeatures::writeObj(), and writeOBJ().
Write obj representation of points.
Definition at line 212 of file meshTools.C.
References forAll, Foam::nl, os(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Write obj representation of a triad. Requires the origin of the.
triad to be supplied
Definition at line 227 of file meshTools.C.
References forAll, os(), and writeOBJ().
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 241 of file meshTools.C.
References Foam::endl(), Foam::nl, os(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Write obj representation of a point p1 with a vector from p1 to p2.
Definition at line 257 of file meshTools.C.
References Foam::endl(), Foam::nl, os(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
void writeOBJ | ( | Ostream & | os, |
const treeBoundBox & | bb | ||
) |
Write obj representation of tree-bounding box as a series of lines.
Definition at line 272 of file meshTools.C.
References e, Foam::nl, os(), treeBoundBox::points(), and writeOBJ().
void writeOBJ | ( | Ostream & | os, |
const UList< FaceType > & | faces, | ||
const UList< point > & | points, | ||
const labelList & | faceLabels | ||
) |
Write obj representation of faces subset.
Definition at line 30 of file meshToolsTemplates.C.
References Foam::endl(), f(), forAll, HashTable< T, Key, Hash >::insert(), os(), points, UList< T >::size(), and writeOBJ().
Write obj representation of faces.
Definition at line 66 of file meshToolsTemplates.C.
References forAll, os(), points, UList< T >::size(), and writeOBJ().
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 287 of file meshTools.C.
References cells, HashSet< Key, Hash >::insert(), os(), points, UList< T >::size(), HashTable< T, Key, Hash >::toc(), and writeOBJ().
bool edgeOnCell | ( | const primitiveMesh & | mesh, |
const label | celli, | ||
const label | edgeI | ||
) |
Is edge used by cell.
Definition at line 307 of file meshTools.C.
References mesh.
Referenced by cellLooper::getVertEdgesNonFace().
bool edgeOnFace | ( | const primitiveMesh & | mesh, |
const label | facei, | ||
const label | edgeI | ||
) |
Is edge used by face.
Definition at line 318 of file meshTools.C.
References mesh.
Referenced by cellFeatures::isFeatureVertex().
bool faceOnCell | ( | const primitiveMesh & | mesh, |
const label | celli, | ||
const label | facei | ||
) |
Is face used by cell.
Definition at line 329 of file meshTools.C.
References mesh.
Referenced by getEdgeFaces(), and cellLooper::getVertFacesNonEdge().
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 358 of file meshTools.C.
Referenced by edgeVertex::cutPairToEdge().
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 381 of file meshTools.C.
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 407 of file meshTools.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, and mesh.
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 440 of file meshTools.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, and mesh.
Referenced by undoableMeshCutter::getSplitFaces().
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 478 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().
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 520 of file meshTools.C.
References Foam::abort(), e, Foam::FatalError, FatalErrorInFunction, forAll, and mesh.
Referenced by directionInfo::updateCell(), and walkFace().
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 mesh.
Referenced by directionInfo::updateCell().
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 578 of file meshTools.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and mesh.
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 602 of file meshTools.C.
References mesh, nEdges(), and otherEdge().
Referenced by directionInfo::edgeToFaceIndex().
Set the constrained components of position to mesh centre.
Definition at line 628 of file meshTools.C.
References max(), mesh, Foam::min(), and pTraits< bool >::nComponents.
Referenced by twoDPointCorrector::correctDisplacement(), twoDPointCorrector::correctPoints(), particle< Type >::deviationFromMeshCentre(), InjectionModel< CloudType >::inject(), and InjectionModel< CloudType >::injectSteadyState().
void constrainToMeshCentre | ( | const polyMesh & | mesh, |
pointField & | pt | ||
) |
Definition at line 649 of file meshTools.C.
References forAll, max(), mesh, Foam::min(), and pTraits< bool >::nComponents.
Set the constrained components of directions/velocity to zero.
Definition at line 686 of file meshTools.C.
References pTraits< bool >::nComponents.
Referenced by InjectionModel< CloudType >::inject(), InjectionModel< CloudType >::injectSteadyState(), and KinematicSurfaceFilm< CloudType >::splashInteraction().
void constrainDirection | ( | const polyMesh & | mesh, |
const Vector< label > & | dirs, | ||
vectorField & | d | ||
) |
Definition at line 703 of file meshTools.C.
References forAll, and pTraits< bool >::nComponents.
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 736 of file meshTools.C.
References mesh.
Referenced by cutDirToEdge().
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 762 of file meshTools.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, mesh, Vector< Cmpt >::normalise(), and normEdgeVec().
Referenced by 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 809 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, and UList< T >::size().
Referenced by hexCellLooper::cut().
Foam::labelList bandCompression | ( | const CompactListList< label > & | addressing | ) |
Renumber (mesh) addressing to reduce the band of the matrix, using the Cuthill-McKee algorithm.
Definition at line 315 of file bandCompression.C.
Referenced by Foam::bandCompression(), and CuthillMcKeeRenumber::renumber().
Foam::labelList bandCompression | ( | const labelListList & | addressing | ) |
Renumber (mesh) addressing to reduce the band of the matrix, using the Cuthill-McKee algorithm.
Definition at line 324 of file bandCompression.C.
Foam::labelList bandCompression | ( | const labelUList & | cellCells, |
const labelUList & | offsets | ||
) |
Renumber with addressing in losort form (neighbour + start in neighbour), using the Cuthill-McKee algorithm.
Definition at line 169 of file bandCompression.C.
References CircularBuffer< T >::append(), DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), CircularBuffer< T >::empty(), CircularBuffer< T >::first(), Foam::labelMax, max(), CircularBuffer< T >::pop_front(), DynamicList< T, SizeMin >::resize_nocopy(), UList< T >::size(), and Foam::sortedOrder().
|
static |
Definition at line 66 of file meshTools.H.
|
static |
Definition at line 67 of file meshTools.H.
|
static |
Definition at line 68 of file meshTools.H.
|
static |
Definition at line 69 of file meshTools.H.
|
static |
Definition at line 71 of file meshTools.H.
|
static |
Definition at line 72 of file meshTools.H.
|
static |
Definition at line 73 of file meshTools.H.
|
static |
Definition at line 74 of file meshTools.H.
|
static |
Definition at line 76 of file meshTools.H.
|
static |
Definition at line 77 of file meshTools.H.
|
static |
Definition at line 78 of file meshTools.H.
|
static |
Definition at line 79 of file meshTools.H.
|
static |
Definition at line 81 of file meshTools.H.
|
static |
Definition at line 82 of file meshTools.H.
|
static |
Definition at line 83 of file meshTools.H.
|
static |
Definition at line 84 of file meshTools.H.