198 if (
y.first().hit() &&
y.second() <
x.second())
203 else if (
y.first().hit())
218 { distributionType::FOLLOW,
"follow" },
219 { distributionType::INDEPENDENT,
"independent" },
220 { distributionType::DISTRIBUTED,
"distributed" },
221 { distributionType::FROZEN,
"frozen" }
227Foam::word Foam::distributedTriSurfaceMesh::findLocalInstance
266 for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
268 if (ts[instanceI].value() <= startValue)
275 for (; instanceI >= 0; --instanceI)
289 return ts[instanceI].name();
315 <<
"Cannot find directory " <<
io.
local() <<
" in times " << ts
323bool Foam::distributedTriSurfaceMesh::read()
333 const boundBox& localBb = triSurfaceMesh::bounds();
341 distType_ = DISTRIBUTED;
342 dict_.add(
"distributionType", distributionTypeNames_[distType_]);
346 dict_.add(
"mergeDistance", mergeDist_);
352 dict_.add(
"closed", surfaceClosed_);
375 distType_ = distributionTypeNames_.get(
"distributionType", dict_);
378 dict_.readEntry(
"mergeDistance", mergeDist_);
381 surfaceClosed_ = dict_.getOrDefault<
bool>(
"closed",
false);
398bool Foam::distributedTriSurfaceMesh::isLocal
400 const List<treeBoundBox>& myBbs,
407 if (myBbs[bbi].contains(start) && myBbs[bbi].contains(end))
478void Foam::distributedTriSurfaceMesh::distributeSegment
480 const label segmenti,
484 DynamicList<segment>& allSegments,
485 DynamicList<label>& allSegmentMap,
486 List<DynamicList<label>>& sendMap
503 const List<treeBoundBox>& bbs = procBb_[proci];
505 if (isLocal(bbs, start, end))
507 sendMap[proci].append(allSegments.size());
508 allSegmentMap.append(segmenti);
509 allSegments.append(
segment(start, end));
520 const List<treeBoundBox>& bbs = procBb_[proci];
524 const treeBoundBox& bb = bbs[bbi];
532 if (bb.intersects(start, end, clipPt))
534 sendMap[proci].append(allSegments.size());
535 allSegmentMap.append(segmenti);
536 allSegments.append(
segment(start, end));
559Foam::distributedTriSurfaceMesh::distributeSegments
564 List<segment>& allSegments,
579 DynamicList<segment> dynAllSegments(start.size());
581 DynamicList<label> dynAllSegmentMap(start.size());
588 dynSendMap[proci].reserve
614 dynSendMap[proci].shrink();
615 sendMap[proci].transfer(dynSendMap[proci]);
618 allSegments.transfer(dynAllSegments);
619 allSegmentMap.transfer(dynAllSegmentMap);
626void Foam::distributedTriSurfaceMesh::findLine
628 const bool nearestIntersection,
631 List<pointIndexHit>& info
636 Pout<<
"distributedTriSurfaceMesh::findLine :"
639 << start.size() <<
" rays" <<
endl;
641 addProfiling(findLine,
"distributedTriSurfaceMesh::findLine");
643 const indexedOctree<treeDataTriSurface>& octree = tree();
646 info.setSize(start.size());
653 const globalIndex& triIndexer = globalTris();
665 if (nearestIntersection)
667 info[i] = octree.findLine(start[i], end[i]);
671 info[i] = octree.findLineAny(start[i], end[i]);
676 info[i].setIndex(triIndexer.toGlobal(info[i].index()));
697 List<segment> allSegments(start.size());
701 const autoPtr<mapDistribute> mapPtr
711 const mapDistribute& map = mapPtr();
713 label nOldAllSegments = allSegments.size();
719 map.distribute(allSegments);
726 List<pointIndexHit> intersections(allSegments.size());
730 if (nearestIntersection)
732 intersections[i] = octree.findLine
734 allSegments[i].first(),
735 allSegments[i].second()
740 intersections[i] = octree.findLineAny
742 allSegments[i].first(),
743 allSegments[i].second()
748 if (intersections[i].hit())
750 intersections[i].setIndex
752 triIndexer.toGlobal(intersections[i].index())
761 map.reverseDistribute(nOldAllSegments, intersections);
770 label segmenti = allSegmentMap[i];
780 else if (nearestIntersection)
785 magSqr(allInfo.hitPoint()-start[segmenti])
786 <
magSqr(hitInfo.hitPoint()-start[segmenti])
798void Foam::distributedTriSurfaceMesh::convertTriIndices
800 List<pointIndexHit>& info
804 const globalIndex& triIndexer = globalTris();
810 pi.setIndex(triIndexer.toGlobal(
pi.index()));
820Foam::distributedTriSurfaceMesh::calcLocalQueries
822 const List<pointIndexHit>& info,
830 triangleIndex.setSize(info.size());
832 const globalIndex& triIndexer = globalTris();
848 label proci = triIndexer.whichProcID(info[i].index());
857 sendMap[proci].setSize(nSend[proci]);
866 label proci = triIndexer.whichProcID(info[i].index());
867 triangleIndex[i] = triIndexer.toLocal(proci, info[i].index());
868 sendMap[proci][nSend[proci]++] = i;
872 triangleIndex[i] = -1;
880 autoPtr<mapDistribute> mapPtr(
new mapDistribute(std::move(sendMap)));
886 mapPtr().distribute(triangleIndex);
892bool Foam::distributedTriSurfaceMesh::contains
894 const List<treeBoundBox>& bbs,
900 if (bbs[bbi].contains(
sample))
910Foam::distributedTriSurfaceMesh::findBestProcs
913 const scalar radiusSqr,
924 procContains =
false;
927 procOverlaps =
false;
931 scalar minDistSqr = radiusSqr;
936 const List<treeBoundBox>& bbs = procBb_[proci];
940 if (bbs[bbi].contains(centre))
945 if (!procContains[proci])
947 procContains[proci] =
true;
952 bbs[bbi].calcExtremities(centre, near, far);
953 minDistSqr =
min(minDistSqr,
magSqr(centre-far));
960 return Tuple2<label, scalar>(nContain, minDistSqr);
964 scalar maxDistSqr = radiusSqr;
971 const List<treeBoundBox>& bbs = procBb_[proci];
975 if (bbs[bbi].overlaps(centre, radiusSqr))
978 bbs[bbi].calcExtremities(centre, near, far);
980 scalar d2 =
magSqr(centre-near);
984 maxDistSqr =
min(radiusSqr,
magSqr(centre-far));
996 procOverlaps[minProci] =
true;
1001 if (proci != minProci)
1003 const List<treeBoundBox>& bbs = procBb_[proci];
1006 if (bbs[bbi].overlaps(centre, maxDistSqr))
1008 procOverlaps[proci] =
true;
1016 return Tuple2<label, scalar>(nOverlap, maxDistSqr);
1021Foam::label Foam::distributedTriSurfaceMesh::calcOverlappingProcs
1023 const point& centre,
1024 const scalar radiusSqr,
1029 label nOverlaps = 0;
1033 const List<treeBoundBox>& bbs = procBb_[proci];
1037 if (bbs[bbi].overlaps(centre, radiusSqr))
1039 overlaps[proci] =
true;
1053Foam::distributedTriSurfaceMesh::calcLocalQueries
1055 const bool includeLocalProcessor,
1071 DynamicList<point> dynAllCentres(centres.size());
1072 DynamicList<scalar> dynAllRadiusSqr(centres.size());
1074 DynamicList<label> dynAllSegmentMap(centres.size());
1079 forAll(dynSendMap, proci)
1081 dynSendMap[proci].reserve
1095 calcOverlappingProcs
1102 forAll(procBbOverlaps, proci)
1106 procBbOverlaps[proci]
1108 includeLocalProcessor
1113 dynSendMap[proci].append(dynAllCentres.size());
1114 dynAllSegmentMap.append(centrei);
1115 dynAllCentres.append(centres[centrei]);
1116 dynAllRadiusSqr.append(radiusSqr[centrei]);
1125 dynSendMap[proci].shrink();
1126 sendMap[proci].transfer(dynSendMap[proci]);
1129 allCentres.transfer(dynAllCentres);
1130 allRadiusSqr.transfer(dynAllRadiusSqr);
1131 allSegmentMap.transfer(dynAllSegmentMap);
1141 const point& nearestPoint,
1146 const triSurface& surf =
static_cast<const triSurface&
>(*this);
1156 if (((
sample - nearestPoint) &
n) > 0)
1167Foam::label Foam::distributedTriSurfaceMesh::findOtherFace
1170 const label nearFacei,
1171 const label nearLabel
1174 const triSurface& surf =
static_cast<const triSurface&
>(*this);
1177 const edge
e(nearF[nearLabel], nearF[nearF.fcIndex(nearLabel)]);
1180 for (
const label facei :
pFaces)
1182 if (facei != nearFacei)
1184 int dir = surf[facei].edgeDirection(
e);
1195void Foam::distributedTriSurfaceMesh::calcFaceFaces
1197 const triSurface&
s,
1202 faceFaces.setSize(
s.size());
1204 DynamicList<label> nbrs;
1208 const labelledTri&
f =
s[facei];
1210 nbrs.reserve(
f.
size());
1217 for (
const label otherFacei :
pFaces)
1219 if (otherFacei != facei)
1221 if (
s[otherFacei].edgeDirection(
e) != 0)
1223 if (!nbrs.find(otherFacei))
1225 nbrs.append(otherFacei);
1231 faceFaces[facei] = std::move(nbrs);
1236void Foam::distributedTriSurfaceMesh::surfaceSide
1239 const List<pointIndexHit>& nearestInfo,
1240 List<volumeType>& volType
1245 Pout<<
"distributedTriSurfaceMesh::surfaceSide :"
1247 <<
" finding surface side given points on surface for "
1254 labelList triangleIndex(nearestInfo.size());
1255 autoPtr<mapDistribute> mapPtr
1263 const mapDistribute& map = mapPtr();
1267 map.distribute(localSamples);
1273 volType.setSize(triangleIndex.size());
1276 const triSurface& surf =
static_cast<const triSurface&
>(*this);
1285 EdgeMap<labelPair> edgeToFaces;
1289 const label facei = triangleIndex[i];
1294 label nearType, nearLabel;
1296 f.nearestPointClassify(
sample,
points, nearType, nearLabel);
1298 const point& nearestPoint(pHit.rawPoint());
1302 const vector sampleNearestVec = (
sample - nearestPoint);
1306 scalar
c = sampleNearestVec & surf[facei].areaNormal(
points);
1324 label otherFacei = findOtherFace(pointFaces, facei, nearLabel);
1325 if (otherFacei != -1)
1328 edgeSide(
sample, nearestPoint, facei, otherFacei);
1342 const label pointi =
f[nearLabel];
1344 const vector sampleNearestVec = (
sample - nearestPoint);
1348 edgeToFaces.clear();
1350 scalar maxCosAngle = -GREAT;
1353 for (
const label facei :
pFaces)
1357 label fp =
f.
find(pointi);
1369 for (
const edge&
e : edges)
1371 auto iter = edgeToFaces.find(
e);
1374 if (iter().second() == -1)
1377 iter().second() = facei;
1380 scalar magEVec =
mag(eVec);
1382 if (magEVec > VSMALL)
1388 scalar cosAngle(sampleNearestVec&eVec);
1389 if (cosAngle > maxCosAngle)
1391 maxCosAngle = cosAngle;
1392 maxEdgeFaces = iter();
1412 for (
auto iter : edgeToFaces)
1414 if (iter[0] == -1 || iter[1] == -1)
1422 volType[i] = edgeSide
1452 mapDistributeBase::distribute
1458 map.constructHasFlip(),
1505 Pout<<
"distributedTriSurfaceMesh::surfaceSide :"
1507 <<
" given points on surface "
1514void Foam::distributedTriSurfaceMesh::collectLeafMids
1517 DynamicField<point>& midPoints
1520 const indexedOctree<treeDataTriSurface>::node& nod = tree().nodes()[nodeI];
1522 for (
direction octant = 0; octant < nod.subNodes_.size(); octant++)
1524 const labelBits index = nod.subNodes_[octant];
1541 const treeBoundBox subBb = nod.bb_.subBbox(octant);
1542 midPoints.append(subBb.midpoint());
1550 const List<volumeType>& midPointTypes,
1552 PackedList<2>& nodeTypes,
1560 const indexedOctree<treeDataTriSurface>::node& nod = tree().nodes()[nodeI];
1564 for (
direction octant = 0; octant < nod.subNodes_.size(); octant++)
1568 const labelBits index = nod.subNodes_[octant];
1573 subType = calcVolumeType
1595 subType = midPointTypes[midPointi++];
1599 nodeTypes.set((nodeI<<3)+octant, subType);
1607 else if (subType != myType)
1622 const indexedOctree<treeDataTriSurface>::node& nod = tree().nodes()[nodeI];
1628 tree().nodeTypes().
get((nodeI<<3)+octant)
1646 labelBits index = nod.subNodes_[octant];
1651 volumeType subType = cachedVolumeType
1669 <<
"Sample:" <<
sample <<
" node:" << nodeI
1670 <<
" with bb:" << nod.bb_ <<
nl
1671 <<
"Empty subnode has invalid volume type MIXED."
1680 <<
"Sample:" <<
sample <<
" at node:" << nodeI
1681 <<
" octant:" << octant
1682 <<
" with bb:" << nod.bb_.subBbox(octant) <<
nl
1683 <<
"Node has invalid volume type " << octantType
1698Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
1706 "distributedTriSurfaceMesh::independentlyDistributedBbs"
1714 const auto* dictPtr =
1727 if (!decomposeParDict_)
1729 decomposeParDict_.reset
1758 const globalIndex& triIndexer = globalTris();
1765 if (triIndexer.localSize(proci) != 0)
1777 Pout<<
"distributedTriSurfaceMesh::independentlyDistributedBbs :"
1778 <<
" determining master-only decomposition for " <<
s.size()
1786 triCentres[trii] =
s[trii].centre(
s.points());
1790 if (!isA<geomDecomp>(decomposer_()))
1796 calcFaceFaces(
s, pointFaces, faceFaces);
1800 distribution = decomposer_().decompose(faceFaces, triCentres);
1806 distribution = decomposer_().decompose(triCentres);
1811 Pout<<
"distributedTriSurfaceMesh::independentlyDistributedBbs :"
1812 <<
" determining processor bounding boxes for surface"
1819 treeBoundBox& bb = bbs[distribution[trii]][0];
1820 bb.add(
s.points(),
s[trii]);
1830 else if (distType_ == DISTRIBUTED)
1834 if (!decomposer_().parallelAware())
1837 <<
"The decomposition method " << decomposer_().typeName
1838 <<
" does not decompose in parallel."
1844 Pout<<
"distributedTriSurfaceMesh::independentlyDistributedBbs :"
1845 <<
" determining decomposition for " <<
s.size()
1854 triCentres[trii] =
s[trii].centre(
s.points());
1857 labelList distribution = decomposer_().decompose(triCentres);
1861 Pout<<
"distributedTriSurfaceMesh::independentlyDistributedBbs :"
1862 <<
" determining processor bounding boxes for "
1869 treeBoundBox& bb = bbs[distribution[trii]][0];
1870 bb.add(
s.points(),
s[trii]);
2083 Pout<<
"distributedTriSurfaceMesh::independentlyDistributedBbs :"
2084 <<
" collecting all centroids for surface "
2093 allCentres[trii] =
s[trii].centre(
s.points());
2120 Pout<<
"distributedTriSurfaceMesh::"
2121 <<
"independentlyDistributedBbs :"
2123 <<
" merged " << allCentres.size()
2124 <<
" centroids down to " << nMerged <<
endl;
2129 UIndirectList<point>(mergedPoints, allToMerged) = allCentres;
2133 labelList mergedDist(decomposer_().decompose(mergedPoints));
2137 allDistribution = UIndirectList<label>
2145 globalTris().scatter
2154 Pout<<
"distributedTriSurfaceMesh::"
2155 <<
"independentlyDistributedBbs :"
2156 <<
" determined decomposition" <<
endl;
2163 Pout<<
"distributedTriSurfaceMesh::independentlyDistributedBbs :"
2164 <<
" determining processor bounding boxes for "
2170 treeBoundBox& bb = bbs[distribution[trii]][0];
2171 bb.add(
s.points(),
s[trii]);
2188 const List<treeBoundBox>& bbs,
2194 treeBoundBox triBb(
p0);
2200 const treeBoundBox& bb = bbs[bbi];
2206 if (bb.overlaps(triBb))
2209 if (bb.contains(
p0) || bb.contains(p1) || bb.contains(p2))
2230void Foam::distributedTriSurfaceMesh::subsetMeshMap
2232 const triSurface&
s,
2234 const label nIncluded,
2240 newToOldFaces.setSize(nIncluded);
2241 newToOldPoints.setSize(
s.points().size());
2242 oldToNewPoints.setSize(
s.points().size());
2243 oldToNewPoints = -1;
2248 forAll(include, oldFacei)
2250 if (include[oldFacei])
2253 newToOldFaces[facei++] = oldFacei;
2256 for (
const label oldPointi :
s[oldFacei])
2258 if (oldToNewPoints[oldPointi] == -1)
2260 oldToNewPoints[oldPointi] = pointi;
2261 newToOldPoints[pointi++] = oldPointi;
2266 newToOldPoints.setSize(pointi);
2273 const triSurface&
s,
2281 forAll(newToOldPoints, i)
2283 newPoints[i] =
s.points()[newToOldPoints[i]];
2286 List<labelledTri> newTriangles(newToOldFaces.size());
2291 const labelledTri& tri =
s[newToOldFaces[i]];
2293 newTriangles[i][0] = oldToNewPoints[tri[0]];
2294 newTriangles[i][1] = oldToNewPoints[tri[1]];
2295 newTriangles[i][2] = oldToNewPoints[tri[2]];
2296 newTriangles[i].region() = tri.region();
2300 return triSurface(newTriangles,
s.patches(), newPoints,
true);
2306 const triSurface&
s,
2345 const triSurface&
s,
2352 ListOps::createWithValue<bool>(
s.size(), newToOldFaces,
true,
false)
2355 newToOldPoints.setSize(
s.points().size());
2356 labelList oldToNewPoints(
s.points().size(), -1);
2360 forAll(include, oldFacei)
2362 if (include[oldFacei])
2365 for (
const label oldPointi :
s[oldFacei])
2367 if (oldToNewPoints[oldPointi] == -1)
2369 oldToNewPoints[oldPointi] = pointi;
2370 newToOldPoints[pointi++] = oldPointi;
2375 newToOldPoints.setSize(pointi);
2388Foam::label Foam::distributedTriSurfaceMesh::findTriangle
2390 const List<labelledTri>& allFaces,
2392 const labelledTri& otherF
2400 const labelledTri&
f = allFaces[
pFaces[i]];
2402 if (
f.region() == otherF.region())
2405 label fp0 =
f.
find(otherF[0]);
2410 if (
f[fp1] == otherF[1] &&
f[fp2] == otherF[2])
2423 const scalar mergeDist,
2424 const List<labelledTri>& subTris,
2427 List<labelledTri>& allTris,
2450 label allPointi = nOldAllPoints;
2451 forAll(pointConstructMap, pointi)
2453 if (pointConstructMap[pointi] == -1)
2455 pointConstructMap[pointi] = allPointi++;
2459 if (allPointi > nOldAllPoints)
2463 forAll(pointConstructMap, pointi)
2465 if (pointConstructMap[pointi] >= nOldAllPoints)
2467 allPoints[pointConstructMap[pointi]] = subPoints[pointi];
2481 label allTrii = allTris.size();
2482 allTris.setSize(allTrii + subTris.size());
2484 faceConstructMap.setSize(subTris.size());
2488 const labelledTri& subTri = subTris[trii];
2491 labelledTri mappedTri
2493 pointConstructMap[subTri[0]],
2494 pointConstructMap[subTri[1]],
2495 pointConstructMap[subTri[2]],
2501 bool fullMatch =
true;
2505 if (mappedTri[fp] >= nOldAllPoints)
2516 label i = findTriangle
2526 faceConstructMap[trii] = allTrii;
2527 allTris[allTrii] = mappedTri;
2532 faceConstructMap[trii] = i;
2538 faceConstructMap[trii] = allTrii;
2539 allTris[allTrii] = mappedTri;
2543 allTris.setSize(allTrii);
2571 currentDistType_(FROZEN)
2595 Info<<
'\t' << proci <<
'\t' << nTris[proci]
2596 <<
'\t' << procBb_[proci] <<
endl;
2611 findLocalInstance(
io),
2643 currentDistType_(FROZEN)
2659 <<
"Read distributedTriSurface " <<
io.
name()
2660 <<
" from parent path " << actualFile <<
endl;
2683 <<
"Read distributedTriSurface " <<
io.
name()
2684 <<
" from actual path " << actualFile <<
':' <<
endl;
2696 Info<<
'\t' << proci <<
'\t' << nTris[proci]
2697 <<
'\t' << procBb_[proci] <<
endl;
2706 <<
"Read distributedTriSurface " <<
io.
name() <<
':' <<
endl;
2723 findLocalInstance(
io),
2756 currentDistType_(FROZEN)
2783 "outsideVolumeType",
2801 <<
"Read distributedTriSurface " <<
io.
name()
2802 <<
" from parent path " << actualFile
2803 <<
" and dictionary" <<
endl;
2826 <<
"Read distributedTriSurface " <<
io.
name()
2827 <<
" from actual path " << actualFile
2828 <<
" and dictionary:" <<
endl;
2840 Info<<
'\t' << proci <<
'\t' << nTris[proci]
2841 <<
'\t' << procBb_[proci] <<
endl;
2850 <<
"Read distributedTriSurface " <<
io.
name() <<
':' <<
endl;
2866 globalTris_.clear();
2879 return *globalTris_;
3127 "distributedTriSurfaceMesh::findNearest"
3132 Pout<<
"distributedTriSurfaceMesh::findNearest :"
3134 <<
" trying to find nearest for " <<
samples.
size()
3135 <<
" samples with max sphere "
3165 forAll(dynSendMap, proci)
3172 label minProci = -1;
3182 label nContains = 0;
3185 if (procContains[proci])
3188 dynSendMap[proci].
append(samplei);
3189 distSqr[samplei] = best.
second();
3209 dynSendMap[minProci].
append(samplei);
3210 distSqr[samplei] = best.
second();
3218 sendMap[proci].
transfer(dynSendMap[proci]);
3237 <<
" outside\t" << nOutside <<
endl;
3250 convertTriIndices(localInfo);
3258 label nIgnoredHit = 0;
3291 Pout<<
"distributedTriSurfaceMesh::findNearest :"
3293 <<
" searched locally for " << localPoints.
size()
3294 <<
" samples with max sphere "
3296 <<
" found hits:" << nHit
3297 <<
" of which outside local bb:" << nIgnoredHit
3306 mapDistributeBase::distribute
3340 forAll(nearestInfo, samplei)
3361 ? triIndexer.whichProcID(info.
index())
3366 calcOverlappingProcs(
sample, d2, procBbOverlaps);
3368 forAll(procBbOverlaps, proci)
3370 if (procBbOverlaps[proci])
3376 if (proci != hitProci)
3378 dynSendMap[proci].
append(samplei);
3387 sendMap[proci].
transfer(dynSendMap[proci]);
3412 forAll(nearestInfo, samplei)
3415 if (ni.
first().hit())
3417 localDistSqr[samplei] = ni.
second();
3425 convertTriIndices(localInfo);
3430 label nIgnoredHit = 0;
3457 Pout<<
"distributedTriSurfaceMesh::findNearest :"
3459 <<
" searched locally for " << localSamples.
size()
3460 <<
" samples with max sphere "
3462 <<
" found hits:" << nHit
3463 <<
" of which outside local bb:" << nIgnoredHit
3467 mapDistributeBase::distribute
3491 info[samplei] = ni.
first();
3519 "distributedTriSurfaceMesh::findNearestRegion"
3524 Pout<<
"distributedTriSurfaceMesh::findNearest :"
3526 <<
" trying to find nearest and region for " <<
samples.
size()
3527 <<
" samples with max sphere "
3532 if (regionIndices.
empty())
3534 findNearest(
samples, nearestDistSqr, info);
3578 convertTriIndices(allInfo);
3582 if (allInfo[i].hit())
3590 allInfo[i].hitPoint()
3599 allInfo[i].setMiss();
3600 allInfo[i].setIndex(-1);
3617 if (allInfo[i].hit())
3619 label pointi = allSegmentMap[i];
3621 if (!info[pointi].hit())
3624 info[pointi] = allInfo[i];
3635 info[pointi] = allInfo[i];
3644void Foam::distributedTriSurfaceMesh::findLine
3707 Pout<<
"distributedTriSurfaceMesh::findLineAll :"
3709 <<
" intersecting with "
3710 << start.
size() <<
" rays" <<
endl;
3716 "distributedTriSurfaceMesh::findLineAll"
3746 +
vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL)
3755 info.setSize(hitInfo.
size());
3758 if (hitInfo[pointi].hit())
3760 info[pointi].setSize(1);
3761 info[pointi][0] = hitInfo[pointi];
3763 point pt = hitInfo[pointi].hitPoint() + smallVec[pointi];
3765 if (((pt-start[pointi])&dirVec[pointi]) <= magSqrDirVec[pointi])
3768 e1[compacti] = end[pointi];
3769 pointMap[compacti] = pointi;
3775 info[pointi].
clear();
3800 if (hitInfo[i].hit())
3802 label pointi = pointMap[i];
3804 label sz = info[pointi].
size();
3805 info[pointi].setSize(sz+1);
3806 info[pointi][sz] = hitInfo[i];
3808 point pt = hitInfo[i].hitPoint() + smallVec[pointi];
3811 scalar d = ((pt-start[pointi])&dirVec[pointi]);
3815 if (d > 0 && d <= magSqrDirVec[pointi])
3818 e1[compacti] = end[pointi];
3819 pointMap[compacti] = pointi;
3834 Pout<<
"distributedTriSurfaceMesh::findLineAll :"
3835 <<
" Exiting loop due to excessive number of"
3836 <<
" intersections along ray"
3847 Pout<<
"distributedTriSurfaceMesh::findLineAll :"
3849 <<
" finished intersecting with "
3850 << start.
size() <<
" rays" <<
endl;
3863 Pout<<
"distributedTriSurfaceMesh::getRegion :"
3865 <<
" getting region for "
3866 << info.
size() <<
" triangles" <<
endl;
3869 addProfiling(getRegion,
"distributedTriSurfaceMesh::getRegion");
3888 Pout<<
"distributedTriSurfaceMesh::getRegion :"
3890 <<
" finished getting region for "
3891 << info.
size() <<
" triangles" <<
endl;
3921 label trii = triangleIndex[i];
3922 region[i] =
s[trii].region();
3933 Pout<<
"distributedTriSurfaceMesh::getRegion :"
3935 <<
" finished getting region for "
3936 << info.
size() <<
" triangles" <<
endl;
3955 Pout<<
"distributedTriSurfaceMesh::getNormal :"
3957 <<
" getting normal for "
3958 << info.
size() <<
" triangles" <<
endl;
3961 addProfiling(getNormal,
"distributedTriSurfaceMesh::getNormal");
3988 label trii = triangleIndex[i];
3989 normal[i] =
s[trii].unitNormal(
s.points());
4000 Pout<<
"distributedTriSurfaceMesh::getNormal :"
4002 <<
" finished getting normal for "
4003 << info.
size() <<
" triangles" <<
endl;
4090 if (!hasVolumeType())
4093 <<
"Volume type only supported for closed distributed surfaces."
4105 "distributedTriSurfaceMesh::getCachedVolumeType"
4109 const point outsidePt(bounds().
max() + 0.5*bounds().span());
4112 Pout<<
"distributedTriSurfaceMesh::getVolumeType :"
4114 <<
" triggering outsidePoint" << outsidePt
4115 <<
" orientation" <<
endl;
4128 surfaceSide(outsidePts, nearestInfo, outsideVolTypes);
4136 label(outsideVolTypes[0]),
4143 Pout<<
"distributedTriSurfaceMesh::getVolumeType :"
4145 <<
" determined outsidePoint" << outsidePt
4165 collectLeafMids(0, midPoints);
4169 Pout<<
"distributedTriSurfaceMesh::getVolumeType :"
4171 <<
" triggering orientation caching for "
4172 << midPoints.
size() <<
" leaf mids" <<
endl;
4189 surfaceSide(midPoints, nearestInfo, midVolTypes);
4203 Pout<<
"distributedTriSurfaceMesh::getVolumeType :"
4205 <<
" done orientation caching for "
4206 << midPoints.
size() <<
" leaf mids" <<
endl;
4214 Pout<<
"distributedTriSurfaceMesh::getVolumeType :"
4217 <<
" samples" <<
endl;
4223 "distributedTriSurfaceMesh::getVolumeType"
4242 if (contains(procBb_[proci],
samples[samplei]))
4255 outsideSamples.
append(samplei);
4261 sendMap[proci].
setSize(nSend[proci]);
4271 if (contains(procBb_[proci],
samples[samplei]))
4274 procSend[nSend[proci]++] = samplei;
4297 volType[i] = cachedVolumeType(0, localPoints[i]);
4301 fullSearchPoints.
append(localPoints[i]);
4307 Pout<<
"distributedTriSurfaceMesh::getVolumeType :"
4310 <<
" resulting in local queries:"
4311 << localPoints.
size()
4312 <<
" of which cached:" << localPoints.
size()-fullSearchPoints.
size()
4327 surfaceSide(fullSearchPoints, nearestInfo, fullSearchType);
4332 volType[fullSearchMap[i]] = fullSearchType[i];
4338 mapDistributeBase::distribute
4397 for (label samplei : outsideSamples)
4399 volType[samplei] = outsideVolType_;
4404 Pout<<
"distributedTriSurfaceMesh::getVolumeType :"
4406 <<
" finished finding orientation for " <<
samples.
size()
4407 <<
" samples" <<
endl;
4426 Pout<<
"distributedTriSurfaceMesh::getField :"
4428 <<
" retrieving field for "
4429 << info.
size() <<
" triangles" <<
endl;
4434 const auto* fldPtr = findObject<triSurfaceLabelField>(
"values");
4458 values.setSize(triangleIndex.
size());
4462 label trii = triangleIndex[i];
4463 values[i] =
fld[trii];
4475 Pout<<
"distributedTriSurfaceMesh::getField :"
4477 <<
" finished retrieving field for "
4478 << info.
size() <<
" triangles" <<
endl;
4492 includedFace =
false;
4496 const scalar eps = 1.0e-4;
4499 const point mid = bbs[i].centre();
4500 const vector halfSpan = (1.0+eps)*(bbs[i].
max() - mid);
4502 bbsX[i].min() = mid - halfSpan;
4503 bbsX[i].max() = mid + halfSpan;
4510 const point& p1 =
s.points()[
f[1]];
4511 const point& p2 =
s.points()[
f[2]];
4513 if (overlaps(bbsX,
p0, p1, p2))
4515 includedFace[trii] =
true;
4533 overlappingSurface(
s, bbs, includedFace);
4534 return subsetMesh(
s, includedFace, subPointMap, subFaceMap);
4566 label proci = triIndexer.whichProcID(info[i].index());
4575 sendMap[proci].
setSize(nSend[proci]);
4584 label proci = triIndexer.whichProcID(info[i].index());
4585 triangleIndex[i] = triIndexer.
toLocal(proci, info[i].index());
4586 sendMap[proci][nSend[proci]++] = i;
4590 triangleIndex[i] = -1;
4619 forAll(constructMap, proci)
4625 constructMap[proci].
setSize(nRecv);
4627 for (label i = 0; i < nRecv; i++)
4629 constructMap[proci][i] = segmenti++;
4644 std::move(constructMap)
4662 const bool keepNonLocal,
4674 Pout<<
"distributedTriSurfaceMesh::distribute :"
4676 <<
" distributing surface according to method:"
4677 << distributionTypeNames_[distType_]
4681 addProfiling(distribute,
"distributedTriSurfaceMesh::distribute");
4699 if (currentDistType_ == distType_)
4703 newProcBb = independentlyDistributedBbs(*
this);
4716 if (newProcBb == procBb_)
4722 procBb_.transfer(newProcBb);
4739 <<
"before distribution:" <<
endl <<
"\tproc\ttris" <<
endl;
4743 Info<<
'\t' << proci <<
'\t' << nTris[proci] <<
endl;
4762 pointSendMap[proci],
4776 forAll(faceSendMap, proci)
4780 forAll(faceSendMap[proci], i)
4782 includedFace[faceSendMap[proci][i]] =
false;
4838 allTris = subSurface;
4839 allPoints = subSurface.
points();
4858 forAll(faceSendMap, proci)
4862 if (faceSendMap[proci].size() > 0)
4887 forAll(faceRecvSizes, proci)
4891 if (faceRecvSizes[proci] > 0)
4907 faceConstructMap[proci],
4908 pointConstructMap[proci]
4920 std::move(faceSendMap),
4921 std::move(faceConstructMap)
4929 std::move(pointSendMap),
4930 std::move(pointConstructMap)
4943 currentDistType_ = distType_;
4948 distributeFields<label>(
faceMap());
4949 distributeFields<scalar>(
faceMap());
4950 distributeFields<vector>(
faceMap());
4951 distributeFields<sphericalTensor>(
faceMap());
4952 distributeFields<symmTensor>(
faceMap());
4953 distributeFields<tensor>(
faceMap());
4965 <<
"after distribution:" <<
endl <<
"\tproc\ttris" <<
endl;
4969 Info<<
'\t' << proci <<
'\t' << nTris[proci] <<
endl;
4981 Info<<
"Writing local bounding box to " << str.
name() <<
endl;
4999 Info<<
"Writing all bounding boxes to " << str.
name() <<
endl;
5000 for (
const auto& myBbs : procBb_)
5016 Pout<<
"distributedTriSurfaceMesh::distribute :"
5018 <<
" done distributing surface according to method:"
5019 << distributionTypeNames_[distType_]
5033 Pout<<
"distributedTriSurfaceMesh::writeObject :"
5035 <<
" writing surface valid:" << valid <<
endl;
5063 bool ok = dict_.writeObject(streamOpt,
true);
5067 Pout<<
"distributedTriSurfaceMesh::writeObject :"
5069 <<
" done writing surface" <<
endl;
5086 <<
"Bounding Box : " << bb <<
endl
5087 <<
"Closed : " << surfaceClosed_ <<
endl
5089 <<
"Distribution : " << distributionTypeNames_[distType_] <<
endl;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void append(const T &val)
Append an element at the end of the list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
Minimal example by using system/controlDict.functions:
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
const Time & time() const
Return Time associated with the objectRegistry.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
const fileName & local() const noexcept
Read access to local path component.
fileName localFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches locally.
const fileName & instance() const noexcept
Read access to instance path component.
const fileName & rootPath() const
Return the Time::rootPath()
fileName objectPath() const
The complete path + object name.
The IOstreamOption is a simple container for options an IOstream can normally have.
streamFormat format() const noexcept
Get the current stream format.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
void setSize(const label n)
Alias for resize()
void append(const T &val)
Append an element at the end of the list.
void clear()
Clear the list, i.e. set size to zero.
static const List< T > & null()
Return a null List.
OFstream that keeps track of vertices.
virtual Ostream & write(const char c)
Write character.
virtual const fileName & name() const
Read/write access to the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
int overlaps
Flag to control which overlap calculations are performed.
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
void setSize(const label n, unsigned int val=0u)
Alias for resize()
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label index() const noexcept
Return the hit index.
bool hit() const noexcept
Is there a hit?
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
const Field< point_type > & points() const noexcept
Return reference to global points.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
void finishedSends(const bool wait=true)
Mark sends as done.
UPstream::rangeType subProcs() const noexcept
Range of sub-processes indices associated with PstreamBuffers.
static void allGatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void exchangeSizes(const labelUList &sendProcs, const labelUList &recvProcs, const Container &sendData, labelList &sizes, const label tag=UPstream::msgType(), const label comm=UPstream::worldComm)
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
instantList times() const
Search the case for valid time directories.
const fileName & globalCaseName() const
Return global case name.
const word & constant() const
Return constant name.
scalar timeOutputValue() const
Return current time value.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const T1 & first() const noexcept
Return first.
const T2 & second() const noexcept
Return second.
A List with indirect addressing. Like IndirectList but does not store addressing.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
label rcIndex(const label i) const noexcept
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
@ nonBlocking
"nonBlocking"
static int & msgType() noexcept
Message tag of standard messages.
static label worldComm
Default communicator (all processors)
static commsTypes defaultCommsType
Default commsType.
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
A bounding box defined in terms of min/max extrema points.
void reduce()
Parallel reduction of min/max values.
static const boundBox invertedBox
A large inverted boundBox: min/max == +/- ROOTVGREAT.
virtual bool merge() const
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
IOoject and searching on distributed triSurface. All processor hold (possibly overlapping) part of th...
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
static const Enum< distributionType > distributionTypeNames_
virtual void distribute(const List< treeBoundBox > &, const bool keepNonLocal, autoPtr< mapDistribute > &faceMap, autoPtr< mapDistribute > &pointMap)
Set bounds of surface. Bounds currently set as list of.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
static void overlappingSurface(const triSurface &, const List< treeBoundBox > &, boolList &includedFace)
Calculate the triangles that are overlapping bounds.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
virtual autoPtr< mapDistribute > localQueries(const List< pointIndexHit > &, labelList &triangleIndex) const
Obtains global indices from pointIndexHit and swaps them back.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
const globalIndex & globalTris() const
Triangle indexing (demand driven)
void writeStats(Ostream &os) const
Print some stats. Parallel aware version of.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
virtual ~distributedTriSurfaceMesh()
Destructor.
void clearOut()
Clear storage.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label operator[](const label i) const
Processor-local element id from linear-list of addresses.
A class for handling file names.
static std::string path(const std::string &str)
Return directory path name (part before last /)
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
virtual bool write()
Write the output fields.
scalar time
Injection time - set at collection [s].
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
void reset(const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
label toLocal(const label i) const
From global to local on current processor.
Non-pointer based hierarchical recursive searching.
static label getNode(const labelBits i)
static bool isContent(const labelBits i)
const List< node > & nodes() const
List of all nodes.
static bool isNode(const labelBits i)
PackedList< 2 > & nodeTypes() const
Per node, per octant whether is fully inside/outside/mixed.
A triFace with additional (region) index.
const labelListList & constructMap() const noexcept
From subsetted data to new reconstructed data.
bool constructHasFlip() const noexcept
Does constructMap include a sign.
const labelListList & subMap() const noexcept
From subsetted data back to original data.
bool subHasFlip() const noexcept
Does subMap include a sign.
label comm() const noexcept
The communicator used.
Class containing processor-to-processor mapping information.
void reverseDistribute(const label constructSize, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
void operator()(nearestAndDist &x, const nearestAndDist &y) const
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
int myProcNo() const noexcept
Return processor number.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual const boundBox & bounds() const
Return const reference to boundBox.
splitCell * master() const
Standard boundBox with extra functionality for use in octree.
static const edgeList edges
Edge to point addressing.
IOoject and searching on triSurface.
label surfaceClosed_
Is surface closed.
volumeType outsideVolType_
If surface is closed, what is type of outside points.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual bool hasVolumeType() const
Whether supports volume type (below) - i.e. whether is closed.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
void clearOut()
Clear storage.
Triangulated surface description with patch information.
labelledTri face_type
The face type (same as the underlying PrimitivePatch)
void operator=(const triSurface &surf)
Copy assignment.
static bool intersectBb(const point &p0, const point &p1, const point &p2, const treeBoundBox &cubeBb)
Intersect triangle with bounding box.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Combine operator for volume types.
void operator()(volumeType &x, const volumeType &y) const
An enumeration wrapper for classification of a location as being inside/outside of a volume.
static const Enum< volumeType::type > names
Names for the classification enumeration.
type
Volume classification types.
@ OUTSIDE
A location outside the volume.
@ MIXED
A location that is partly inside and outside.
@ INSIDE
A location inside the volume.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const volScalarField & p0
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Determine correspondence between points. See below.
#define DebugInFunction
Report an information message using Foam::Info.
#define InfoInFunction
Report an information message using Foam::Info.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
constexpr scalar pi(M_PI)
const dimensionedScalar c
Speed of light in a vacuum.
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
const fileOperation & fileHandler()
Get current file handler.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Pair< label > labelPair
A pair of labels.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
line< point, const point & > linePointRef
A line using referred points.
messageStream Info
Information stream (stdout output on master, null elsewhere)
vectorField pointField
pointField is a vectorField.
Tuple2< pointIndexHit, scalar > nearestAndDist
Combine operator for nearest.
vector point
Point is a vector.
const nearestAndDist nearestZero(nearestAndDist(pointIndexHit(), -GREAT))
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label mergePoints(const PointList &points, labelList &pointToUnique, labelList &uniquePoints, const scalar mergeTol=SMALL, const bool verbose=false)
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< instant > instantList
List of instants.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< labelList > labelListList
A List of labelList.
tmp< GeoField > getField(const IOobject *io, const typename GeoField::Mesh &mesh)
Get the field or return nullptr.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
List< treeBoundBox > treeBoundBoxList
List of bounding boxes.
errorManip< error > abort(error &err)
PointHit< point > pointHit
A PointIndexHit for 3D points.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
bool matchPoints(const UList< point > &pts0, const UList< point > &pts1, const UList< scalar > &matchDistance, const bool verbose, labelList &from0To1, const point &origin=point::zero)
Determine correspondence between pointFields. Gets passed.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a)
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.
static const char *const typeName
The type name used in ensight case files.
scalarField samples(nIntervals, Zero)