64 referPatchID_(referPatchID)
69 if (nbrProc_[a] < nbrProc_[b])
73 else if (nbrProc_[a] > nbrProc_[b])
80 return referPatchID_[a] < referPatchID_[
b];
90 void Foam::fvMeshDistribute::inplaceRenumberWithFlip
93 const bool oldToNewHasFlip,
94 const bool lstHasFlip,
98 if (!lstHasFlip && !oldToNewHasFlip)
109 label val = lst[elemI];
125 <<
"Problem : zero value " << val
126 <<
" at index " << elemI <<
" out of " << lst.
size()
133 label newVal = oldToNew[val];
149 <<
"Problem : zero value " << newVal
150 <<
" at index " << elemI <<
" out of " 158 lst[elemI] = sign*(newVal+1);
166 const bool selectEqual,
175 if (selectEqual == (values[i] == value))
186 if (selectEqual == (values[i] == value))
196 void Foam::fvMeshDistribute::checkEqualWordList
209 if (allNames[proci] != allNames[0])
212 <<
"When checking for equal " << msg.c_str() <<
" :" <<
endl 213 <<
"processor0 has:" << allNames[0] <<
endl 214 <<
"processor" << proci <<
" has:" << allNames[proci] <<
endl 215 << msg.c_str() <<
" need to be synchronised on all processors." 232 forAll(allNames[proci], i)
234 mergedNames.
insert(allNames[proci][i]);
237 return mergedNames.
toc();
244 Pout<<
"Primitives:" <<
nl 248 <<
" faces :" << mesh.
nFaces() <<
nl 249 <<
" cells :" << mesh.
nCells() <<
nl;
259 <<
" size:" << pp.size()
260 <<
" start:" << pp.
start()
261 <<
" type:" << pp.type()
271 Pout<<
" " << zoneI <<
" name:" << pz.
name()
272 <<
" size:" << pz.
size()
282 Pout<<
" " << zoneI <<
" name:" << fz.
name()
283 <<
" size:" << fz.
size()
293 Pout<<
" " << zoneI <<
" name:" << cz.
name()
294 <<
" size:" << cz.
size()
311 <<
"Current coupling info:" 314 forAll(sourceFace, bFacei)
318 Pout<<
" meshFace:" << meshFacei
320 <<
" connects to proc:" << sourceProc[bFacei]
321 <<
"/face:" << sourceFace[bFacei]
322 <<
" which will move to proc:" << sourceNewNbrProc[bFacei]
329 Foam::label Foam::fvMeshDistribute::findNonEmptyPatch()
const 333 label nonEmptyPatchi = -1;
339 if (!isA<emptyPolyPatch>(pp) && !pp.
coupled())
346 if (nonEmptyPatchi == -1)
349 <<
"Cannot find a patch which is neither of type empty nor" 350 <<
" coupled in patches " << patches.
names() <<
endl 351 <<
"There has to be at least one such patch for" 357 Pout<<
"findNonEmptyPatch : using patch " << nonEmptyPatchi
358 <<
" name:" << patches[nonEmptyPatchi].
name()
359 <<
" type:" << patches[nonEmptyPatchi].type()
360 <<
" to put exposed faces into." <<
endl;
366 label procPatchi = -1;
370 if (isA<processorPolyPatch>(patches[
patchi]))
374 else if (procPatchi != -1)
377 <<
"Processor patches should be at end of patch list." 379 <<
"Have processor patch " << procPatchi
380 <<
" followed by non-processor patch " << patchi
381 <<
" in patches " << patches.
names()
386 return nonEmptyPatchi;
394 const label destinationPatch
399 labelList newPatchID(mesh_.nFaces() - mesh_.nInternalFaces(), -1);
401 label nProcPatches = 0;
407 if (isA<processorPolyPatch>(pp))
411 Pout<<
"Moving all faces of patch " << pp.
name()
412 <<
" into patch " << destinationPatch
416 label offset = pp.
start() - mesh_.nInternalFaces();
420 newPatchID[offset+i] = destinationPatch;
441 if (!isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
443 oldToNew[
patchi] = newI++;
446 label nNonProcPatches = newI;
451 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
453 oldToNew[
patchi] = newI++;
472 forAll(newPatchID, bFacei)
474 if (newPatchID[bFacei] != -1)
476 label facei = mesh_.nInternalFaces() + bFacei;
478 label zoneID = mesh_.faceZones().whichZone(facei);
479 bool zoneFlip =
false;
483 const faceZone& fZone = mesh_.faceZones()[zoneID];
491 mesh_.faces()[facei],
493 mesh_.faceOwner()[facei],
511 saveBoundaryFields<scalar, surfaceMesh>(sFlds);
513 saveBoundaryFields<vector, surfaceMesh>(vFlds);
515 saveBoundaryFields<sphericalTensor, surfaceMesh>(sptFlds);
517 saveBoundaryFields<symmTensor, surfaceMesh>(sytFlds);
519 saveBoundaryFields<tensor, surfaceMesh>(tFlds);
531 mesh_.updateMesh(map);
535 mapBoundaryFields<scalar, surfaceMesh>(map, sFlds);
536 mapBoundaryFields<vector, surfaceMesh>(map, vFlds);
537 mapBoundaryFields<sphericalTensor, surfaceMesh>(map, sptFlds);
538 mapBoundaryFields<symmTensor, surfaceMesh>(map, sytFlds);
539 mapBoundaryFields<tensor, surfaceMesh>(map, tFlds);
543 if (map().hasMotionPoints())
545 mesh_.movePoints(map().preMotionPoints());
557 <<
"reverseFaceMap contains -1 at index:" 559 <<
"This means that the repatch operation was not just" 564 forAll(constructFaceMap, proci)
566 inplaceRenumberWithFlip
568 map().reverseFaceMap(),
571 constructFaceMap[proci]
595 forAll(pointToGlobalMaster, pointi)
597 if (pointToGlobalMaster[pointi] != -1)
603 Map<label> globalMasterToLocalMaster(2*nShared);
606 forAll(pointToGlobalMaster, pointi)
608 label globali = pointToGlobalMaster[pointi];
616 if (iter == globalMasterToLocalMaster.
end())
619 globalMasterToLocalMaster.
insert(globali, pointi);
620 pointToMaster.
insert(pointi, pointi);
624 pointToMaster.
insert(pointi, iter());
643 mesh_.updateMesh(map);
646 forAll(constructPointMap, proci)
648 labelList& constructMap = constructPointMap[proci];
652 label oldPointi = constructMap[i];
658 constructMap[i] = -newPointi-2;
660 else if (newPointi >= 0)
667 <<
"Problem. oldPointi:" << oldPointi
676 void Foam::fvMeshDistribute::getCouplingData
689 label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
693 sourceNewNbrProc.
setSize(nBnd);
707 label offset = pp.
start() - mesh_.nInternalFaces();
712 label bndI = offset + i;
713 nbrFaces[bndI] = pp.
start()+i;
731 label offset = pp.
start() - mesh_.nInternalFaces();
733 if (isA<processorPolyPatch>(pp))
736 refCast<const processorPolyPatch>(pp);
740 if (procPatch.
owner())
745 label bndI = offset + i;
746 sourceFace[bndI] = pp.
start()+i;
748 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
756 label bndI = offset + i;
757 sourceFace[bndI] = nbrFaces[bndI];
759 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
765 if (isA<processorCyclicPolyPatch>(pp))
767 patchi = refCast<const processorCyclicPolyPatch>
775 label bndI = offset + i;
776 sourcePatch[bndI] =
patchi;
779 else if (isA<cyclicPolyPatch>(pp))
787 label bndI = offset + i;
788 sourceFace[bndI] = pp.
start()+i;
790 sourcePatch[bndI] =
patchi;
791 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
798 label bndI = offset + i;
799 sourceFace[bndI] = nbrFaces[bndI];
801 sourcePatch[bndI] =
patchi;
802 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
811 label bndI = offset + i;
812 sourceFace[bndI] = -1;
813 sourceProc[bndI] = -1;
814 sourcePatch[bndI] =
patchi;
815 sourceNewNbrProc[bndI] = -1;
822 sourcePointMaster.
setSize(mesh_.nPoints());
823 sourcePointMaster = -1;
831 const mapDistribute& slavesMap = gmd.globalCoPointSlavesMap();
835 forAll(meshPoints, pointi)
844 elems[pointi] = globalPointi;
847 label sloti = slots[i];
848 if (sloti >= meshPoints.
size())
852 elems[slots[i]] = globalPointi;
862 forAll(meshPoints, pointi)
864 sourcePointMaster[meshPoints[pointi]] = elems[pointi];
871 void Foam::fvMeshDistribute::subsetCouplingData
881 const label oldInternalFaces,
901 forAll(subFace, newBFacei)
905 label oldFacei = faceMap[newFacei];
908 if (oldFacei < oldInternalFaces)
910 subFace[newBFacei] = oldFacei;
912 subPatch[newBFacei] = -1;
914 label oldOwn = oldFaceOwner[oldFacei];
915 label oldNei = oldFaceNeighbour[oldFacei];
917 if (oldOwn == cellMap[mesh.
faceOwner()[newFacei]])
920 subNewNbrProc[newBFacei] = oldDistribution[oldNei];
925 subNewNbrProc[newBFacei] = oldDistribution[oldOwn];
931 label oldBFacei = oldFacei - oldInternalFaces;
933 subFace[newBFacei] = sourceFace[oldBFacei];
934 subProc[newBFacei] = sourceProc[oldBFacei];
935 subPatch[newBFacei] = sourcePatch[oldBFacei];
936 subNewNbrProc[newBFacei] = sourceNewNbrProc[oldBFacei];
947 void Foam::fvMeshDistribute::findCouples
968 forAll(domainProc, bFacei)
970 if (domainProc[bFacei] != -1 && domainPatch[bFacei] == -1)
974 labelPair(domainFace[bFacei], domainProc[bFacei]),
987 forAll(sourceFace, bFacei)
989 if (sourceProc[bFacei] != -1 && sourcePatch[bFacei] == -1)
991 labelPair myData(sourceFace[bFacei], sourceProc[bFacei]);
994 iter = map.find(myData);
996 if (iter != map.end())
998 label nbrBFacei = iter();
1001 slaveCoupledFaces[coupledI] =
1010 masterCoupledFaces.
setSize(coupledI);
1011 slaveCoupledFaces.
setSize(coupledI);
1015 Pout<<
"findCouples : found " << coupledI
1016 <<
" faces that will be stitched" <<
nl <<
endl;
1027 const label nInternalFaces1,
1033 forAll(boundaryData0, oldBFacei)
1041 boundaryData0[oldBFacei];
1045 forAll(boundaryData1, addedBFacei)
1052 boundaryData1[addedBFacei];
1056 return newBoundaryData;
1070 forAll(boundaryData0, oldPointi)
1077 newBoundaryData[
newPointi] = boundaryData0[oldPointi];
1081 forAll(boundaryData1, addedPointi)
1087 newBoundaryData[
newPointi] = boundaryData1[addedPointi];
1091 return newBoundaryData;
1099 const label oldInternalPatchi
1117 labelList(exposedFaces.size(), oldInternalPatchi),
1129 saveInternalFields(sFlds);
1131 saveInternalFields(vFlds);
1133 saveInternalFields(sptFlds);
1135 saveInternalFields(sytFlds);
1137 saveInternalFields(tFlds);
1143 mesh_.updateMesh(map);
1150 mapExposedFaces(map(), sFlds);
1151 mapExposedFaces(map(), vFlds);
1152 mapExposedFaces(map(), sptFlds);
1153 mapExposedFaces(map(), sytFlds);
1154 mapExposedFaces(map(), tFlds);
1162 if (map().hasMotionPoints())
1164 mesh_.movePoints(map().preMotionPoints());
1173 void Foam::fvMeshDistribute::addProcPatches
1195 label bFacei = indices[i];
1196 label proci = nbrProc[bFacei];
1200 if (!procPatchID[proci].
found(referPatchID[bFacei]))
1205 if (referPatchID[bFacei] == -1)
1213 mesh_.boundaryMesh().size(),
1214 mesh_.boundaryMesh(),
1219 procPatchID[proci].insert
1221 referPatchID[bFacei],
1235 = refCast<const coupledPolyPatch>
1237 mesh_.boundaryMesh()[referPatchID[bFacei]]
1243 mesh_.boundaryMesh().size(),
1244 mesh_.boundaryMesh(),
1250 procPatchID[proci].insert
1252 referPatchID[bFacei],
1283 label origPatchi = referPatchID[bFacei];
1284 patchIDs[bFacei] = origPatchi;
1286 else if (nbrProc[bFacei] != -1)
1288 label origPatchi = referPatchID[bFacei];
1289 patchIDs[bFacei] = procPatchID[nbrProc[bFacei]][origPatchi];
1293 patchIDs[bFacei] = -1;
1301 void Foam::fvMeshDistribute::sendMesh
1320 Pout<<
"Sending to domain " << domain <<
nl 1322 <<
" nFaces:" << mesh.
nFaces() <<
nl 1323 <<
" nCells:" << mesh.
nCells() <<
nl 1336 forAll(pointZoneNames, nameI)
1342 rowSizes[nameI] = pointZones[myZoneID].
size();
1347 forAll(pointZoneNames, nameI)
1353 zonePoints[nameI].deepCopy(pointZones[myZoneID]);
1366 forAll(faceZoneNames, nameI)
1372 rowSizes[nameI] = faceZones[myZoneID].
size();
1377 zoneFaceFlip.
setSize(rowSizes);
1379 forAll(faceZoneNames, nameI)
1385 zoneFaces[nameI].deepCopy(faceZones[myZoneID]);
1386 zoneFaceFlip[nameI].deepCopy(faceZones[myZoneID].flipMap());
1398 forAll(cellZoneNames, nameI)
1404 rowSizes[nameI] = cellZones[myZoneID].
size();
1410 forAll(cellZoneNames, nameI)
1416 zoneCells[nameI].deepCopy(cellZones[myZoneID]);
1452 << sourcePointMaster;
1457 Pout<<
"Started sending mesh to domain " << domain
1470 const Time& runTime,
1493 >> domainSourcePatch
1494 >> domainSourceNewNbrProc
1495 >> domainSourcePointMaster;
1511 move(domainAllOwner),
1512 move(domainAllNeighbour),
1516 fvMesh& domainMesh = domainMeshPtr();
1524 patchEntries[
patchi].keyword(),
1570 domainMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
1572 return domainMeshPtr;
1594 forAll(distribution, celli)
1596 label newProc = distribution[celli];
1603 <<
"At index " << celli <<
" distribution:" << newProc
1621 <<
"Size of distribution:" 1622 << distribution.
size() <<
" mesh nCells:" << mesh_.
nCells()
1633 <<
"This application requires all non-processor patches" 1634 <<
" to be present in the same order on all patches" <<
nl 1635 <<
"followed by the processor patches (which of course are unique)." 1650 oldPatchNMeshPoints[
patchi] = patches[
patchi].nPoints();
1667 move(oldPatchStarts),
1668 move(oldPatchNMeshPoints),
1754 checkEqualWordList(
"volScalarFields", volScalars);
1756 checkEqualWordList(
"volVectorFields", volVectors);
1761 checkEqualWordList(
"volSphericalTensorFields", volSphereTensors);
1763 checkEqualWordList(
"volSymmTensorFields", volSymmTensors);
1765 checkEqualWordList(
"volTensorField", volTensors);
1768 checkEqualWordList(
"surfaceScalarFields", surfScalars);
1770 checkEqualWordList(
"surfaceVectorFields", surfVectors);
1775 checkEqualWordList(
"surfaceSphericalTensorFields", surfSphereTensors);
1780 checkEqualWordList(
"surfaceSymmTensorFields", surfSymmTensors);
1782 checkEqualWordList(
"surfaceTensorFields", surfTensors);
1785 checkEqualWordList(
"pointScalarFields", pointScalars);
1787 checkEqualWordList(
"pointVectorFields", pointVectors);
1792 checkEqualWordList(
"pointSphericalTensorFields", pointSphereTensors);
1797 checkEqualWordList(
"pointSymmTensorFields", pointSymmTensors);
1799 checkEqualWordList(
"pointTensorFields", pointTensors);
1804 const wordList dimScalars(mesh_.
names(dimScalType::typeName));
1805 checkEqualWordList(
"volScalarField::Internal", dimScalars);
1808 const wordList dimVectors(mesh_.
names(dimVecType::typeName));
1809 checkEqualWordList(
"volVectorField::Internal", dimVectors);
1812 const wordList dimSphereTensors(mesh_.
names(dimSphereType::typeName));
1815 "volSphericalTensorField::Internal",
1820 const wordList dimSymmTensors(mesh_.
names(dimSymmTensorType::typeName));
1823 "volSymmTensorField::Internal",
1828 const wordList dimTensors(mesh_.
names(dimTensorType::typeName));
1829 checkEqualWordList(
"volTensorField::Internal", dimTensors);
1834 label oldInternalPatchi = findNonEmptyPatch();
1845 repatchFaceMap = repatchMap().faceMap();
1852 repatchMap().reverseFaceMap(),
1870 Pout<<
nl <<
"MESH WITH PROC PATCHES DELETED:" <<
endl;
1872 printFieldInfo<volScalarField>(mesh_);
1873 printFieldInfo<volVectorField>(mesh_);
1874 printFieldInfo<volSphericalTensorField>(mesh_);
1875 printFieldInfo<volSymmTensorField>(mesh_);
1876 printFieldInfo<volTensorField>(mesh_);
1877 printFieldInfo<surfaceScalarField>(mesh_);
1878 printFieldInfo<surfaceVectorField>(mesh_);
1879 printFieldInfo<surfaceSphericalTensorField>(mesh_);
1880 printFieldInfo<surfaceSymmTensorField>(mesh_);
1881 printFieldInfo<surfaceTensorField>(mesh_);
1882 printFieldInfo<pointScalarField>(mesh_);
1883 printFieldInfo<pointVectorField>(mesh_);
1884 printFieldInfo<pointSphericalTensorField>(mesh_);
1885 printFieldInfo<pointSymmTensorField>(mesh_);
1886 printFieldInfo<pointTensorField>(mesh_);
1938 <<
"SUBSETTING FOR DOMAIN " << recvProc
1939 <<
" cells to send:" 1960 subCellMap[recvProc] = subsetter.
cellMap();
1962 inplaceRenumberWithFlip
1967 subFaceMap[recvProc]
1969 subPointMap[recvProc] = subsetter.
pointMap();
1970 subPatchMap[recvProc] = subsetter.
patchMap();
2001 procSourceNewNbrProc,
2002 procSourcePointMaster
2019 procSourceNewNbrProc,
2020 procSourcePointMaster,
2026 sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
2027 sendFields<volVectorField>(recvProc, volVectors, subsetter, str);
2028 sendFields<volSphericalTensorField>
2035 sendFields<volSymmTensorField>
2042 sendFields<volTensorField>(recvProc, volTensors, subsetter, str);
2045 sendFields<surfaceScalarField>
2052 sendFields<surfaceVectorField>
2059 sendFields<surfaceSphericalTensorField>
2066 sendFields<surfaceSymmTensorField>
2073 sendFields<surfaceTensorField>
2082 sendFields<pointScalarField>
2089 sendFields<pointVectorField>
2096 sendFields<pointSphericalTensorField>
2103 sendFields<pointSymmTensorField>
2110 sendFields<pointTensorField>
2119 sendFields<volScalarField::Internal>
2126 sendFields<volVectorField::Internal>
2133 sendFields<volSphericalTensorField::Internal>
2140 sendFields<volSymmTensorField::Internal>
2147 sendFields<volTensorField::Internal>
2195 faceMap[faceI] += 1;
2200 label faceI = iter.key();
2201 faceMap[faceI] = -faceMap[faceI];
2223 subMap().pointMap(),
2241 domainSourceNewNbrProc,
2242 domainSourcePointMaster
2245 sourceFace.
transfer(domainSourceFace);
2246 sourceProc.
transfer(domainSourceProc);
2247 sourcePatch.
transfer(domainSourcePatch);
2248 sourceNewNbrProc.
transfer(domainSourceNewNbrProc);
2249 sourcePointMaster.
transfer(domainSourcePointMaster);
2258 printFieldInfo<volScalarField>(mesh_);
2259 printFieldInfo<volVectorField>(mesh_);
2260 printFieldInfo<volSphericalTensorField>(mesh_);
2261 printFieldInfo<volSymmTensorField>(mesh_);
2262 printFieldInfo<volTensorField>(mesh_);
2263 printFieldInfo<surfaceScalarField>(mesh_);
2264 printFieldInfo<surfaceVectorField>(mesh_);
2265 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2266 printFieldInfo<surfaceSymmTensorField>(mesh_);
2267 printFieldInfo<surfaceTensorField>(mesh_);
2268 printFieldInfo<pointScalarField>(mesh_);
2269 printFieldInfo<pointVectorField>(mesh_);
2270 printFieldInfo<pointSphericalTensorField>(mesh_);
2271 printFieldInfo<pointSymmTensorField>(mesh_);
2272 printFieldInfo<pointTensorField>(mesh_);
2284 forAll(nSendCells, sendProc)
2296 <<
"RECEIVING FROM DOMAIN " << sendProc
2297 <<
" cells to receive:" 2343 domainMeshPtr = receiveMesh
2350 const_cast<Time&>(mesh_.
time()),
2354 domainSourceNewNbrProc,
2355 domainSourcePointMaster,
2358 fvMesh& domainMesh = domainMeshPtr();
2368 receiveFields<volScalarField>
2376 receiveFields<volVectorField>
2384 receiveFields<volSphericalTensorField>
2392 receiveFields<volSymmTensorField>
2400 receiveFields<volTensorField>
2410 receiveFields<surfaceScalarField>
2418 receiveFields<surfaceVectorField>
2426 receiveFields<surfaceSphericalTensorField>
2434 receiveFields<surfaceSymmTensorField>
2442 receiveFields<surfaceTensorField>
2454 receiveFields<pointScalarField>
2462 receiveFields<pointVectorField>
2470 receiveFields<pointSphericalTensorField>
2478 receiveFields<pointSymmTensorField>
2486 receiveFields<pointTensorField>
2496 receiveFields<volScalarField::Internal>
2507 receiveFields<volVectorField::Internal>
2518 receiveFields<volSphericalTensorField::Internal>
2530 receiveFields<volSymmTensorField::Internal>
2541 receiveFields<volTensorField::Internal>
2553 const fvMesh& domainMesh = domainMeshPtr();
2556 constructCellMap[sendProc] =
identity(domainMesh.nCells());
2557 constructFaceMap[sendProc] =
identity(domainMesh.nFaces()) + 1;
2558 constructPointMap[sendProc] =
identity(domainMesh.nPoints());
2559 constructPatchMap[sendProc] =
2560 identity(domainMesh.boundaryMesh().size());
2566 Pout<<
nl <<
"RECEIVED MESH FROM:" << sendProc <<
endl;
2568 printFieldInfo<volScalarField>(domainMesh);
2569 printFieldInfo<volVectorField>(domainMesh);
2570 printFieldInfo<volSphericalTensorField>(domainMesh);
2571 printFieldInfo<volSymmTensorField>(domainMesh);
2572 printFieldInfo<volTensorField>(domainMesh);
2573 printFieldInfo<surfaceScalarField>(domainMesh);
2574 printFieldInfo<surfaceVectorField>(domainMesh);
2575 printFieldInfo<surfaceSphericalTensorField>(domainMesh);
2576 printFieldInfo<surfaceSymmTensorField>(domainMesh);
2577 printFieldInfo<surfaceTensorField>(domainMesh);
2578 printFieldInfo<pointScalarField>(domainMesh);
2579 printFieldInfo<pointVectorField>(domainMesh);
2580 printFieldInfo<pointSphericalTensorField>(domainMesh);
2581 printFieldInfo<pointSymmTensorField>(domainMesh);
2582 printFieldInfo<pointTensorField>(domainMesh);
2640 sourceFace = mapBoundaryData
2645 domainMesh.nInternalFaces(),
2648 sourceProc = mapBoundaryData
2653 domainMesh.nInternalFaces(),
2656 sourcePatch = mapBoundaryData
2661 domainMesh.nInternalFaces(),
2664 sourceNewNbrProc = mapBoundaryData
2669 domainMesh.nInternalFaces(),
2670 domainSourceNewNbrProc
2673 sourcePointMaster = mapPointData
2678 domainSourcePointMaster
2684 const labelList& oldCellMap = map().oldCellMap();
2685 const labelList& oldFaceMap = map().oldFaceMap();
2686 const labelList& oldPointMap = map().oldPointMap();
2687 const labelList& oldPatchMap = map().oldPatchMap();
2690 forAll(constructPatchMap, proci)
2692 if (proci != sendProc && constructPatchMap[proci].size())
2696 inplaceRenumberWithFlip
2701 constructFaceMap[proci]
2713 label nBnd = domainMesh.nFaces()-domainMesh.nInternalFaces();
2714 flippedAddedFaces.
resize(nBnd/4);
2718 label domainFaceI = domainMesh.nInternalFaces();
2719 domainFaceI < domainMesh.nFaces();
2723 label newFaceI = map().addedFaceMap()[domainFaceI];
2726 label domainCellI = domainMesh.faceOwner()[domainFaceI];
2728 if (newCellI != map().addedCellMap()[domainCellI])
2730 flippedAddedFaces.
insert(domainFaceI);
2741 label domainFaceI = iter.key();
2742 label& val = constructFaceMap[sendProc][domainFaceI];
2745 inplaceRenumberWithFlip
2747 map().addedFaceMap(),
2750 constructFaceMap[sendProc]
2757 Pout<<
nl <<
"MERGED MESH FROM:" << sendProc <<
endl;
2759 printFieldInfo<volScalarField>(mesh_);
2760 printFieldInfo<volVectorField>(mesh_);
2761 printFieldInfo<volSphericalTensorField>(mesh_);
2762 printFieldInfo<volSymmTensorField>(mesh_);
2763 printFieldInfo<volTensorField>(mesh_);
2764 printFieldInfo<surfaceScalarField>(mesh_);
2765 printFieldInfo<surfaceVectorField>(mesh_);
2766 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2767 printFieldInfo<surfaceSymmTensorField>(mesh_);
2768 printFieldInfo<surfaceTensorField>(mesh_);
2769 printFieldInfo<pointScalarField>(mesh_);
2770 printFieldInfo<pointVectorField>(mesh_);
2771 printFieldInfo<pointSphericalTensorField>(mesh_);
2772 printFieldInfo<pointSymmTensorField>(mesh_);
2773 printFieldInfo<pointTensorField>(mesh_);
2786 printFieldInfo<volScalarField>(mesh_);
2787 printFieldInfo<volVectorField>(mesh_);
2788 printFieldInfo<volSphericalTensorField>(mesh_);
2789 printFieldInfo<volSymmTensorField>(mesh_);
2790 printFieldInfo<volTensorField>(mesh_);
2791 printFieldInfo<surfaceScalarField>(mesh_);
2792 printFieldInfo<surfaceVectorField>(mesh_);
2793 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2794 printFieldInfo<surfaceSymmTensorField>(mesh_);
2795 printFieldInfo<surfaceTensorField>(mesh_);
2796 printFieldInfo<pointScalarField>(mesh_);
2797 printFieldInfo<pointVectorField>(mesh_);
2798 printFieldInfo<pointSphericalTensorField>(mesh_);
2799 printFieldInfo<pointSymmTensorField>(mesh_);
2800 printFieldInfo<pointTensorField>(mesh_);
2807 mergeSharedPoints(sourcePointMaster, constructPointMap);
2819 addProcPatches(sourceNewNbrProc, sourcePatch, procPatchID);
2838 repatch(newPatchID, constructFaceMap);
2842 initPatchFields<volScalarField, processorFvPatchField<scalar>>
2846 initPatchFields<volVectorField, processorFvPatchField<vector>>
2858 initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor>>
2862 initPatchFields<volTensorField, processorFvPatchField<tensor>>
2876 printFieldInfo<volScalarField>(mesh_);
2877 printFieldInfo<volVectorField>(mesh_);
2878 printFieldInfo<volSphericalTensorField>(mesh_);
2879 printFieldInfo<volSymmTensorField>(mesh_);
2880 printFieldInfo<volTensorField>(mesh_);
2881 printFieldInfo<surfaceScalarField>(mesh_);
2882 printFieldInfo<surfaceVectorField>(mesh_);
2883 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2884 printFieldInfo<surfaceSymmTensorField>(mesh_);
2885 printFieldInfo<surfaceTensorField>(mesh_);
2886 printFieldInfo<pointScalarField>(mesh_);
2887 printFieldInfo<pointVectorField>(mesh_);
2888 printFieldInfo<pointSphericalTensorField>(mesh_);
2889 printFieldInfo<pointSymmTensorField>(mesh_);
2890 printFieldInfo<pointTensorField>(mesh_);
2904 move(oldPatchStarts),
2905 move(oldPatchNMeshPoints),
2912 move(constructPointMap),
2913 move(constructFaceMap),
2914 move(constructCellMap),
2915 move(constructPatchMap),
const labelList & oldPointMap() const
From old mesh point/face/cell to new mesh point/face/cell.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
dimensionedScalar sign(const dimensionedScalar &ds)
List< labelList > labelListList
A List of labelList.
Neighbour processor patch.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
A HashTable with keys but without contents.
const labelList & patchMap() const
Return patch map.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
const word & name() const
Return name.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
const faceZoneMesh & faceZones() const
Return face zone mesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Class describing modification of a face.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
void setRefinement(const labelList &cellsToRemove, const labelList &facesToExpose, const labelList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
A list of keyword definitions, which are a keyword followed by any number of values (e...
void addFvPatches(const List< polyPatch *> &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
static const char *const typeName
Cell-face mesh analysis engine.
void resetMotion() const
Reset motion.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const labelList & faceFlipMap() const
Return face map with sign to encode flipped faces.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
const boolList & flipMap() const
Return face flip map.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Given list of cells to remove insert all the topology changes.
wordList names() const
Return the list of names of the IOobjects.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Class containing mesh-to-mesh mapping information after a mesh addition where we add a mesh ('added m...
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Less function class that can be used for sorting processor patches.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
A bounding box defined in terms of the points at its extremities.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const Time & time() const
Return the top-level database.
const labelList & addedPointMap() const
From added mesh point/face/cell to new mesh point/face/cell.
bool insert(const Key &key)
Insert a new entry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
label size() const
Return number of elements in table.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Various functions to operate on Lists.
Container for information needed to couple to meshes. When constructed from two meshes and a geometri...
static const pointMesh & New(const polyMesh &mesh)
Neighbour processor patch.
virtual const pointField & points() const
Return raw points.
Mesh representing a set of points created from polyMesh.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
fvMeshDistribute(fvMesh &mesh, const scalar mergeTol)
Construct from mesh and absolute merge tolerance.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Input inter-processor communications stream operating on external buffer.
A list of faces which address into the list of points.
virtual bool owner() const
Does this side own the patch ?
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A List obtained as a section of another List.
An ordered pair of two objects of type <T> with first() and second() elements.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
bool operator()(const label a, const label b)
const labelUList & faceCells() const
Return face-cell addressing.
label findZoneID(const word &zoneName) const
Find zone index given a name.
const dimensionedScalar & b
Wien displacement law constant: default SI units: [m K].
static void mergePoints(const polyMesh &, const Map< label > &pointToMaster, polyTopoChange &meshMod)
Helper: Merge points.
const pointZoneMesh & pointZones() const
Return point zone mesh.
label nOldInternalFaces() const
Number of old internal faces.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
wordList names() const
Return a list of patch names.
virtual const labelList & faceOwner() const
Return face owner.
const labelList & oldFaceMap() const
Pair< label > labelPair
Label pair.
const labelList & faceMap() const
Return face map.
List< label > labelList
A List of labels.
const word & name() const
Return name.
virtual const faceList & faces() const
Return raw faces.
int neighbProcNo() const
Return neighbour processor number.
An STL-conforming hash table.
void addZones(const List< pointZone *> &pz, const List< faceZone *> &fz, const List< cellZone *> &cz)
Add mesh zones.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
static autoPtr< mapAddedPolyMesh > add(fvMesh &mesh0, const fvMesh &mesh1, const faceCoupleInfo &coupleInfo, const bool validBoundary=true)
Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A packed storage unstructured matrix of objects of type <T> using an offset table for access...
void setSize(const label mRows)
Reset size of CompactListList.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Output inter-processor communications stream operating on external buffer.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
defineTypeNameAndDebug(combustionModel, 0)
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void setInstance(const fileName &)
Set the instance for mesh files.
This boundary condition enables processor communication across cyclic patches.
label size() const
Return the number of elements in the UPtrList.
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
const vectorField & faceCentres() const
label constructSize() const
Constructed data size.
Calculates points shared by more than two processor patches or cyclic patches.
void setSize(const label)
Reset size of List.
static void printMeshInfo(const fvMesh &)
Print some info on mesh.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Class containing processor-to-processor mapping information.
const fvMesh & subMesh() const
Return reference to subset mesh.
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() list...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
prefixOSstream Pout(cout, "Pout")
static void printCoupleInfo(const primitiveMesh &, const labelList &, const labelList &, const labelList &, const labelList &)
Print some info on coupling data.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label start() const
Return start label of this patch in the polyMesh face list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
lessProcPatches(const labelList &nbrProc, const labelList &referPatchID)
wordList names() const
Return a list of zone names.
void resize(const label newSize)
Resize the hash table for efficiency.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
This boundary condition enables processor communication across patches.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
labelList getExposedFaces(const labelList &cellsToRemove) const
Get labels of exposed faces.
A subset of mesh faces organised as a primitive patch.
List< Key > toc() const
Return the table of contents.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
A patch is a list of labels that address the faces in the global face list.
label size() const
Return the number of elements in the UList.
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
const labelList & addedFaceMap() const
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void setLargeCellSubset(const labelList ®ion, const label currentRegion, const label patchID=-1, const bool syncCouples=true)
Set the subset from all cells with region == currentRegion.
const labelList & cellMap() const
Return cell map.
const labelList & pointMap() const
Return point map.
virtual bool owner() const
Does the processor own the patch ?
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.