107 const fileName& fName,
108 const fileName& objectName
115 "triSurfaceMesh::checkFile(const fileName&, const fileName&)"
116 ) <<
"Cannot find triSurfaceMesh starting from "
123 bool Foam::triSurfaceMesh::addFaceToEdge
126 EdgeMap<label>& facesPerEdge
129 EdgeMap<label>::iterator eFnd = facesPerEdge.find(e);
130 if (eFnd != facesPerEdge.end())
140 facesPerEdge.insert(e, 1);
146 bool Foam::triSurfaceMesh::isSurfaceClosed()
const
157 EdgeMap<label> facesPerEdge(100);
158 forAll(pointFaces, pointI)
162 facesPerEdge.clear();
174 label nextPointI = f[f.fcIndex(fp)];
176 if (nextPointI > pointI)
178 bool okFace = addFaceToEdge
180 edge(pointI, nextPointI),
190 label prevPointI = f[f.rcIndex(fp)];
192 if (prevPointI > pointI)
194 bool okFace = addFaceToEdge
196 edge(pointI, prevPointI),
223 void Foam::triSurfaceMesh::getNextIntersections
225 const indexedOctree<treeDataTriSurface>& octree,
229 DynamicList<pointIndexHit, 1, 1>& hits
232 const vector dirVec(end-start);
233 const scalar magSqrDirVec(
magSqr(dirVec));
236 vector perturbVec(smallVec);
241 point pt = hits[hits.size()-1].hitPoint() + perturbVec;
243 if (((pt-start)&dirVec) > magSqrDirVec)
257 bool duplicateHit =
false;
260 if (hits[i].index() == inter.index())
278 perturbVec = smallVec;
302 label pointI = f[fp];
303 if (pointIsUsed.
set(pointI, 1u))
339 Foam::triSurfaceMesh::triSurfaceMesh(
const IOobject& io)
383 Foam::triSurfaceMesh::triSurfaceMesh
428 scalar scaleFactor = 0;
432 if (dict.
readIfPresent(
"scale", scaleFactor) && scaleFactor > 0)
441 if (dict.
readIfPresent(
"tolerance", tolerance_) && tolerance_ > 0)
444 << tolerance_ <<
endl;
449 if (dict.
readIfPresent(
"maxTreeDepth", maxTreeDepth_) && maxTreeDepth_ > 0)
452 << maxTreeDepth_ <<
endl;
502 calcBounds(bb, nPoints);
504 if (nPoints !=
points().size())
506 WarningIn(
"triSurfaceMesh::tree() const")
508 <<
" does not have compact point numbering."
509 <<
" Of " <<
points().
size() <<
" only " << nPoints
510 <<
" are used. This might give problems in some routines."
521 bb.
min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
522 bb.
max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
549 if (edgeTree_.empty())
564 calcBounds(bb, nPoints);
573 bb.
min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
574 bb.
max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
600 if (regions_.empty())
605 regions_[regionI] =
patches()[regionI].name();
615 if (surfaceClosed_ == -1)
617 if (isSurfaceClosed())
627 return surfaceClosed_ == 1;
740 +
vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL)
746 pointIndexHit inter = octree.findLine(start[pointI], end[pointI]);
766 info[pointI].
clear();
807 label triI = info[i].index();
813 normal[i] /=
mag(normal[i]) + VSMALL;
856 if (foundObject<triSurfaceLabelField>(
"values"))
869 values[i] = fld[info[i].index()];
889 const point& pt = points[pointI];
893 volType[pointI] =
static_cast<volumeType>(tree().getVolumeType(pt));
915 triSurface::write(fullPath);