53 namespace cellCellStencils
68 return (ijk[0]*nDivs[1] + ijk[1])*nDivs[2] + ijk[2];
78 label ij = boxI/nDivs[2];
79 label
k = boxI-ij*nDivs[2];
80 label i = ij/nDivs[1];
81 label j = ij-i*nDivs[1];
99 floor(relPt[0]/d[0]*nDivs[0]),
100 floor(relPt[1]/d[1]*nDivs[1]),
101 floor(relPt[2]/d[2]*nDivs[2])
117 const vector sz(d[0]/nDivs[0], d[1]/nDivs[1], d[2]/nDivs[2]);
119 return bb.
min()+0.5*sz+
vector(sz[0]*ids[0], sz[1]*ids[1], sz[2]*ids[2]);
129 const unsigned int val
135 for (
direction cmpt = 0; cmpt < 3; cmpt++)
137 if (maxIds[cmpt] < 0 || minIds[cmpt] > nDivs[cmpt])
145 maxIds =
min(maxIndex, maxIds);
147 for (label i = minIds[0]; i <= maxIds[0]; i++)
149 for (label j = minIds[1]; j <= maxIds[1]; j++)
151 for (label
k = minIds[2];
k <= maxIds[2];
k++)
176 const fvBoundaryMesh&
pbm =
mesh.boundary();
183 const fvPatch& fvp =
pbm[patchI];
190 const polyPatch&
pp = fvp.patch();
197 boundBox faceBb(
pp.points(),
pp[i],
false);
198 faceBb.grow(smallVec);
200 if (bb.overlaps(faceBb))
211 const fvPatch& fvp =
pbm[patchI];
214 if (isA<oversetFvPatch>(fvp))
217 const polyPatch&
pp = fvp.patch();
221 patchCellTypes[cellMap[fc[i]]] = patchCellType::OVERSET;
224 boundBox faceBb(
pp.points(),
pp[i],
false);
225 faceBb.grow(smallVec);
227 if (bb.overlaps(faceBb))
229 fill(
patchTypes, bb, nDivs, faceBb, patchCellType::OVERSET);
241 const PackedList<2>& vals,
242 const treeBoundBox& subBb,
243 const unsigned int val
248 labelVector minIds(index3(bb, nDivs, subBb.min()));
249 labelVector maxIds(index3(bb, nDivs, subBb.max()));
251 for (
direction cmpt = 0; cmpt < 3; cmpt++)
253 if (maxIds[cmpt] < 0 || minIds[cmpt] > nDivs[cmpt])
261 maxIds =
min(maxIndex, maxIds);
263 for (label i = minIds[0]; i <= maxIds[0]; i++)
265 for (label j = minIds[1]; j <= maxIds[1]; j++)
267 for (label
k = minIds[2];
k <= maxIds[2];
k++)
283 PstreamBuffers& pBufs,
285 const PtrList<fvMeshSubset>& meshParts,
287 const List<treeBoundBoxList>& patchBb,
288 const List<labelVector>& patchDivisions,
289 const PtrList<PackedList<2>>& patchParts,
298 const labelList& tgtCellMap = meshParts[tgtI].cellMap();
305 if (srcPatchBb.overlaps(tgtPatchBb))
307 const PackedList<2>& srcPatchTypes = patchParts[srcI];
308 const labelVector& zoneDivs = patchDivisions[srcI];
310 forAll(tgtCellMap, tgtCelli)
312 label celli = tgtCellMap[tgtCelli];
313 treeBoundBox cBb(mesh_.cellBb(celli));
328 allCellTypes[celli] = HOLE;
342 const treeBoundBox& tgtPatchBb = tgtPatchBbs[procI];
344 if (srcPatchBb.overlaps(tgtPatchBb))
348 UOPstream
os(procI, pBufs);
349 os << srcPatchBb << patchDivisions[srcI] << patchParts[srcI];
353 pBufs.finishedSends();
358 const treeBoundBox& srcPatchBb = srcPatchBbs[procI];
361 if (srcPatchBb.overlaps(tgtPatchBb))
363 UIPstream is(procI, pBufs);
364 const treeBoundBox receivedBb(is);
366 const PackedList<2> srcPatchTypes(is);
369 if (srcPatchBb != receivedBb)
373 <<
" srcPatchBb:" << srcPatchBb
374 <<
" receivedBb:" << receivedBb
378 forAll(tgtCellMap, tgtCelli)
380 label celli = tgtCellMap[tgtCelli];
381 treeBoundBox cBb(mesh_.cellBb(celli));
396 allCellTypes[celli] = HOLE;
407 const label destMesh,
408 const label currentDonorMesh,
409 const label newDonorMesh
422 if (currentDonorMesh == -1)
428 const label currentDist =
mag(currentDonorMesh-destMesh);
429 const label newDist =
mag(newDonorMesh-destMesh);
431 if (newDist < currentDist)
435 else if (newDist == currentDist && newDonorMesh > currentDonorMesh)
449 const globalIndex& globalCells,
450 PstreamBuffers& pBufs,
451 const PtrList<fvMeshSubset>& meshParts,
452 const List<treeBoundBoxList>&
meshBb,
465 const fvMesh& srcMesh = meshParts[srcI].subMesh();
466 const labelList& srcCellMap = meshParts[srcI].cellMap();
467 const fvMesh& tgtMesh = meshParts[tgtI].subMesh();
468 const pointField& tgtCc = tgtMesh.cellCentres();
469 const labelList& tgtCellMap = meshParts[tgtI].cellMap();
475 forAll(tgtCellMap, tgtCelli)
477 const label srcCelli = tgtToSrcAddr[tgtCelli];
481 && allCellTypes[tgtCellMap[tgtCelli]] != HOLE
484 label celli = tgtCellMap[tgtCelli];
488 if (betterDonor(tgtI, allDonor[celli], srcI))
491 globalCells.toGlobal(srcCellMap[srcCelli]);
492 allStencil[celli].setSize(1);
493 allStencil[celli][0] = globalDonor;
494 allDonor[celli] = srcI;
515 tgtOverlapProcs.append(procI);
519 srcOverlapProcs.append(procI);
527 forAll(srcOverlapProcs, i)
529 label procI = srcOverlapProcs[i];
530 tgtSendCells[procI].reserve(tgtMesh.nCells()/srcOverlapProcs.size());
534 forAll(tgtCellMap, tgtCelli)
536 label celli = tgtCellMap[tgtCelli];
537 if (srcOverlapProcs.size())
539 treeBoundBox subBb(mesh_.cellBb(celli));
540 subBb.grow(smallVec_);
542 forAll(srcOverlapProcs, i)
544 const label procI = srcOverlapProcs[i];
545 if (subBb.overlaps(srcBbs[procI]))
547 tgtSendCells[procI].append(tgtCelli);
556 forAll(srcOverlapProcs, i)
558 label procI = srcOverlapProcs[i];
561 UOPstream
os(procI, pBufs);
562 os << UIndirectList<point>(tgtCc,
cellIDs);
564 pBufs.finishedSends();
567 (void)srcMesh.tetBasePtIs();
568 forAll(tgtOverlapProcs, i)
570 label procI = tgtOverlapProcs[i];
572 UIPstream is(procI, pBufs);
582 donors[sampleI] = globalCells.toGlobal(srcCellMap[srcCelli]);
587 UOPstream
os(procI, pBufs);
590 pBufs.finishedSends();
592 forAll(srcOverlapProcs, i)
594 label procI = srcOverlapProcs[i];
597 UIPstream is(procI, pBufs);
600 if (donors.size() !=
cellIDs.size())
608 label globalDonor = donors[donorI];
610 if (globalDonor != -1)
612 label celli = tgtCellMap[
cellIDs[donorI]];
616 if (betterDonor(tgtI, allDonor[celli], srcI))
618 allStencil[celli].setSize(1);
619 allStencil[celli][0] = globalDonor;
620 allDonor[celli] = srcI;
932 for (label faceI = 0; faceI <
mesh.nInternalFaces(); faceI++)
938 (ownType == HOLE && neiType != HOLE)
939 || (ownType != HOLE && neiType == HOLE)
953 for (label faceI =
mesh.nInternalFaces(); faceI <
mesh.nFaces(); faceI++)
956 label neiType = nbrCellTypes[faceI-
mesh.nInternalFaces()];
960 (ownType == HOLE && neiType != HOLE)
961 || (ownType != HOLE && neiType == HOLE)
974 const label nRegions = cellRegion.
nRegions();
1002 << nRegions <<
endl;
1023 for (label faceI = 0; faceI <
mesh.nInternalFaces(); faceI++)
1027 label ownRegion = cellRegion[own[faceI]];
1031 if (regionType[ownRegion] == 0)
1033 regionType[ownRegion] = 1;
1037 label neiRegion = cellRegion[nei[faceI]];
1041 if (regionType[neiRegion] == 0)
1043 regionType[neiRegion] = 1;
1050 label faceI =
mesh.nInternalFaces();
1051 faceI <
mesh.nFaces();
1057 label ownRegion = cellRegion[own[faceI]];
1059 if (regionType[ownRegion] == 0)
1061 regionType[ownRegion] = 1;
1073 if (isA<oversetFvPatch>(fvp))
1080 label regionI = cellRegion[fc[i]];
1082 if (
cellTypes[fc[i]] != HOLE && regionType[regionI] != 2)
1084 regionType[regionI] = 2;
1127 if (isA<oversetFvPatch>(fvp))
1132 label cellI = fc[i];
1133 label regionI = cellRegion[cellI];
1135 if (regionType[regionI] != 2)
1137 const labelList& slots = compactStencil[cellI];
1140 label otherType = cellRegionType[slots[i]];
1147 regionType[regionI] = 2;
1159 << nChanged <<
endl;
1170 forAll(cellRegion, cellI)
1172 label
type = regionType[cellRegion[cellI]];
1184 const point& sample,
1191 weights.setSize(donorCcs.size());
1195 const scalar d =
mag(sample-donorCcs[i]);
1199 weights[i] = scalar(1)/d;
1205 weights = scalar(0);
1206 weights[i] = scalar(1);
1226 const labelList& owner = mesh_.faceOwner();
1227 const labelList& neighbour = mesh_.faceNeighbour();
1231 boolList isDonor(cellInterpolationMap().constructSize(),
false);
1232 label nHoleDonors = 0;
1234 for (
const label celli : interpolationCells_)
1236 const labelList& slots = cellStencil_[celli];
1240 mapDistributeBase::distribute<bool, orEqOp<bool>, flipOp>
1245 cellInterpolationMap().constructMap(),
1247 cellInterpolationMap().subMap(),
1257 forAll(cellTypes_, celli)
1264 reduce(nHoleDonors, sumOp<label>());
1267 Pout<<
"Detected " << nHoleDonors
1268 <<
" hole cells that are used as donors" <<
endl;
1281 cellInterpolationMap().distribute(globalCellIDs);
1283 forAll(interpolationCells_, i)
1285 label cellI = interpolationCells_[i];
1286 const labelList& slots = cellStencil_[cellI];
1287 cellStencil_[cellI] = UIndirectList<label>(globalCellIDs, slots)();
1294 label nSpecialNear = 0;
1295 label nSpecialFar = 0;
1302 List<pointList> donorCcs(mesh_.nCells());
1305 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
1307 const label own = owner[facei];
1309 const label nbr = neighbour[facei];
1312 if (isDonor[own] && ownHole && !nbrHole)
1315 donorCcs[own].
append(mesh_.cellCentres()[nbr]);
1317 else if (isDonor[nbr] && nbrHole && !ownHole)
1319 donorCells[nbr].append(globalCells.
toGlobal(own));
1320 donorCcs[nbr].
append(mesh_.cellCentres()[own]);
1331 const label facei = bFacei+mesh_.nInternalFaces();
1332 const label own = owner[facei];
1336 if (isDonor[own] && ownHole && !nbrHole)
1338 donorCells[own].
append(nbrCells[bFacei]);
1339 donorCcs[own].
append(nbrCc[bFacei]);
1345 if (donorCcs[celli].size())
1347 cellStencil_[celli] = std::move(donorCells[celli]);
1350 mesh_.cellCentres()[celli],
1352 cellInterpolationWeights_[celli]
1354 cellTypes_[celli] = SPECIAL;
1355 interpolationCells_.append(celli);
1356 cellInterpolationWeight_[celli] = scalar(1);
1370 List<topoDistanceData<int>> cellData(mesh_.nCells());
1371 List<topoDistanceData<int>> faceData(mesh_.nFaces());
1373 int dummyTrackData(0);
1377 forAll(cellTypes_, celli)
1379 label cType = cellTypes_[celli];
1386 cellData[celli] = topoDistanceData<int>(
labelMin, 0);
1390 DynamicList<label> seedFaces(nHoleDonors);
1391 DynamicList<topoDistanceData<int>> seedData(nHoleDonors);
1393 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
1395 const label own = owner[facei];
1396 const bool ownLive =
1402 const label nbr = neighbour[facei];
1403 const bool nbrLive =
1409 if (ownLive && !nbrLive)
1412 const label globalOwn = globalCells.
toGlobal(own);
1413 seedData.append(topoDistanceData<int>(globalOwn, 0));
1415 else if (!ownLive && nbrLive)
1417 seedFaces.append(facei);
1418 const label globalNbr = globalCells.
toGlobal(nbr);
1419 seedData.append(topoDistanceData<int>(globalNbr, 0));
1425 const label facei = bFacei+mesh_.nInternalFaces();
1426 const label own = owner[facei];
1427 const bool ownLive =
1432 const bool nbrLive =
1438 if (ownLive && !nbrLive)
1441 const label globalOwn = globalCells.
toGlobal(own);
1442 seedData.append(topoDistanceData<int>(globalOwn, 0));
1447 FaceCellWave<topoDistanceData<int>> distanceCalc
1454 mesh_.globalData().nTotalCells()+1,
1467 && cellData[celli].valid(dummyTrackData)
1470 cellStencil_[celli].setSize(1);
1471 cellStencil_[celli] = cellData[celli].data();
1472 cellInterpolationWeights_[celli].setSize(1);
1473 cellInterpolationWeights_[celli] = 1.0;
1474 cellTypes_[celli] = SPECIAL;
1475 interpolationCells_.append(celli);
1476 cellInterpolationWeight_[celli] = 1.0;
1483 reduce(nSpecialNear, sumOp<label>());
1484 reduce(nSpecialFar, sumOp<label>());
1486 Pout<<
"Detected " << nHoleDonors
1487 <<
" hole cells that are used as donors of which" <<
nl 1488 <<
" next to live cells : " << nSpecialNear <<
nl 1489 <<
" other : " << nSpecialFar <<
nl 1495 List<Map<label>> compactMap;
1496 cellInterpolationMap_.reset
1512 const bool allowHoleDonors
1530 const vector greatPoint(GREAT, GREAT, GREAT);
1532 boolList isValidDonor(mesh_.nCells(),
true);
1533 if (!allowHoleDonors)
1535 forAll(cellTypes_, celli)
1537 if (cellTypes_[celli] == HOLE)
1539 isValidDonor[celli] =
false;
1545 bitSet doneAcceptor(interpolationCells_.size());
1554 forAll(interpolationCells_, i)
1556 if (!doneAcceptor[i])
1558 label cellI = interpolationCells_[i];
1559 const point& cc = mesh_.cellCentres()[cellI];
1560 const labelList& slots = cellStencil_[cellI];
1564 if (slots.size() > 1)
1569 else if (slots.size())
1573 const label elemi = slots[sloti];
1578 minMagSqrEqOp<point>()(
samples[elemi], cc);
1592 mapDistributeBase::distribute<point, minMagSqrEqOp<point>, flipOp>
1597 cellInterpolationMap().constructMap(),
1599 cellInterpolationMap().subMap(),
1603 minMagSqrEqOp<point>(),
1606 cellInterpolationMap().comm()
1612 DynamicList<label> donorCells(mesh_.nCells());
1615 if (
samples[cellI] != greatPoint)
1617 donorCells.append(cellI);
1639 label cellI = donorCells[i];
1640 const pointList& donorCentres = donorCellCentres[cellI];
1652 cellInterpolationMap().distribute(donorCellCells);
1653 cellInterpolationMap().distribute(donorWeights);
1654 cellInterpolationMap().distribute(
samples);
1657 forAll(interpolationCells_, i)
1659 if (!doneAcceptor[i])
1661 label cellI = interpolationCells_[i];
1662 const labelList& slots = cellStencil_[cellI];
1664 if (slots.size() > 1)
1669 else if (slots.size() == 1)
1671 const label sloti = slots[0];
1674 if (
samples[sloti] == mesh_.cellCentres()[cellI])
1676 cellStencil_[cellI].transfer(donorCellCells[sloti]);
1677 cellInterpolationWeights_[cellI].transfer
1683 doneAcceptor.set(i);
1691 List<Map<label>> compactMap;
1692 cellInterpolationMap_.reset
1706 Foam::cellCellStencils::inverseDistance::inverseDistance
1715 allowHoleDonors_(
dict.getOrDefault(
"allowHoleDonors", false)),
1716 allowInterpolatedDonors_
1718 dict.getOrDefault(
"allowInterpolatedDonors", true)
1722 interpolationCells_(0),
1723 cellInterpolationMap_(),
1725 cellInterpolationWeights_(0),
1726 cellInterpolationWeight_
1730 "cellInterpolationWeight",
1731 mesh_.facesInstance(),
1767 forAll(volCellTypes, celli)
1791 scalar layerRelax(dict_.getOrDefault(
"layerRelax", 1.0));
1793 scalar tol = dict_.getOrDefault(
"tolerance", 1
e-10);
1794 smallVec_ = mesh_.bounds().span()*tol;
1798 label nZones =
gMax(zoneID)+1;
1802 nCellsPerZone[zoneID[cellI]]++;
1806 const boundBox& allBb = mesh_.bounds();
1824 const fvMesh& subMesh = meshParts[zonei].subMesh();
1857 bbs[procI] = procBb[procI][zoneI];
1869 labelList allPatchTypes(mesh_.nCells(), OTHER);
1873 if (dict_.readIfPresent(
"searchBox", globalPatchBb))
1887 if (dict_.readIfPresent(
"searchBoxDivisions", globalDivs))
1889 patchDivisions = globalDivs;
1895 if (mesh_.nGeometricD() == 1)
1897 nDivs = mesh_.nCells();
1899 else if (mesh_.nGeometricD() == 2)
1901 nDivs = label(
Foam::sqrt(scalar(mesh_.nCells())));
1905 nDivs = label(
Foam::cbrt(scalar(mesh_.nCells())));
1920 forAll(patchParts, zoneI)
1927 patchDivisions[zoneI][0]
1928 *patchDivisions[zoneI][1]
1929 *patchDivisions[zoneI][2]
1934 meshParts[zoneI].subMesh(),
1938 patchDivisions[zoneI],
1941 meshParts[zoneI].cellMap(),
1949 Info<<
type() <<
" : detected " << nZones
1950 <<
" mesh regions" <<
endl;
1952 forAll(nCellsPerZone, zoneI)
1955 <<
" nCells:" << nCellsPerZone[zoneI]
1956 <<
" voxels:" << patchDivisions[zoneI]
1966 labelList allCellTypes(mesh_.nCells(), CALCULATED);
1969 labelList allDonorID(mesh_.nCells(), -1);
1976 for (label srcI = 0; srcI < meshParts.
size()-1; srcI++)
1978 for (label tgtI = srcI+1; tgtI < meshParts.
size(); tgtI++)
2012 for (label srcI = 0; srcI < meshParts.
size()-1; srcI++)
2014 for (label tgtI = srcI+1; tgtI < meshParts.
size(); tgtI++)
2045 if ((
debug & 2) && mesh_.time().writeTime())
2057 tallDonorID().write();
2061 forAll(allPatchTypes, cellI)
2063 if (allCellTypes[cellI] != HOLE)
2065 switch (allPatchTypes[cellI])
2070 if (allStencil[cellI].size())
2072 allCellTypes[cellI] = INTERPOLATED;
2076 allCellTypes[cellI] = HOLE;
2083 if ((
debug & 2) && mesh_.time().writeTime())
2087 createField(mesh_,
"allCellTypes_patch", allCellTypes)
2093 createField(mesh_,
"allCellTypes_old", cellTypes_)
2099 findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
2102 if ((
debug & 2) && mesh_.time().writeTime())
2106 createField(mesh_,
"allCellTypes_hole", allCellTypes)
2110 if ((
debug & 2) && mesh_.time().writeTime())
2113 forAll(allStencil, celli)
2115 stencilSize[celli] = allStencil[celli].size();
2119 createField(mesh_,
"allStencil_hole", stencilSize)
2125 forAll(allCellTypes, celli)
2127 if (allCellTypes[celli] == HOLE && allStencil[celli].size())
2129 allStencil[celli].clear();
2166 if ((
debug & 2) && mesh_.time().writeTime())
2170 createField(mesh_,
"allCellTypes_pre_front", allCellTypes)
2179 mapDistribute map(globalCells, compactStencil, compactStencilMap);
2185 label useLayer = dict_.getOrDefault(
"useLayer", -1);
2191 "oversetInterpolation" 2206 dict_.getOrDefault(
"holeLayers", 1),
2210 if ((
debug & 2) && mesh_.time().writeTime())
2214 createField(mesh_,
"allCellTypes_front", allCellTypes)
2224 label nCalculated = 0;
2226 forAll(cellTypes_, celli)
2228 if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE)
2230 if (allStencil[celli].size() == 0)
2233 allCellTypes[celli] = HOLE;
2234 allStencil[celli].clear();
2238 allCellTypes[celli] = INTERPOLATED;
2246 Pout<<
"Detected " << nCalculated <<
" cells changing from hole" 2247 <<
" to calculated. Changed to interpolated" 2259 cellTypes_.transfer(allCellTypes);
2260 cellStencil_.setSize(mesh_.nCells());
2261 cellInterpolationWeights_.setSize(mesh_.nCells());
2297 label nInterpolatedDonors = 0;
2298 forAll(cellTypes_, celli)
2300 if (cellTypes_[celli] == INTERPOLATED)
2302 const labelList& slots = compactStencil[celli];
2307 compactCellTypes[slots[0]] == HOLE
2310 !allowInterpolatedDonors_
2311 && compactCellTypes[slots[0]] == INTERPOLATED
2315 cellTypes_[celli] = POROUS;
2316 cellStencil_[celli].
clear();
2317 cellInterpolationWeights_[celli].clear();
2318 nInterpolatedDonors++;
2322 cellStencil_[celli].transfer(allStencil[celli]);
2323 cellInterpolationWeights_[celli].setSize(1);
2324 cellInterpolationWeights_[celli][0] = 1.0;
2325 interpolationCells.
append(celli);
2331 cellStencil_[celli].clear();
2332 cellInterpolationWeights_[celli].clear();
2339 <<
"interpolate Donors : " 2340 << nInterpolatedDonors <<
endl;
2344 cellInterpolationMap_.reset
2349 interpolationCells_.
transfer(interpolationCells);
2351 cellInterpolationWeight_.transfer(allWeight);
2356 >(cellInterpolationWeight_.boundaryFieldRef(),
false);
2359 if ((
debug & 2) && mesh_.time().writeTime())
2362 mesh_.time().
write();
2365 mkDir(mesh_.time().timePath());
2366 OBJstream str(mesh_.time().timePath()/
"injectionStencil.obj");
2367 Pout<<
type() <<
" : dumping injectionStencil to " 2368 << str.name() <<
endl;
2370 cellInterpolationMap().distribute(cc);
2372 forAll(cellStencil_, celli)
2374 const labelList& slots = cellStencil_[celli];
2377 const point& accCc = mesh_.cellCentres()[celli];
2380 const point& donorCc = cc[slots[i]];
2381 str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
2389 createStencil(globalCells, allowHoleDonors_);
2393 if (allowHoleDonors_)
2395 holeExtrapolationStencil(globalCells);
2398 if ((
debug & 2) && mesh_.time().writeTime())
2401 cellInterpolationWeight_.instance() = mesh_.time().timeName();
2402 cellInterpolationWeight_.write();
2407 forAll(cellStencil_, celli)
2409 const scalarList& wghts = cellInterpolationWeights_[celli];
2412 if (
mag(wghts[i]) >
mag(maxMagWeight[celli]))
2414 maxMagWeight[celli] = wghts[i];
2417 if (
mag(maxMagWeight[celli]) > 1)
2420 Pout<<
"cell:" << celli
2421 <<
" at:" << cc[celli]
2422 <<
" zone:" << zoneID[celli]
2423 <<
" donors:" << cellStencil_[celli]
2424 <<
" weights:" << wghts
2440 >(tfld.
ref().boundaryFieldRef(),
false);
2455 >(tfld.
ref().boundaryFieldRef(),
false);
2461 mkDir(mesh_.time().timePath());
2463 cellInterpolationMap().distribute(cc);
2468 mesh_.time().timePath()
2469 +
"/stencil_" +
name(zonei) +
".obj" 2471 Pout<<
type() <<
" : dumping to " << str.name() <<
endl;
2473 const labelList& subMeshCellMap = meshParts[zonei].cellMap();
2475 forAll(subMeshCellMap, subcelli)
2477 const label celli = subMeshCellMap[subcelli];
2478 const labelList& slots = cellStencil_[celli];
2479 const point& accCc = mesh_.cellCentres()[celli];
2482 const point& donorCc = cc[slots[i]];
2483 str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
2496 forAll(interpolationCells_, i)
2498 label celli = interpolationCells_[i];
2499 const labelList& slots = cellStencil_[celli];
2501 bool hasLocal =
false;
2502 bool hasRemote =
false;
2506 if (slots[sloti] >= mesh_.nCells())
2533 Info<<
"Overset analysis : nCells : " 2536 <<
indent <<
"calculated : " << nCells[CALCULATED] <<
nl 2537 <<
indent <<
"interpolated : " << nCells[INTERPOLATED]
2541 <<
indent <<
"hole : " << nCells[HOLE] <<
nl static point position(const boundBox &bb, const labelVector &nDivs, const label boxI)
Convert index back into coordinate.
List< scalar > scalarList
List of scalar.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Inverse-distance-weighted interpolation stencil.
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
const word zeroGradientType
A zeroGradient patch field type.
Ostream & indent(Ostream &os)
Indent stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static labelVector index3(const labelVector &nDivs, const label)
Convert single index into ijk.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
void findHoles(const globalIndex &globalCells, const fvMesh &mesh, const labelList &zoneID, const labelListList &stencil, labelList &cellTypes) const
Do flood filling to detect unreachable (from patches) sections.
const bitSet isBlockedFace(intersectedFaces())
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute List data using default commsType, default flip/negate operator.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
constexpr char nl
The newline '\n' character (0x0a)
wordList patchTypes(nPatches)
static void calculate(const polyMesh &src, const polyMesh &tgt, labelList &srcToTgtAddr)
Calculate addressing.
bool betterDonor(const label destMesh, const label currentDonorMesh, const label newDonorMesh) const
If multiple donors meshes: decide which is best.
UIndirectList< label > labelUIndList
UIndirectList of labels.
scalarField samples(nIntervals, Zero)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void markBoundaries(const fvMesh &mesh, const vector &smallVec, const boundBox &bb, const labelVector &nDivs, PackedList< 2 > &patchTypes, const labelList &cellMap, labelList &patchCellTypes)
Mark voxels of patchTypes with type of patch face.
static tmp< volScalarField > createField(const fvMesh &mesh, const scalar val)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
defineTypeNameAndDebug(cellVolumeWeight, 0)
static void fill(PackedList< 2 > &elems, const boundBox &bb, const labelVector &nDivs, const boundBox &subBb, const unsigned int val)
Fill all elements overlapping subBb with value val.
Template invariant parts for fvPatchField.
A bounding box defined in terms of min/max extrema points.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
static int & msgType() noexcept
Message tag of standard messages.
List< treeBoundBox > treeBoundBoxList
A List of treeBoundBox.
label k
Boltzmann constant.
Ignore writing from objectRegistry::writeObject()
const point & min() const noexcept
Minimum describing the bounding box.
const dimensionSet dimless
Dimensionless.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
const Time & time() const
Return the top-level database.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
List< labelList > labelListList
List of labelList.
virtual ~inverseDistance()
Destructor.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
label nGeometricD() const
Return the number of valid geometric dimensions in the mesh.
Macros for easy insertion into run-time selection tables.
void inplaceToGlobal(const label proci, labelUList &labels) const
From local to global index on proci (inplace)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
void markDonors(const globalIndex &globalCells, PstreamBuffers &pBufs, const PtrList< fvMeshSubset > &meshParts, const List< treeBoundBoxList > &meshBb, const labelList &allCellTypes, const label srcI, const label tgtI, labelListList &allStencil, labelList &allDonor) const
Determine donors for all tgt cells.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const point & max() const noexcept
Maximum describing the bounding box.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
void suppressMotionFields()
Helper: populate nonInterpolatedFields_ with motion solver.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Calculation of interpolation stencils.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
virtual void stencilWeights(const point &sample, const pointList &donorCcs, scalarList &weights) const
Calculate inverse distance weights for a single acceptor.
void clear()
Clear the list, i.e. set size to zero.
List< scalarList > scalarListList
List of scalarList.
void markPatchesAsHoles(PstreamBuffers &pBufs, const PtrList< fvMeshSubset > &meshParts, const List< treeBoundBoxList > &patchBb, const List< labelVector > &patchDivisions, const PtrList< PackedList< 2 >> &patchParts, const label srcI, const label tgtI, labelList &allCellTypes) const
Mark all cells overlapping (a voxel covered by) a src patch.
virtual const labelUList & faceCells() const
Return faceCells.
const label nSamples(pdfDictionary.get< label >("nSamples"))
label size() const noexcept
The number of entries in the list.
dimensionedScalar cbrt(const dimensionedScalar &ds)
Reading is optional [identical to LAZY_READ].
const dictionary & schemesDict() const
The entire dictionary or the optional "select" sub-dictionary.
void append(const T &val)
Copy append an element to the end of this list.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
const fvMesh & mesh_
Reference to the mesh.
const labelList & cellTypes
virtual void createStencil(const globalIndex &, const bool allowHoleDonors)
Create stencil starting from the donor containing the acceptor allowHoleDonors : allow donors of type...
#define DebugInfo
Report an information message using Foam::Info.
static void correctBoundaryConditions(typename GeoField::Boundary &bfld, const bool typeOnly)
Correct boundary conditions of certain type (typeOnly = true) or explicitly not of the type (typeOnly...
virtual bool update()
Update stencils. Return false if nothing changed.
addToRunTimeSelectionTable(cellCellStencil, cellVolumeWeight, mesh)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
labelList cellTypes_
Per cell the cell type.
static label index(const labelVector &nDivs, const labelVector &)
Convert ijk indices into single index.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Buffers for inter-processor communications streams (UOPstream, UIPstream).
static bool constraintType(const word &patchType)
Return true if the given type is a constraint type.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual linear/tree communicat...
const labelIOList & zoneID() const
Helper: get reference to registered zoneID. Loads volScalarField.
Class containing processor-to-processor mapping information.
vector point
Point is a vector.
label toGlobal(const label proci, const label i) const
From local to global on proci.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Selector class for finite volume differencing schemes. fvMesh is derived from fvSchemes so that all f...
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
label nRegions() const
Return total number of regions.
vector span() const
The bounding box span (from minimum to maximum)
Standard boundBox with extra functionality for use in octree.
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Vector< label > labelVector
Vector of labels.
virtual void write(Ostream &os) const
Write.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
List< point > pointList
List of point.
List< label > labelList
A List of labels.
List< pointList > pointListList
List of pointList.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
static bool overlaps(const boundBox &bb, const labelVector &nDivs, const PackedList< 2 > &voxels, const treeBoundBox &subBb, const unsigned int val)
Is any voxel inside subBb set to val.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Defines the attributes of an object for which implicit objectRegistry management is supported...
static const List< T > & null() noexcept
Return a null List (reference to a nullObject). Behaves like an empty List.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
void holeExtrapolationStencil(const globalIndex &globalCells)
Make holes next to live ones type SPECIAL and include in interpolation stencil.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
static const Vector< label > zero
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Boundary condition for use on overset patches. To be run in combination with special dynamicFvMesh ty...
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Combines List elements. After completion all processors have the same data.
static constexpr const zero Zero
Global zero (0)