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))
1077 for (
const label celli : fvp.
faceCells())
1079 label regionI = cellRegion[celli];
1081 if (
cellTypes[celli] != HOLE && regionType[regionI] != 2)
1083 regionType[regionI] = 2;
1126 if (isA<oversetFvPatch>(fvp))
1131 label cellI = fc[i];
1132 label regionI = cellRegion[cellI];
1134 if (regionType[regionI] != 2)
1136 const labelList& slots = compactStencil[cellI];
1139 label otherType = cellRegionType[slots[i]];
1146 regionType[regionI] = 2;
1158 << nChanged <<
endl;
1169 forAll(cellRegion, cellI)
1171 label
type = regionType[cellRegion[cellI]];
1183 const point& sample,
1190 weights.setSize(donorCcs.size());
1194 const scalar d =
mag(sample-donorCcs[i]);
1198 weights[i] = scalar(1)/d;
1204 weights = scalar(0);
1205 weights[i] = scalar(1);
1225 const labelList& owner = mesh_.faceOwner();
1226 const labelList& neighbour = mesh_.faceNeighbour();
1230 boolList isDonor(cellInterpolationMap().constructSize(),
false);
1231 label nHoleDonors = 0;
1233 for (
const label celli : interpolationCells_)
1235 const labelList& slots = cellStencil_[celli];
1239 mapDistributeBase::distribute<bool, orEqOp<bool>, flipOp>
1244 cellInterpolationMap().constructMap(),
1246 cellInterpolationMap().subMap(),
1256 forAll(cellTypes_, celli)
1263 reduce(nHoleDonors, sumOp<label>());
1266 Pout<<
"Detected " << nHoleDonors
1267 <<
" hole cells that are used as donors" <<
endl;
1280 cellInterpolationMap().distribute(globalCellIDs);
1282 forAll(interpolationCells_, i)
1284 label cellI = interpolationCells_[i];
1285 const labelList& slots = cellStencil_[cellI];
1286 cellStencil_[cellI] = UIndirectList<label>(globalCellIDs, slots)();
1293 label nSpecialNear = 0;
1294 label nSpecialFar = 0;
1301 List<pointList> donorCcs(mesh_.nCells());
1304 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
1306 const label own = owner[facei];
1308 const label nbr = neighbour[facei];
1311 if (isDonor[own] && ownHole && !nbrHole)
1314 donorCcs[own].
append(mesh_.cellCentres()[nbr]);
1316 else if (isDonor[nbr] && nbrHole && !ownHole)
1318 donorCells[nbr].append(globalCells.
toGlobal(own));
1319 donorCcs[nbr].
append(mesh_.cellCentres()[own]);
1330 const label facei = bFacei+mesh_.nInternalFaces();
1331 const label own = owner[facei];
1335 if (isDonor[own] && ownHole && !nbrHole)
1337 donorCells[own].
append(nbrCells[bFacei]);
1338 donorCcs[own].
append(nbrCc[bFacei]);
1344 if (donorCcs[celli].size())
1346 cellStencil_[celli] = std::move(donorCells[celli]);
1349 mesh_.cellCentres()[celli],
1351 cellInterpolationWeights_[celli]
1353 cellTypes_[celli] = SPECIAL;
1354 interpolationCells_.append(celli);
1355 cellInterpolationWeight_[celli] = scalar(1);
1369 List<topoDistanceData<int>> cellData(mesh_.nCells());
1370 List<topoDistanceData<int>> faceData(mesh_.nFaces());
1372 int dummyTrackData(0);
1376 forAll(cellTypes_, celli)
1378 label cType = cellTypes_[celli];
1385 cellData[celli] = topoDistanceData<int>(
labelMin, 0);
1389 DynamicList<label> seedFaces(nHoleDonors);
1390 DynamicList<topoDistanceData<int>> seedData(nHoleDonors);
1392 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
1394 const label own = owner[facei];
1395 const bool ownLive =
1401 const label nbr = neighbour[facei];
1402 const bool nbrLive =
1408 if (ownLive && !nbrLive)
1411 const label globalOwn = globalCells.
toGlobal(own);
1412 seedData.append(topoDistanceData<int>(globalOwn, 0));
1414 else if (!ownLive && nbrLive)
1416 seedFaces.append(facei);
1417 const label globalNbr = globalCells.
toGlobal(nbr);
1418 seedData.append(topoDistanceData<int>(globalNbr, 0));
1424 const label facei = bFacei+mesh_.nInternalFaces();
1425 const label own = owner[facei];
1426 const bool ownLive =
1431 const bool nbrLive =
1437 if (ownLive && !nbrLive)
1440 const label globalOwn = globalCells.
toGlobal(own);
1441 seedData.append(topoDistanceData<int>(globalOwn, 0));
1446 FaceCellWave<topoDistanceData<int>> distanceCalc
1453 mesh_.globalData().nTotalCells()+1,
1466 && cellData[celli].valid(dummyTrackData)
1469 cellStencil_[celli].setSize(1);
1470 cellStencil_[celli] = cellData[celli].data();
1471 cellInterpolationWeights_[celli].setSize(1);
1472 cellInterpolationWeights_[celli] = 1.0;
1473 cellTypes_[celli] = SPECIAL;
1474 interpolationCells_.append(celli);
1475 cellInterpolationWeight_[celli] = 1.0;
1482 reduce(nSpecialNear, sumOp<label>());
1483 reduce(nSpecialFar, sumOp<label>());
1485 Pout<<
"Detected " << nHoleDonors
1486 <<
" hole cells that are used as donors of which" <<
nl 1487 <<
" next to live cells : " << nSpecialNear <<
nl 1488 <<
" other : " << nSpecialFar <<
nl 1494 List<Map<label>> compactMap;
1495 cellInterpolationMap_.reset
1511 const bool allowHoleDonors
1529 const vector greatPoint(GREAT, GREAT, GREAT);
1531 boolList isValidDonor(mesh_.nCells(),
true);
1532 if (!allowHoleDonors)
1534 forAll(cellTypes_, celli)
1536 if (cellTypes_[celli] == HOLE)
1538 isValidDonor[celli] =
false;
1544 bitSet doneAcceptor(interpolationCells_.size());
1553 forAll(interpolationCells_, i)
1555 if (!doneAcceptor[i])
1557 label cellI = interpolationCells_[i];
1558 const point& cc = mesh_.cellCentres()[cellI];
1559 const labelList& slots = cellStencil_[cellI];
1563 if (slots.size() > 1)
1568 else if (slots.size())
1572 const label elemi = slots[sloti];
1577 minMagSqrEqOp<point>()(
samples[elemi], cc);
1591 mapDistributeBase::distribute<point, minMagSqrEqOp<point>, flipOp>
1596 cellInterpolationMap().constructMap(),
1598 cellInterpolationMap().subMap(),
1602 minMagSqrEqOp<point>(),
1605 cellInterpolationMap().comm()
1611 DynamicList<label> donorCells(mesh_.nCells());
1614 if (
samples[cellI] != greatPoint)
1616 donorCells.append(cellI);
1638 label cellI = donorCells[i];
1639 const pointList& donorCentres = donorCellCentres[cellI];
1651 cellInterpolationMap().distribute(donorCellCells);
1652 cellInterpolationMap().distribute(donorWeights);
1653 cellInterpolationMap().distribute(
samples);
1656 forAll(interpolationCells_, i)
1658 if (!doneAcceptor[i])
1660 label cellI = interpolationCells_[i];
1661 const labelList& slots = cellStencil_[cellI];
1663 if (slots.size() > 1)
1668 else if (slots.size() == 1)
1670 const label sloti = slots[0];
1673 if (
samples[sloti] == mesh_.cellCentres()[cellI])
1675 cellStencil_[cellI].transfer(donorCellCells[sloti]);
1676 cellInterpolationWeights_[cellI].transfer
1682 doneAcceptor.set(i);
1690 List<Map<label>> compactMap;
1691 cellInterpolationMap_.reset
1705 Foam::cellCellStencils::inverseDistance::inverseDistance
1714 allowHoleDonors_(
dict.getOrDefault(
"allowHoleDonors", false)),
1715 allowInterpolatedDonors_
1717 dict.getOrDefault(
"allowInterpolatedDonors", true)
1721 interpolationCells_(0),
1722 cellInterpolationMap_(),
1724 cellInterpolationWeights_(0),
1725 cellInterpolationWeight_
1729 "cellInterpolationWeight",
1730 mesh_.facesInstance(),
1766 forAll(volCellTypes, celli)
1790 scalar layerRelax(dict_.getOrDefault(
"layerRelax", 1.0));
1792 scalar tol = dict_.getOrDefault(
"tolerance", 1
e-10);
1793 smallVec_ = mesh_.bounds().span()*tol;
1797 label nZones =
gMax(zoneID)+1;
1801 nCellsPerZone[zoneID[cellI]]++;
1805 const boundBox& allBb = mesh_.bounds();
1823 const fvMesh& subMesh = meshParts[zonei].subMesh();
1856 bbs[procI] = procBb[procI][zoneI];
1868 labelList allPatchTypes(mesh_.nCells(), OTHER);
1872 if (dict_.readIfPresent(
"searchBox", globalPatchBb))
1886 if (dict_.readIfPresent(
"searchBoxDivisions", globalDivs))
1888 patchDivisions = globalDivs;
1894 if (mesh_.nGeometricD() == 1)
1896 nDivs = mesh_.nCells();
1898 else if (mesh_.nGeometricD() == 2)
1900 nDivs = label(
Foam::sqrt(scalar(mesh_.nCells())));
1904 nDivs = label(
Foam::cbrt(scalar(mesh_.nCells())));
1919 forAll(patchParts, zoneI)
1926 patchDivisions[zoneI][0]
1927 *patchDivisions[zoneI][1]
1928 *patchDivisions[zoneI][2]
1933 meshParts[zoneI].subMesh(),
1937 patchDivisions[zoneI],
1940 meshParts[zoneI].cellMap(),
1948 Info<<
type() <<
" : detected " << nZones
1949 <<
" mesh regions" <<
endl;
1951 forAll(nCellsPerZone, zoneI)
1954 <<
" nCells:" << nCellsPerZone[zoneI]
1955 <<
" voxels:" << patchDivisions[zoneI]
1965 labelList allCellTypes(mesh_.nCells(), CALCULATED);
1968 labelList allDonorID(mesh_.nCells(), -1);
1975 for (label srcI = 0; srcI < meshParts.
size()-1; srcI++)
1977 for (label tgtI = srcI+1; tgtI < meshParts.
size(); tgtI++)
2011 for (label srcI = 0; srcI < meshParts.
size()-1; srcI++)
2013 for (label tgtI = srcI+1; tgtI < meshParts.
size(); tgtI++)
2044 if ((
debug & 2) && mesh_.time().writeTime())
2056 tallDonorID().write();
2060 forAll(allPatchTypes, cellI)
2062 if (allCellTypes[cellI] != HOLE)
2064 switch (allPatchTypes[cellI])
2069 if (allStencil[cellI].size())
2071 allCellTypes[cellI] = INTERPOLATED;
2075 allCellTypes[cellI] = HOLE;
2082 if ((
debug & 2) && mesh_.time().writeTime())
2086 createField(mesh_,
"allCellTypes_patch", allCellTypes)
2092 createField(mesh_,
"allCellTypes_old", cellTypes_)
2098 findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
2101 if ((
debug & 2) && mesh_.time().writeTime())
2105 createField(mesh_,
"allCellTypes_hole", allCellTypes)
2109 if ((
debug & 2) && mesh_.time().writeTime())
2112 forAll(allStencil, celli)
2114 stencilSize[celli] = allStencil[celli].size();
2118 createField(mesh_,
"allStencil_hole", stencilSize)
2124 forAll(allCellTypes, celli)
2126 if (allCellTypes[celli] == HOLE && allStencil[celli].size())
2128 allStencil[celli].clear();
2165 if ((
debug & 2) && mesh_.time().writeTime())
2169 createField(mesh_,
"allCellTypes_pre_front", allCellTypes)
2178 mapDistribute map(globalCells, compactStencil, compactStencilMap);
2184 label useLayer = dict_.getOrDefault(
"useLayer", -1);
2190 "oversetInterpolation" 2205 dict_.getOrDefault(
"holeLayers", 1),
2209 if ((
debug & 2) && mesh_.time().writeTime())
2213 createField(mesh_,
"allCellTypes_front", allCellTypes)
2223 label nCalculated = 0;
2225 forAll(cellTypes_, celli)
2227 if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE)
2229 if (allStencil[celli].size() == 0)
2232 allCellTypes[celli] = HOLE;
2233 allStencil[celli].clear();
2237 allCellTypes[celli] = INTERPOLATED;
2245 Pout<<
"Detected " << nCalculated <<
" cells changing from hole" 2246 <<
" to calculated. Changed to interpolated" 2258 cellTypes_.transfer(allCellTypes);
2259 cellStencil_.setSize(mesh_.nCells());
2260 cellInterpolationWeights_.setSize(mesh_.nCells());
2296 label nInterpolatedDonors = 0;
2297 forAll(cellTypes_, celli)
2299 if (cellTypes_[celli] == INTERPOLATED)
2301 const labelList& slots = compactStencil[celli];
2306 compactCellTypes[slots[0]] == HOLE
2309 !allowInterpolatedDonors_
2310 && compactCellTypes[slots[0]] == INTERPOLATED
2314 cellTypes_[celli] = POROUS;
2315 cellStencil_[celli].
clear();
2316 cellInterpolationWeights_[celli].clear();
2317 nInterpolatedDonors++;
2321 cellStencil_[celli].transfer(allStencil[celli]);
2322 cellInterpolationWeights_[celli].setSize(1);
2323 cellInterpolationWeights_[celli][0] = 1.0;
2324 interpolationCells.
append(celli);
2330 cellStencil_[celli].clear();
2331 cellInterpolationWeights_[celli].clear();
2338 <<
"interpolate Donors : " 2339 << nInterpolatedDonors <<
endl;
2343 cellInterpolationMap_.reset
2348 interpolationCells_.
transfer(interpolationCells);
2350 cellInterpolationWeight_.transfer(allWeight);
2356 >(cellInterpolationWeight_.boundaryFieldRef());
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
2441 >(tfld.
ref().boundaryFieldRef());
2457 >(tfld.
ref().boundaryFieldRef());
2463 mkDir(mesh_.time().timePath());
2465 cellInterpolationMap().distribute(cc);
2470 mesh_.time().timePath()
2471 +
"/stencil_" +
name(zonei) +
".obj" 2473 Pout<<
type() <<
" : dumping to " << str.name() <<
endl;
2475 const labelList& subMeshCellMap = meshParts[zonei].cellMap();
2477 forAll(subMeshCellMap, subcelli)
2479 const label celli = subMeshCellMap[subcelli];
2480 const labelList& slots = cellStencil_[celli];
2481 const point& accCc = mesh_.cellCentres()[celli];
2484 const point& donorCc = cc[slots[i]];
2485 str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
2498 forAll(interpolationCells_, i)
2500 label celli = interpolationCells_[i];
2501 const labelList& slots = cellStencil_[celli];
2503 bool hasLocal =
false;
2504 bool hasRemote =
false;
2508 if (slots[sloti] >= mesh_.nCells())
2535 Info<<
"Overset analysis : nCells : " 2538 <<
indent <<
"calculated : " << nCells[CALCULATED] <<
nl 2539 <<
indent <<
"interpolated : " << nCells[INTERPOLATED]
2543 <<
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.
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()). Negative if the process is not a...
const Time & time() const
Return the top-level database.
List< labelList > labelListList
List of labelList.
virtual ~inverseDistance()
Destructor.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
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)
UList< label > labelUList
A UList of labels.
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
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.
static void correctBoundaryConditions(typename GeoField::Boundary &bfld)
Correct boundary conditions of certain type (TypeOnly = true) or explicitly not of the type (TypeOnly...
const label nSamples(pdfDictionary.get< label >("nSamples"))
label size() const noexcept
The number of entries in the list.
const labelUList & cellTypes
dimensionedScalar cbrt(const dimensionedScalar &ds)
Reading is optional [identical to LAZY_READ].
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
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.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
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.
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.
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 int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
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...
A fvBoundaryMesh is a fvPatch list with a reference to the associated fvMesh, with additional search ...
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.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Defines the attributes of an object for which implicit objectRegistry management is supported...
static void listReduce(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce list elements (list must be equal size on all ranks), applying bop to each list element...
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.
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 constexpr const zero Zero
Global zero (0)