Go to the documentation of this file.
41 # ifdef DEBUGSurfaceChecks
52 namespace triSurfaceChecks
66 const scalar tol =
Foam::cos(angleTol * M_PI / 180.0);
71 # pragma omp parallel for schedule(dynamic, 50)
80 vn /= (
mag(vn) + VSMALL);
81 vector vp = pts[tri[pI]] - pts[tri[tri.rcIndex(pI)]];
82 vp /= (
mag(vp) + VSMALL);
84 if( (vp & vn) >= tol )
96 return badTriangles.
size();
102 const word subsetName,
103 const scalar angleTol
119 return badTriangles.
size();
124 namespace manifoldOps
160 neiTriangles.
clear();
179 template<
class labelListType>
183 const labelListType& ,
198 namespace selectorOps
233 const label nManifolds =
247 const word subsetPrefix
266 forAll(facetInManifold, tI)
276 badTriangles.
clear();
281 # pragma omp parallel for schedule(dynamic, 100)
288 # pragma omp critical
290 badTriangles.
append(edgeFacets(eI, 0));
294 return badTriangles.
size();
308 forAll(trianglesNearHoles, i)
312 return trianglesNearHoles.
size();
317 badTriangles.
clear();
322 # pragma omp parallel for schedule(dynamic, 100)
329 # pragma omp critical
333 badTriangles.
append(edgeFacets(eI, efI));
338 return badTriangles.
size();
344 const word subsetPrefix
356 forAll(trianglesNearHoles, i)
360 return trianglesNearHoles.
size();
365 namespace orientationOps
406 neiTriangles.
clear();
428 if( neiTri[i] == tri[teI] )
442 template<
class labelListType>
446 const labelListType& ,
463 triangleInGroup = -1;
500 forAll(triangleInGroup, tI)
509 namespace connectionOps
545 neiTriangles.
clear();
563 template<
class labelListType>
567 const labelListType& ,
588 triangleInRegion = -1;
624 forAll(triangleInRegion, tI)
644 collocatedPoints.
clear();
651 boolList collocated(pts.size(),
false);
654 # pragma omp parallel for schedule(dynamic, 50)
662 bb.
min() -=
point(distTol, distTol, distTol);
663 bb.
max() +=
point(distTol, distTol, distTol);
670 const label leafI = leavesInBox[i];
678 const label triJ = trianglesInBox[j];
688 collocated[pI] =
true;
689 collocated[nt[tpI]] =
true;
698 collocatedPoints.
append(pI);
700 return collocatedPoints.
size();
706 const word subsetName,
719 forAll(collocatedPoints, i)
723 return collocatedPoints.
size();
743 # pragma omp parallel for schedule(dynamic, 50)
756 boundBox bb(pts[tri[0]], pts[tri[0]]);
757 for(
label i=1;i<3;++i)
771 const label leafI = leavesInBox[i];
779 const label triJ = trianglesInBox[j];
789 if( tri[pI] == nt[pJ] )
793 if( sharedPoints.
size() >= 2 )
798 else if( sharedPoints.
size() == 1 )
801 const point&
s = pts[nt[(sharedPoints[0]+1)%3]];
802 const point&
e = pts[nt[(sharedPoints[0]+2)%3]];
805 const bool lineIntersection =
808 if( lineIntersection )
810 intersected[tI] =
true;
811 intersected[triJ] =
true;
834 intersected[tI] =
true;
835 intersected[triJ] =
true;
837 # ifdef DEBUGSurfaceChecks
839 const_cast<triSurf&
>(surf).addFacetSubset
844 const_cast<triSurf&
>(surf).addFacetToSubset(sId, tI);
845 const_cast<triSurf&
>(surf).addFacetToSubset(sId, triJ);
855 if( intersected[tI] )
859 return badFaces.
size();
865 const word subsetName,
882 return badFacets.
size();
890 const scalar angleTol
898 const scalar cosVal =
Foam::cos(angleTol * M_PI / 180.0);
905 # pragma omp parallel for schedule(dynamic, 50)
918 boundBox bb(pts[tri[0]], pts[tri[0]]);
919 for(
label i=1;i<3;++i)
933 const label leafI = leavesInBox[i];
941 const label triJ = trianglesInBox[j];
968 intersected[tI] =
true;
969 intersected[triJ] =
true;
971 # ifdef DEBUGSurfaceChecks
973 const_cast<triSurf&
>(surf).addFacetSubset
978 const_cast<triSurf&
>(surf).addFacetToSubset(sId, tI);
979 const_cast<triSurf&
>(surf).addFacetToSubset(sId, triJ);
988 for(
label i=0;i<commonPolygon.
size()-2;++i)
1003 if( intersected[tI] )
1007 return badFaces.
size();
1013 const word subsetName,
1015 const scalar angleTol
1031 return badFaces.
size();
void collectGroups(std::map< label, DynList< label > > &, const labelListType &, const DynList< label > &) const
void append(const T &e)
Append an element at the end of the list.
bool doTrianglesIntersect(const triangle< point, point > &tri0, const triangle< point, point > &tri1, const scalar distTol=-1.0)
check the existence of intersection between the two triangles
A class for handling words, derived from string.
const point & max() const
Maximum describing the bounding box.
surfaceNeiOp(const VRWGraph &faceEdges, const VRWGraph &edgeFaces, const LongList< labelledTri > &triangles)
#define forAll(list, i)
Loop across all elements in list.
void operator()(const label tI, DynList< label > &neiTriangles) const
const pointField & points() const
access to points
void appendTriangle(const labelledTri &tria)
append a triangle to the end of the list
word scalarToText(const scalar s)
convert the scalar value into text
void clear()
Clear the list, i.e. set next free to zero.
void containedTriangles(const label, DynList< label > &) const
label checkOrientation(const triSurf &surf, labelLongList &triangleInGroup)
check orientation of triangles
void collectGroups(std::map< label, DynList< label > > &, const labelListType &, const DynList< label > &) const
label size() const
Size of the active part of the list.
dimensioned< scalar > mag(const dimensioned< Type > &)
void findLeavesContainedInBox(const boundBox &, DynList< const meshOctreeCube *, 256 > &) const
find leaves contained in the box
void calculateBoundingBox(const triSurf &surf, boundBox &bb)
calculate bounding box of the surface mesh
label addPointSubset(const word &)
point subsets
geometricSurfacePatchList & patchesAccess()
access to patches
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
void appendVertex(const point &p)
append a vertex to the end of the list
void setSize(const label)
Reset size of List.
void collectGroups(std::map< label, DynList< label > > &, const labelListType &, const DynList< label > &) const
A triangle primitive used to calculate face normals and swept volumes.
void removeFacetSubset(const label)
label checkForHoles(const triSurf &surf, labelLongList &badTriangles)
check for existence of holes in the surface mesh
void addFacetToSubset(const label, const label)
const VRWGraph & edgeFaces_
const reference to edge-faces addressing
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
label groupMarking(labelListType &elementInGroup, const neiOp &neighbourCalculator, const filterOp &selector)
Pre-declare SubField and related Field type.
void addPointToSubset(const label, const label)
const VRWGraph & faceEdges_
const reference to face-edges addressing
void operator()(const label tI, DynList< label > &neiTriangles) const
surfaceNeiOp(const VRWGraph &faceEdges, const VRWGraph &edgeFaces)
label size() const
Returns the number of rows.
void createOctreeWithRefinedBoundary(const direction maxLevel, const label nTrianglesInLeaf=15)
label checkCollocatedPoints(const triSurf &surf, labelLongList &collocatedPoints, const scalar distTol)
check existence of collocated points
const VRWGraph & faceEdges_
const reference to face-edges addressing
label checkSelfIntersections(const triSurf &surf, labelLongList &badFaces, const scalar tol)
check if there exist any self-intersections
#define forAllRow(graph, rowI, index)
const point & min() const
Minimum describing the bounding box.
label addFacetSubset(const word &)
point subsets
Raster intersect(const Raster &rast1, const Raster &rast2)
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
void removePointSubset(const label)
const VRWGraph & faceEdges_
const reference to face-edges addressing
bool triLineIntersection(const triangle< point, point > &tria, const point &lineStart, const point &lineEnd, point &intersection)
check if a line intersects the triangle, and return the intersection
label checkSurfaceManifolds(const triSurf &surf, labelLongList &triangleInManifold)
check for existence of boudary and non-manifold edges
const VRWGraph & edgeFaces_
const reference to edge-faces addressing
const double e
Elementary charge.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void operator()(const label tI, DynList< label > &neiTriangles) const
label checkDisconnectedParts(const triSurf &surf, labelLongList &triangleInRegion)
check for disconnected surface parts
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
bool doTrianglesOverlap(const triangle< point, point > &tri0, const triangle< point, point > &tri1, DynList< point > &overlappingPolygon, const scalar distTol=-1.0, const scalar cosTol=Foam::cos(5.0 *(M_PI/180.0)))
check the existence of overlap between the two triangles
const VRWGraph & edgeFaces_
const reference to edge-faces addressing
dimensionedSymmTensor sqr(const dimensionedVector &dv)
label size() const
return the number of triangles
label pointSubsetIndex(const word &) const
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const VRWGraph & facetEdges() const
return facet-edges addressing
Triangle with additional region number.
void writeSurface(const fileName &) const
A bounding box defined in terms of the points at its extremities.
label checkAngles(const triSurf &surf, labelLongList &badTriangles, const scalar angleTol)
const LongList< labelledTri > & facets() const
access to facets
const LongList< labelledTri > & triangles_
const reference to triangles
bool operator()(const label) const
label facetSubsetIndex(const word &) const
label checkOverlaps(const triSurf &surf, labelLongList &badFaces, const scalar tol, const scalar angleTol)
check if there exist any overlaps
vector point
Point is a vector.
label checkForNonManifoldEdges(const triSurf &surf, labelLongList &badTriangles)
check for existence of non-manifold edges
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
surfaceNeiOp(const VRWGraph &faceEdges, const VRWGraph &edgeFaces)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const VRWGraph & edgeFacets() const
return edge-facets addressing
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void clear()
Clear the list, i.e. set next free to zero.
void append(const T &e)
Append an element at the end of the list.
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar pos(const dimensionedScalar &ds)