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(),
1251 procPatchID[proci].insert
1253 referPatchID[bFacei],
1284 label origPatchi = referPatchID[bFacei];
1285 patchIDs[bFacei] = origPatchi;
1287 else if (nbrProc[bFacei] != -1)
1289 label origPatchi = referPatchID[bFacei];
1290 patchIDs[bFacei] = procPatchID[nbrProc[bFacei]][origPatchi];
1294 patchIDs[bFacei] = -1;
1302 void Foam::fvMeshDistribute::sendMesh
1321 Pout<<
"Sending to domain " << domain <<
nl 1323 <<
" nFaces:" << mesh.
nFaces() <<
nl 1324 <<
" nCells:" << mesh.
nCells() <<
nl 1337 forAll(pointZoneNames, nameI)
1343 rowSizes[nameI] = pointZones[myZoneID].
size();
1348 forAll(pointZoneNames, nameI)
1354 zonePoints[nameI].deepCopy(pointZones[myZoneID]);
1367 forAll(faceZoneNames, nameI)
1373 rowSizes[nameI] = faceZones[myZoneID].
size();
1378 zoneFaceFlip.
setSize(rowSizes);
1380 forAll(faceZoneNames, nameI)
1386 zoneFaces[nameI].deepCopy(faceZones[myZoneID]);
1387 zoneFaceFlip[nameI].deepCopy(faceZones[myZoneID].flipMap());
1399 forAll(cellZoneNames, nameI)
1405 rowSizes[nameI] = cellZones[myZoneID].
size();
1411 forAll(cellZoneNames, nameI)
1417 zoneCells[nameI].deepCopy(cellZones[myZoneID]);
1453 << sourcePointMaster;
1458 Pout<<
"Started sending mesh to domain " << domain
1471 const Time& runTime,
1494 >> domainSourcePatch
1495 >> domainSourceNewNbrProc
1496 >> domainSourcePointMaster;
1512 move(domainAllOwner),
1513 move(domainAllNeighbour),
1517 fvMesh& domainMesh = domainMeshPtr();
1525 patchEntries[
patchi].keyword(),
1571 domainMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
1573 return domainMeshPtr;
1595 forAll(distribution, celli)
1597 label newProc = distribution[celli];
1604 <<
"At index " << celli <<
" distribution:" << newProc
1622 <<
"Size of distribution:" 1623 << distribution.
size() <<
" mesh nCells:" << mesh_.
nCells()
1634 <<
"This application requires all non-processor patches" 1635 <<
" to be present in the same order on all patches" <<
nl 1636 <<
"followed by the processor patches (which of course are unique)." 1651 oldPatchNMeshPoints[
patchi] = patches[
patchi].nPoints();
1668 move(oldPatchStarts),
1669 move(oldPatchNMeshPoints),
1755 checkEqualWordList(
"volScalarFields", volScalars);
1757 checkEqualWordList(
"volVectorFields", volVectors);
1762 checkEqualWordList(
"volSphericalTensorFields", volSphereTensors);
1764 checkEqualWordList(
"volSymmTensorFields", volSymmTensors);
1766 checkEqualWordList(
"volTensorField", volTensors);
1769 checkEqualWordList(
"surfaceScalarFields", surfScalars);
1771 checkEqualWordList(
"surfaceVectorFields", surfVectors);
1776 checkEqualWordList(
"surfaceSphericalTensorFields", surfSphereTensors);
1781 checkEqualWordList(
"surfaceSymmTensorFields", surfSymmTensors);
1783 checkEqualWordList(
"surfaceTensorFields", surfTensors);
1786 checkEqualWordList(
"pointScalarFields", pointScalars);
1788 checkEqualWordList(
"pointVectorFields", pointVectors);
1793 checkEqualWordList(
"pointSphericalTensorFields", pointSphereTensors);
1798 checkEqualWordList(
"pointSymmTensorFields", pointSymmTensors);
1800 checkEqualWordList(
"pointTensorFields", pointTensors);
1805 const wordList dimScalars(mesh_.
names(dimScalType::typeName));
1806 checkEqualWordList(
"volScalarField::Internal", dimScalars);
1809 const wordList dimVectors(mesh_.
names(dimVecType::typeName));
1810 checkEqualWordList(
"volVectorField::Internal", dimVectors);
1813 const wordList dimSphereTensors(mesh_.
names(dimSphereType::typeName));
1816 "volSphericalTensorField::Internal",
1821 const wordList dimSymmTensors(mesh_.
names(dimSymmTensorType::typeName));
1824 "volSymmTensorField::Internal",
1829 const wordList dimTensors(mesh_.
names(dimTensorType::typeName));
1830 checkEqualWordList(
"volTensorField::Internal", dimTensors);
1835 label oldInternalPatchi = findNonEmptyPatch();
1846 repatchFaceMap = repatchMap().faceMap();
1853 repatchMap().reverseFaceMap(),
1871 Pout<<
nl <<
"MESH WITH PROC PATCHES DELETED:" <<
endl;
1873 printFieldInfo<volScalarField>(mesh_);
1874 printFieldInfo<volVectorField>(mesh_);
1875 printFieldInfo<volSphericalTensorField>(mesh_);
1876 printFieldInfo<volSymmTensorField>(mesh_);
1877 printFieldInfo<volTensorField>(mesh_);
1878 printFieldInfo<surfaceScalarField>(mesh_);
1879 printFieldInfo<surfaceVectorField>(mesh_);
1880 printFieldInfo<surfaceSphericalTensorField>(mesh_);
1881 printFieldInfo<surfaceSymmTensorField>(mesh_);
1882 printFieldInfo<surfaceTensorField>(mesh_);
1883 printFieldInfo<pointScalarField>(mesh_);
1884 printFieldInfo<pointVectorField>(mesh_);
1885 printFieldInfo<pointSphericalTensorField>(mesh_);
1886 printFieldInfo<pointSymmTensorField>(mesh_);
1887 printFieldInfo<pointTensorField>(mesh_);
1939 <<
"SUBSETTING FOR DOMAIN " << recvProc
1940 <<
" cells to send:" 1961 subCellMap[recvProc] = subsetter.
cellMap();
1963 inplaceRenumberWithFlip
1968 subFaceMap[recvProc]
1970 subPointMap[recvProc] = subsetter.
pointMap();
1971 subPatchMap[recvProc] = subsetter.
patchMap();
2002 procSourceNewNbrProc,
2003 procSourcePointMaster
2020 procSourceNewNbrProc,
2021 procSourcePointMaster,
2027 sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
2028 sendFields<volVectorField>(recvProc, volVectors, subsetter, str);
2029 sendFields<volSphericalTensorField>
2036 sendFields<volSymmTensorField>
2043 sendFields<volTensorField>(recvProc, volTensors, subsetter, str);
2046 sendFields<surfaceScalarField>
2053 sendFields<surfaceVectorField>
2060 sendFields<surfaceSphericalTensorField>
2067 sendFields<surfaceSymmTensorField>
2074 sendFields<surfaceTensorField>
2083 sendFields<pointScalarField>
2090 sendFields<pointVectorField>
2097 sendFields<pointSphericalTensorField>
2104 sendFields<pointSymmTensorField>
2111 sendFields<pointTensorField>
2120 sendFields<volScalarField::Internal>
2127 sendFields<volVectorField::Internal>
2134 sendFields<volSphericalTensorField::Internal>
2141 sendFields<volSymmTensorField::Internal>
2148 sendFields<volTensorField::Internal>
2196 faceMap[faceI] += 1;
2201 label faceI = iter.key();
2202 faceMap[faceI] = -faceMap[faceI];
2224 subMap().pointMap(),
2242 domainSourceNewNbrProc,
2243 domainSourcePointMaster
2246 sourceFace.
transfer(domainSourceFace);
2247 sourceProc.
transfer(domainSourceProc);
2248 sourcePatch.
transfer(domainSourcePatch);
2249 sourceNewNbrProc.
transfer(domainSourceNewNbrProc);
2250 sourcePointMaster.
transfer(domainSourcePointMaster);
2259 printFieldInfo<volScalarField>(mesh_);
2260 printFieldInfo<volVectorField>(mesh_);
2261 printFieldInfo<volSphericalTensorField>(mesh_);
2262 printFieldInfo<volSymmTensorField>(mesh_);
2263 printFieldInfo<volTensorField>(mesh_);
2264 printFieldInfo<surfaceScalarField>(mesh_);
2265 printFieldInfo<surfaceVectorField>(mesh_);
2266 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2267 printFieldInfo<surfaceSymmTensorField>(mesh_);
2268 printFieldInfo<surfaceTensorField>(mesh_);
2269 printFieldInfo<pointScalarField>(mesh_);
2270 printFieldInfo<pointVectorField>(mesh_);
2271 printFieldInfo<pointSphericalTensorField>(mesh_);
2272 printFieldInfo<pointSymmTensorField>(mesh_);
2273 printFieldInfo<pointTensorField>(mesh_);
2285 forAll(nSendCells, sendProc)
2297 <<
"RECEIVING FROM DOMAIN " << sendProc
2298 <<
" cells to receive:" 2344 domainMeshPtr = receiveMesh
2351 const_cast<Time&>(mesh_.
time()),
2355 domainSourceNewNbrProc,
2356 domainSourcePointMaster,
2359 fvMesh& domainMesh = domainMeshPtr();
2369 receiveFields<volScalarField>
2377 receiveFields<volVectorField>
2385 receiveFields<volSphericalTensorField>
2393 receiveFields<volSymmTensorField>
2401 receiveFields<volTensorField>
2411 receiveFields<surfaceScalarField>
2419 receiveFields<surfaceVectorField>
2427 receiveFields<surfaceSphericalTensorField>
2435 receiveFields<surfaceSymmTensorField>
2443 receiveFields<surfaceTensorField>
2455 receiveFields<pointScalarField>
2463 receiveFields<pointVectorField>
2471 receiveFields<pointSphericalTensorField>
2479 receiveFields<pointSymmTensorField>
2487 receiveFields<pointTensorField>
2497 receiveFields<volScalarField::Internal>
2508 receiveFields<volVectorField::Internal>
2519 receiveFields<volSphericalTensorField::Internal>
2531 receiveFields<volSymmTensorField::Internal>
2542 receiveFields<volTensorField::Internal>
2554 const fvMesh& domainMesh = domainMeshPtr();
2557 constructCellMap[sendProc] =
identity(domainMesh.nCells());
2558 constructFaceMap[sendProc] =
identity(domainMesh.nFaces()) + 1;
2559 constructPointMap[sendProc] =
identity(domainMesh.nPoints());
2560 constructPatchMap[sendProc] =
2561 identity(domainMesh.boundaryMesh().size());
2567 Pout<<
nl <<
"RECEIVED MESH FROM:" << sendProc <<
endl;
2569 printFieldInfo<volScalarField>(domainMesh);
2570 printFieldInfo<volVectorField>(domainMesh);
2571 printFieldInfo<volSphericalTensorField>(domainMesh);
2572 printFieldInfo<volSymmTensorField>(domainMesh);
2573 printFieldInfo<volTensorField>(domainMesh);
2574 printFieldInfo<surfaceScalarField>(domainMesh);
2575 printFieldInfo<surfaceVectorField>(domainMesh);
2576 printFieldInfo<surfaceSphericalTensorField>(domainMesh);
2577 printFieldInfo<surfaceSymmTensorField>(domainMesh);
2578 printFieldInfo<surfaceTensorField>(domainMesh);
2579 printFieldInfo<pointScalarField>(domainMesh);
2580 printFieldInfo<pointVectorField>(domainMesh);
2581 printFieldInfo<pointSphericalTensorField>(domainMesh);
2582 printFieldInfo<pointSymmTensorField>(domainMesh);
2583 printFieldInfo<pointTensorField>(domainMesh);
2641 sourceFace = mapBoundaryData
2646 domainMesh.nInternalFaces(),
2649 sourceProc = mapBoundaryData
2654 domainMesh.nInternalFaces(),
2657 sourcePatch = mapBoundaryData
2662 domainMesh.nInternalFaces(),
2665 sourceNewNbrProc = mapBoundaryData
2670 domainMesh.nInternalFaces(),
2671 domainSourceNewNbrProc
2674 sourcePointMaster = mapPointData
2679 domainSourcePointMaster
2685 const labelList& oldCellMap = map().oldCellMap();
2686 const labelList& oldFaceMap = map().oldFaceMap();
2687 const labelList& oldPointMap = map().oldPointMap();
2688 const labelList& oldPatchMap = map().oldPatchMap();
2691 forAll(constructPatchMap, proci)
2693 if (proci != sendProc && constructPatchMap[proci].size())
2697 inplaceRenumberWithFlip
2702 constructFaceMap[proci]
2714 label nBnd = domainMesh.nFaces()-domainMesh.nInternalFaces();
2715 flippedAddedFaces.
resize(nBnd/4);
2719 label domainFaceI = domainMesh.nInternalFaces();
2720 domainFaceI < domainMesh.nFaces();
2724 label newFaceI = map().addedFaceMap()[domainFaceI];
2727 label domainCellI = domainMesh.faceOwner()[domainFaceI];
2729 if (newCellI != map().addedCellMap()[domainCellI])
2731 flippedAddedFaces.
insert(domainFaceI);
2742 label domainFaceI = iter.key();
2743 label& val = constructFaceMap[sendProc][domainFaceI];
2746 inplaceRenumberWithFlip
2748 map().addedFaceMap(),
2751 constructFaceMap[sendProc]
2758 Pout<<
nl <<
"MERGED MESH FROM:" << sendProc <<
endl;
2760 printFieldInfo<volScalarField>(mesh_);
2761 printFieldInfo<volVectorField>(mesh_);
2762 printFieldInfo<volSphericalTensorField>(mesh_);
2763 printFieldInfo<volSymmTensorField>(mesh_);
2764 printFieldInfo<volTensorField>(mesh_);
2765 printFieldInfo<surfaceScalarField>(mesh_);
2766 printFieldInfo<surfaceVectorField>(mesh_);
2767 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2768 printFieldInfo<surfaceSymmTensorField>(mesh_);
2769 printFieldInfo<surfaceTensorField>(mesh_);
2770 printFieldInfo<pointScalarField>(mesh_);
2771 printFieldInfo<pointVectorField>(mesh_);
2772 printFieldInfo<pointSphericalTensorField>(mesh_);
2773 printFieldInfo<pointSymmTensorField>(mesh_);
2774 printFieldInfo<pointTensorField>(mesh_);
2787 printFieldInfo<volScalarField>(mesh_);
2788 printFieldInfo<volVectorField>(mesh_);
2789 printFieldInfo<volSphericalTensorField>(mesh_);
2790 printFieldInfo<volSymmTensorField>(mesh_);
2791 printFieldInfo<volTensorField>(mesh_);
2792 printFieldInfo<surfaceScalarField>(mesh_);
2793 printFieldInfo<surfaceVectorField>(mesh_);
2794 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2795 printFieldInfo<surfaceSymmTensorField>(mesh_);
2796 printFieldInfo<surfaceTensorField>(mesh_);
2797 printFieldInfo<pointScalarField>(mesh_);
2798 printFieldInfo<pointVectorField>(mesh_);
2799 printFieldInfo<pointSphericalTensorField>(mesh_);
2800 printFieldInfo<pointSymmTensorField>(mesh_);
2801 printFieldInfo<pointTensorField>(mesh_);
2808 mergeSharedPoints(sourcePointMaster, constructPointMap);
2820 addProcPatches(sourceNewNbrProc, sourcePatch, procPatchID);
2839 repatch(newPatchID, constructFaceMap);
2843 initPatchFields<volScalarField, processorFvPatchField<scalar>>
2847 initPatchFields<volVectorField, processorFvPatchField<vector>>
2859 initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor>>
2863 initPatchFields<volTensorField, processorFvPatchField<tensor>>
2877 printFieldInfo<volScalarField>(mesh_);
2878 printFieldInfo<volVectorField>(mesh_);
2879 printFieldInfo<volSphericalTensorField>(mesh_);
2880 printFieldInfo<volSymmTensorField>(mesh_);
2881 printFieldInfo<volTensorField>(mesh_);
2882 printFieldInfo<surfaceScalarField>(mesh_);
2883 printFieldInfo<surfaceVectorField>(mesh_);
2884 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2885 printFieldInfo<surfaceSymmTensorField>(mesh_);
2886 printFieldInfo<surfaceTensorField>(mesh_);
2887 printFieldInfo<pointScalarField>(mesh_);
2888 printFieldInfo<pointVectorField>(mesh_);
2889 printFieldInfo<pointSphericalTensorField>(mesh_);
2890 printFieldInfo<pointSymmTensorField>(mesh_);
2891 printFieldInfo<pointTensorField>(mesh_);
2905 move(oldPatchStarts),
2906 move(oldPatchNMeshPoints),
2913 move(constructPointMap),
2914 move(constructFaceMap),
2915 move(constructCellMap),
2916 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.
virtual transformType transform() const
Type of transform.
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.