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 mesh 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 |
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 33 of file meshTools.C.
Referenced by calcBoxPointNormals(), autoLayerDriver::getPatchDisplacement(), and autoSnapDriver::outwardsDisplacement().
Foam::vectorField calcBoxPointNormals | ( | const primitivePatch & | pp | ) |
Calculate point normals on a 'box' mesh (all edges aligned with.
coordinate axes)
Definition at line 52 of file meshTools.C.
References Foam::endl(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceNormals(), forAll, Foam::mag(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), mXmYmZ, mXmYmZMask, mXmYpZ, mXmYpZMask, mXpYmZ, mXpYmZMask, mXpYpZ, mXpYpZMask, n, Foam::nl, PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), pFaces, PrimitivePatch< Face, FaceList, PointField, PointType >::pointFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::pointNormals(), PrimitivePatch< Face, FaceList, PointField, PointType >::points(), pXmYmZ, pXmYmZMask, pXmYpZ, pXmYpZMask, pXpYmZ, pXpYmZMask, pXpYpZ, pXpYpZMask, visNormal(), and WarningInFunction.
Foam::vector normEdgeVec | ( | const primitiveMesh & | mesh, |
const label | edgeI | ||
) |
Normalized edge vector.
Definition at line 189 of file meshTools.C.
References Foam::mag(), and mesh.
Referenced by edgeToCutDir(), and cellLooper::getMisAlignedEdge().
Write obj representation of point.
Definition at line 203 of file meshTools.C.
References Foam::endl(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Referenced by mappedPatchBase::calcAMI(), polyDualMesh::calcFeatures(), mappedPatchBase::calcMapping(), hexCellLooper::cut(), drawHitProblem(), dumpBox(), hexRef8::dumpCell(), dumpCyclicMatch(), meshRefinement::dumpIntersections(), main(), surfaceFeatures::nearestEdges(), surfaceFeatures::nearestSamples(), regionCoupledBase::resetAMI(), cyclicAMIPolyPatch::resetAMI(), motionSmootherAlgo::setDisplacement(), cellCuts::setFromCellCutter(), cellCuts::setFromCellLoop(), duplicatePoints::setRefinement(), refinementIterator::setRefinement(), faceCollapser::setRefinement(), hexRef8::setRefinement(), faceCoupleInfo::subDivisionMatch(), sampledTriSurfaceMesh::update(), faceCoupleInfo::writeEdges(), writeOBJ(), enrichedPatch::writeOBJ(), surfaceFeatures::writeObj(), faceCoupleInfo::writePointsFaces(), and writeStencilOBJ().
Write obj representation of a triad. Requires the location of the.
triad to be supplied
Definition at line 213 of file meshTools.C.
References forAll, 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 227 of file meshTools.C.
References Foam::endl(), 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 244 of file meshTools.C.
References Foam::endl(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
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, points, List::size(), and writeOBJ().
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, points, UList::size(), and writeOBJ().
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 260 of file meshTools.C.
References cells, forAll, HashSet< Key, Hash >::insert(), points, List::size(), HashTable::toc(), and writeOBJ().
bool edgeOnCell | ( | const primitiveMesh & | mesh, |
const label | cellI, | ||
const label | edgeI | ||
) |
Is edge used by cell.
Definition at line 285 of file meshTools.C.
References Foam::findIndex(), and mesh.
Referenced by cellLooper::getVertEdgesNonFace(), and cellCuts::walkEdges().
bool edgeOnFace | ( | const primitiveMesh & | mesh, |
const label | faceI, | ||
const label | edgeI | ||
) |
Is edge used by face.
Definition at line 296 of file meshTools.C.
References Foam::findIndex(), and mesh.
Referenced by cellFeatures::isFeatureVertex(), and topoCellLooper::walkFace().
bool faceOnCell | ( | const primitiveMesh & | mesh, |
const label | cellI, | ||
const label | faceI | ||
) |
Is face used by cell.
Definition at line 307 of file meshTools.C.
References mesh.
Referenced by cellCuts::calcAnchors(), getEdgeFaces(), cellLooper::getVertFacesNonEdge(), cellFeatures::nextEdge(), cellCuts::walkPoint(), and topoCellLooper::walkSplitHex().
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 336 of file meshTools.C.
References Foam::constant::electromagnetic::e, and forAll.
Referenced by boundaryCutter::addEdgeCutsToFace(), cellCuts::calcAnchors(), edgeVertex::cutPairToEdge(), faceCollapser::filterFace(), faceCoupleInfo::findMappedEdges(), hexRef8::insertEdgeSplit(), meshCutAndRemove::loopToFace(), meshCutter::loopToFace(), booleanSurface::propagateSide(), faceCollapser::setRefinement(), boundaryCutter::splitFace(), directionInfo::updateCell(), cellCuts::validLoop(), and cellCuts::walkCell().
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 359 of file meshTools.C.
References Foam::constant::electromagnetic::e, forAll, and mesh.
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 385 of file meshTools.C.
References Foam::abort(), f1, Foam::FatalError, FatalErrorInFunction, forAll, and mesh.
Referenced by topoCellLooper::walkSplitHex().
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 418 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 456 of file meshTools.C.
References Foam::abort(), faceOnCell(), Foam::FatalError, FatalErrorInFunction, forAll, and mesh.
Referenced by polyDualMesh::calcDual(), hexCellLooper::cut(), topoCellLooper::cut(), directionInfo::edgeToFaceIndex(), cellLooper::getVertFacesNonEdge(), cellFeatures::isCellFeatureEdge(), otherFace(), combineFaces::regioniseFaces(), cellCuts::walkCell(), and cellFeatures::walkSuperFace().
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 498 of file meshTools.C.
References Foam::abort(), Foam::constant::electromagnetic::e, Foam::FatalError, FatalErrorInFunction, forAll, and mesh.
Referenced by topoCellLooper::getSuperEdge(), directionInfo::updateCell(), topoCellLooper::walkFace(), 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 532 of file meshTools.C.
References getEdgeFaces(), and mesh.
Referenced by cellCuts::crossEdge(), particle< Type >::crossEdgeConnectedFace(), triSurfaceTools::doRefine(), triSurfaceTools::edgeCosAngle(), edgeToCutDir(), combineFaces::faceNeighboursValid(), extrudeLayer::addressingCalculator::faceSharingEdge(), triSurfaceTools::getCollapsedFaces(), getParallelEdges(), wedgeMatcher::matchShape(), hexMatcher::matchShape(), tetWedgeMatcher::matchShape(), prismMatcher::matchShape(), pyrMatcher::matchShape(), tetMatcher::matchShape(), edgeFaceCirculator::operator++(), edgeFaceCirculator::setCanonical(), directionInfo::updateCell(), cuttingPlane::walkCell(), hexCellLooper::walkHex(), and topoCellLooper::walkSplitHex().
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 556 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 580 of file meshTools.C.
References mesh, and otherEdge().
Referenced by edgeToCutDir(), directionInfo::edgeToFaceIndex(), getParallelEdges(), intersectedSurface::splitFace(), topoCellLooper::walkAcrossFace(), cellCuts::walkCell(), and hexCellLooper::walkHex().
Set the constrained components of position to mesh centre.
Definition at line 606 of file meshTools.C.
References Foam::max(), mesh, and Foam::min().
Referenced by twoDPointCorrector::correctDisplacement(), twoDPointCorrector::correctPoints(), InjectionModel< CloudType >::inject(), InjectionModel< CloudType >::injectSteadyState(), DSMCParcel::move(), and KinematicParcel::move().
void constrainToMeshCentre | ( | const polyMesh & | mesh, |
pointField & | pt | ||
) |
Definition at line 627 of file meshTools.C.
References forAll, Foam::max(), mesh, and Foam::min().
Set the constrained components of directions/velocity to zero.
Definition at line 664 of file meshTools.C.
Referenced by KinematicParcel::calcVelocity(), InjectionModel< CloudType >::inject(), InjectionModel< CloudType >::injectSteadyState(), DSMCParcel::move(), and ThermoSurfaceFilm< CloudType >::splashInteraction().
void constrainDirection | ( | const polyMesh & | mesh, |
const Vector< label > & | dirs, | ||
vectorField & | d | ||
) |
Definition at line 681 of file meshTools.C.
References forAll.
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 714 of file meshTools.C.
References mesh, otherFace(), and walkFace().
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 740 of file meshTools.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::isA(), Foam::mag(), mesh, normEdgeVec(), otherFace(), and walkFace().
Referenced by cutDirToEdge(), and directions::propagateDirection().
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 787 of file meshTools.C.
References Foam::abort(), edgeToCutDir(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, HashTable::found(), getParallelEdges(), HashSet< Key, Hash >::insert(), Foam::isA(), Foam::mag(), mesh, and List::size().
Referenced by hexCellLooper::cut(), and directions::propagateDirection().
|
static |
Definition at line 63 of file meshTools.H.
Referenced by calcBoxPointNormals().
|
static |
Definition at line 64 of file meshTools.H.
Referenced by calcBoxPointNormals().
|
static |
Definition at line 65 of file meshTools.H.
Referenced by calcBoxPointNormals().
|
static |
Definition at line 66 of file meshTools.H.
Referenced by calcBoxPointNormals().
|
static |
Definition at line 68 of file meshTools.H.
Referenced by calcBoxPointNormals().
|
static |
Definition at line 69 of file meshTools.H.
Referenced by calcBoxPointNormals().
|
static |
Definition at line 70 of file meshTools.H.
Referenced by calcBoxPointNormals().
|
static |
Definition at line 71 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 73 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 74 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 75 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 76 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 78 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 79 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 80 of file meshTools.H.
Referenced by calcBoxPointNormals().
Definition at line 81 of file meshTools.H.
Referenced by calcBoxPointNormals().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.