64 referPatchIndex_(referPatchID),
65 referNbrPatchIndex_(referNbrPatchID)
71 if (nbrProc_[a] < nbrProc_[
b])
75 else if (nbrProc_[a] > nbrProc_[
b])
81 else if (referPatchIndex_[a] == -1)
85 else if (referPatchIndex_[
b] == -1)
95 return referPatchIndex_[a] < referPatchIndex_[
b];
99 return referNbrPatchIndex_[a] < referNbrPatchIndex_[
b];
109 void Foam::fvMeshDistribute::inplaceRenumberWithFlip
112 const bool oldToNewHasFlip,
113 const bool lstHasFlip,
117 if (!lstHasFlip && !oldToNewHasFlip)
128 label val = lst[elemI];
144 <<
"Problem : zero value " << val
145 <<
" at index " << elemI <<
" out of " << lst.size()
152 label newVal = oldToNew[val];
168 <<
"Problem : zero value " << newVal
169 <<
" at index " << elemI <<
" out of "
177 lst[elemI] =
sign*(newVal+1);
185 const bool selectEqual,
194 if (selectEqual == (values[i] == value))
205 if (selectEqual == (values[i] == value))
216 const word& typeName,
227 nFields += checkEqualWordList(typeName,
fieldNames);
234 Foam::label Foam::fvMeshDistribute::checkEqualWordList
236 const word& typeName,
247 if (allNames[proci] != allNames[0])
250 <<
"When checking for equal numbers of " << typeName
252 <<
"processor0 has:" << allNames[0] <<
nl
253 <<
"processor" << proci <<
" has:" << allNames[proci] <<
nl
254 << typeName <<
" need to be synchronised on all processors."
270 HashSet<word> mergedNames;
273 forAll(allNames[proci], i)
275 mergedNames.insert(allNames[proci][i]);
278 return mergedNames.toc();
284 Pout<<
"Primitives:" <<
nl
299 <<
" size:" << pp.
size()
300 <<
" start:" << pp.
start()
301 <<
" type:" << pp.type()
311 Pout<<
" " << zoneI <<
" name:" << pz.
name()
312 <<
" size:" << pz.
size()
322 Pout<<
" " << zoneI <<
" name:" << fz.
name()
323 <<
" size:" << fz.
size()
333 Pout<<
" " << zoneI <<
" name:" << cz.
name()
334 <<
" size:" << cz.
size()
351 <<
"Current coupling info:"
354 forAll(sourceFace, bFacei)
358 Pout<<
" meshFace:" << meshFacei
360 <<
" connects to proc:" << sourceProc[bFacei]
361 <<
"/face:" << sourceFace[bFacei]
362 <<
" which will move to proc:" << sourceNewNbrProc[bFacei]
368 Foam::label Foam::fvMeshDistribute::findInternalPatch()
const
372 label internalPatchi = -1;
378 if (isA<internalPolyPatch>(pp))
385 if (internalPatchi == -1)
388 <<
"Cannot find a internal patch in " <<
patches.names() <<
nl
390 <<
" An internal patch must be provided for the exposed "
396 Pout<<
"findInternalPatch : using patch " << internalPatchi
397 <<
" name:" <<
patches[internalPatchi].name()
398 <<
" type:" <<
patches[internalPatchi].type()
399 <<
" for the exposed internal faces." <<
endl;
404 label procPatchi = -1;
412 else if (procPatchi != -1)
415 <<
"Processor patches should be at end of patch list."
417 <<
"Have processor patch " << procPatchi
418 <<
" followed by non-processor patch " <<
patchi
419 <<
" in patches " <<
patches.names()
424 return internalPatchi;
427 Foam::label Foam::fvMeshDistribute::findNonEmptyPatch()
const
429 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
431 label nonEmptyPatchi = -1;
437 if (!isA<emptyPolyPatch>(pp) && !pp.coupled())
444 if (nonEmptyPatchi == -1)
447 <<
"Cannot find a non-empty patch in " <<
patches.names() <<
nl
449 <<
" An non-empty patch must be provided for the exposed "
455 Pout<<
"findNonEmptyPatch : using patch " << nonEmptyPatchi
456 <<
" name:" <<
patches[nonEmptyPatchi].name()
457 <<
" type:" <<
patches[nonEmptyPatchi].type()
458 <<
" for the exposed non-empty faces." <<
endl;
461 return nonEmptyPatchi;
467 const label destinationPatch
472 labelList newPatchID(mesh_.nFaces() - mesh_.nInternalFaces(), -1);
476 const polyPatch& pp = mesh_.boundaryMesh()[
patchi];
478 if (isA<processorPolyPatch>(pp))
482 Pout<<
"Moving all faces of patch " << pp.
name()
483 <<
" into patch " << destinationPatch
487 label offset = pp.start() - mesh_.nInternalFaces();
491 newPatchID[
offset+i] = destinationPatch;
500 autoPtr<polyTopoChangeMap> map = repatch(newPatchID, dummyFaceMaps);
510 if (!isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
512 oldToNew[
patchi] = newI++;
515 label nNonProcPatches = newI;
520 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
522 oldToNew[
patchi] = newI++;
538 polyTopoChange meshMod(mesh_);
540 forAll(newPatchID, bFacei)
542 if (newPatchID[bFacei] != -1)
544 const label facei = mesh_.nInternalFaces() + bFacei;
548 mesh_.faces()[facei],
550 mesh_.faceOwner()[facei],
563 PtrList<FieldField<surfaceMesh::PatchField, scalar>> sFields;
564 saveBoundaryFields<scalar, surfaceMesh>(sFields);
565 PtrList<FieldField<surfaceMesh::PatchField, vector>> vFields;
566 saveBoundaryFields<vector, surfaceMesh>(vFields);
567 PtrList<FieldField<surfaceMesh::PatchField, sphericalTensor>> sptFields;
568 saveBoundaryFields<sphericalTensor, surfaceMesh>(sptFields);
569 PtrList<FieldField<surfaceMesh::PatchField, symmTensor>> sytFields;
570 saveBoundaryFields<symmTensor, surfaceMesh>(sytFields);
571 PtrList<FieldField<surfaceMesh::PatchField, tensor>> tFields;
572 saveBoundaryFields<tensor, surfaceMesh>(tFields);
582 autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_,
true);
585 mesh_.topoChangeZones(map);
588 mesh_.mapFields(map);
592 mapBoundaryFields<scalar, surfaceMesh>(map, sFields);
593 mapBoundaryFields<vector, surfaceMesh>(map, vFields);
594 mapBoundaryFields<sphericalTensor, surfaceMesh>(map, sptFields);
595 mapBoundaryFields<symmTensor, surfaceMesh>(map, sytFields);
596 mapBoundaryFields<tensor, surfaceMesh>(map, tFields);
607 <<
"reverseFaceMap contains -1 at index:"
609 <<
"This means that the repatch operation was not just"
614 forAll(constructFaceMap, proci)
616 inplaceRenumberWithFlip
618 map().reverseFaceMap(),
621 constructFaceMap[proci]
640 forAll(pointToGlobalMaster, pointi)
642 if (pointToGlobalMaster[pointi] != -1)
648 Map<label> globalMasterToLocalMaster(2*nShared);
649 Map<label> pointToMaster(2*nShared);
651 forAll(pointToGlobalMaster, pointi)
653 label globali = pointToGlobalMaster[pointi];
661 if (iter == globalMasterToLocalMaster.end())
664 globalMasterToLocalMaster.insert(globali, pointi);
665 pointToMaster.insert(pointi, pointi);
669 pointToMaster.insert(pointi, iter());
674 if (
returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
676 return autoPtr<polyTopoChangeMap>(
nullptr);
680 polyTopoChange meshMod(mesh_);
683 forAll(mesh_.points(), pointi)
687 if (iter != pointToMaster.end())
689 if (iter() != pointi)
691 meshMod.removePoint(pointi, iter());
698 const faceList& faces = mesh_.faces();
702 const face&
f = faces[facei];
704 bool hasMerged =
false;
712 if (iter != pointToMaster.end())
714 if (iter() != pointi)
731 pointToMaster.find(pointi);
733 if (iter != pointToMaster.end())
739 label patchID = mesh_.boundaryMesh().whichPatch(facei);
740 label nei = (patchID == -1 ? mesh_.faceNeighbour()[facei] : -1);
746 mesh_.faceOwner()[facei],
757 autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_,
true);
760 mesh_.topoChangeZones(map);
763 mesh_.mapFields(map);
766 forAll(constructPointMap, proci)
768 labelList& constructMap = constructPointMap[proci];
772 label oldPointi = constructMap[i];
787 <<
"Problem. oldPointi:" << oldPointi
797 void Foam::fvMeshDistribute::getCouplingData
811 label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
812 sourceFace.setSize(nBnd);
813 sourceProc.setSize(nBnd);
814 sourcePatch.setSize(nBnd);
815 sourceNbrPatch.setSize(nBnd);
816 sourceNewNbrProc.setSize(nBnd);
818 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
830 label offset = pp.start() - mesh_.nInternalFaces();
836 nbrFaces[bndI] = pp.start()+i;
840 SubList<label>(nbrNewNbrProc, pp.size(),
offset) =
841 UIndirectList<label>(distribution, pp.faceCells())();
854 label offset = pp.start() - mesh_.nInternalFaces();
856 if (isA<processorPolyPatch>(pp))
858 const processorPolyPatch& procPatch =
859 refCast<const processorPolyPatch>(pp);
863 if (procPatch.owner())
869 sourceFace[bndI] = pp.start()+i;
871 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
880 sourceFace[bndI] = nbrFaces[bndI];
881 sourceProc[bndI] = procPatch.neighbProcNo();
882 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
888 if (isA<processorCyclicPolyPatch>(pp))
891 refCast<const processorCyclicPolyPatch>(pp)
902 sourcePatch[bndI] =
patchi;
903 sourceNbrPatch[bndI] = nbrPatchi;
906 else if (isA<cyclicPolyPatch>(pp))
908 const cyclicPolyPatch& cpp = refCast<const cyclicPolyPatch>(pp);
915 sourceFace[bndI] = pp.start()+i;
917 sourcePatch[bndI] =
patchi;
918 sourceNbrPatch[bndI] = cpp.nbrPatchIndex();
919 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
927 sourceFace[bndI] = nbrFaces[bndI];
929 sourcePatch[bndI] =
patchi;
930 sourceNbrPatch[bndI] = cpp.nbrPatchIndex();
931 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
941 sourceFace[bndI] = -1;
942 sourceProc[bndI] = -1;
943 sourcePatch[bndI] =
patchi;
944 sourceNbrPatch[bndI] = -1;
945 sourceNewNbrProc[bndI] = -1;
952 sourcePointMaster.setSize(mesh_.nPoints());
953 sourcePointMaster = -1;
956 const globalIndex globalPoints(mesh_.nPoints());
958 const globalMeshData& gmd = mesh_.globalData();
960 const labelList& meshPoints = cpp.meshPoints();
961 const distributionMap& slavesMap = gmd.globalCoPointSlavesMap();
964 labelList elems(slavesMap.constructSize(), -1);
965 forAll(meshPoints, pointi)
973 label globalPointi = globalPoints.toGlobal(meshPoints[pointi]);
974 elems[pointi] = globalPointi;
977 label sloti = slots[i];
978 if (sloti >= meshPoints.size())
982 elems[slots[i]] = globalPointi;
989 slavesMap.reverseDistribute(elems.size(), elems,
false);
992 forAll(meshPoints, pointi)
994 sourcePointMaster[meshPoints[pointi]] = elems[pointi];
1000 void Foam::fvMeshDistribute::subsetCouplingData
1010 const label oldInternalFaces,
1033 forAll(subFace, newBFacei)
1040 if (oldFacei < oldInternalFaces)
1042 subFace[newBFacei] = oldFacei;
1044 subPatch[newBFacei] = -1;
1046 label oldOwn = oldFaceOwner[oldFacei];
1047 label oldNei = oldFaceNeighbour[oldFacei];
1052 subNewNbrProc[newBFacei] = oldDistribution[oldNei];
1057 subNewNbrProc[newBFacei] = oldDistribution[oldOwn];
1063 label oldBFacei = oldFacei - oldInternalFaces;
1065 subFace[newBFacei] = sourceFace[oldBFacei];
1066 subProc[newBFacei] = sourceProc[oldBFacei];
1067 subPatch[newBFacei] = sourcePatch[oldBFacei];
1068 subNbrPatch[newBFacei] = sourceNbrPatch[oldBFacei];
1069 subNewNbrProc[newBFacei] = sourceNewNbrProc[oldBFacei];
1074 subPointMaster = UIndirectList<label>(sourcePointMaster, pointMap);
1078 void Foam::fvMeshDistribute::findCouples
1080 const primitiveMesh&
mesh,
1086 const primitiveMesh& domainMesh,
1097 HashTable<label, labelPair, labelPair::Hash<>> map(domainFace.size());
1099 forAll(domainProc, bFacei)
1101 if (domainProc[bFacei] != -1 && domainPatch[bFacei] == -1)
1105 labelPair(domainFace[bFacei], domainProc[bFacei]),
1114 masterCoupledFaces.setSize(domainFace.size());
1115 slaveCoupledFaces.setSize(domainFace.size());
1118 forAll(sourceFace, bFacei)
1120 if (sourceProc[bFacei] != -1 && sourcePatch[bFacei] == -1)
1122 labelPair myData(sourceFace[bFacei], sourceProc[bFacei]);
1124 HashTable<label, labelPair, labelPair::Hash<>>::const_iterator
1125 iter = map.find(myData);
1127 if (iter != map.end())
1129 label nbrBFacei = iter();
1132 slaveCoupledFaces[coupledI] =
1133 domainMesh.nInternalFaces()
1141 masterCoupledFaces.setSize(coupledI);
1142 slaveCoupledFaces.setSize(coupledI);
1146 Pout<<
"findCouples : found " << coupledI
1147 <<
" faces that will be stitched" <<
nl <<
endl;
1154 const primitiveMesh&
mesh,
1155 const mapAddedPolyMesh& map,
1157 const label nInternalFaces1,
1163 forAll(boundaryData0, oldBFacei)
1165 label newFacei = map.oldFaceMap()[oldBFacei + map.nOldInternalFaces()];
1171 boundaryData0[oldBFacei];
1175 forAll(boundaryData1, addedBFacei)
1177 label newFacei = map.addedFaceMap()[addedBFacei + nInternalFaces1];
1182 boundaryData1[addedBFacei];
1186 return newBoundaryData;
1192 const primitiveMesh&
mesh,
1193 const mapAddedPolyMesh& map,
1200 forAll(boundaryData0, oldPointi)
1207 newBoundaryData[
newPointi] = boundaryData0[oldPointi];
1211 forAll(boundaryData1, addedPointi)
1217 newBoundaryData[
newPointi] = boundaryData1[addedPointi];
1221 return newBoundaryData;
1228 const label oldInternalPatchi
1232 polyTopoChange meshMod(mesh_);
1236 removeCells cellRemover(mesh_,
false);
1239 labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemove));
1242 cellRemover.setRefinement
1246 labelList(exposedFaces.size(), oldInternalPatchi),
1253 PtrList<Field<scalar>> sFields;
1254 PtrList<Field<vector>> vFields;
1255 PtrList<Field<sphericalTensor>> sptFields;
1256 PtrList<Field<symmTensor>> sytFields;
1257 PtrList<Field<tensor>> tFields;
1258 initMapExposedFaces(sFields);
1259 initMapExposedFaces(vFields);
1260 initMapExposedFaces(sptFields);
1261 initMapExposedFaces(sytFields);
1262 initMapExposedFaces(tFields);
1266 autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_,
false);
1269 mesh_.topoChangeZones(map);
1272 mesh_.mapFields(map);
1277 mapExposedFaces(map(), sFields);
1278 mapExposedFaces(map(), vFields);
1279 mapExposedFaces(map(), sptFields);
1280 mapExposedFaces(map(), sytFields);
1281 mapExposedFaces(map(), tFields);
1287 void Foam::fvMeshDistribute::addProcPatches
1292 List<Map<label>>& procPatchID
1308 lessProcPatches(nbrProc, referPatchID, referNbrPatchID)
1315 label bFacei = indices[i];
1316 label proci = nbrProc[bFacei];
1320 if (!procPatchID[proci].
found(referPatchID[bFacei]))
1325 if (referPatchID[bFacei] == -1)
1329 processorPolyPatch pp
1333 mesh_.boundaryMesh().size(),
1334 mesh_.boundaryMesh(),
1339 procPatchID[proci].insert
1341 referPatchID[bFacei],
1347 const coupledPolyPatch& pcPatch =
1348 refCast<const coupledPolyPatch>
1350 mesh_.boundaryMesh()[referPatchID[bFacei]]
1353 processorCyclicPolyPatch pp
1357 mesh_.boundaryMesh().size(),
1358 mesh_.boundaryMesh(),
1364 procPatchID[proci].insert
1366 referPatchID[bFacei],
1376 void Foam::fvMeshDistribute::addNccProcPatches()
1378 forAll(mesh_.boundaryMesh(), nccPatchi)
1380 const polyPatch& pp = mesh_.boundaryMesh()[nccPatchi];
1382 if (!isA<nonConformalCyclicPolyPatch>(pp))
continue;
1384 const nonConformalCyclicPolyPatch& nccPp =
1385 refCast<const nonConformalCyclicPolyPatch>(pp);
1386 const polyPatch& origPp = nccPp.origPatch();
1388 const nonConformalCyclicPolyPatch& nbrNccPp = nccPp.nbrPatch();
1389 const polyPatch& nbrOrigPp = nbrNccPp.origPatch();
1391 if (!nccPp.owner())
continue;
1403 auto add = [&](
const bool owner,
const bool first)
1406 owner ? procHasOrig : procHasNbrOrig;
1408 owner ? procHasNbrOrig : procHasOrig;
1412 forAll(procHasPatchB, proci)
1420 && procHasPatchB[proci]
1426 nonConformalProcessorCyclicPolyPatch
1430 mesh_.boundaryMesh().size(),
1431 mesh_.boundaryMesh(),
1434 owner ? nccPp.name() : nbrNccPp.name(),
1435 owner ? origPp.name() : nbrOrigPp.name()
1455 const List<Map<label>>& procPatchID
1464 label origPatchi = referPatchID[bFacei];
1465 patchIDs[bFacei] = origPatchi;
1467 else if (nbrProc[bFacei] != -1)
1469 label origPatchi = referPatchID[bFacei];
1470 patchIDs[bFacei] = procPatchID[nbrProc[bFacei]][origPatchi];
1474 patchIDs[bFacei] = -1;
1481 void Foam::fvMeshDistribute::sendMesh
1501 Pout<<
"Sending to domain " << domain <<
nl
1511 CompactListList<label> zonePoints;
1515 labelList rowSizes(pointZoneNames.size(), 0);
1517 forAll(pointZoneNames, nameI)
1519 label myZoneID = pointZones.findIndex(pointZoneNames[nameI]);
1523 rowSizes[nameI] = pointZones[myZoneID].size();
1526 zonePoints.setSize(rowSizes);
1528 forAll(pointZoneNames, nameI)
1530 label myZoneID = pointZones.findIndex(pointZoneNames[nameI]);
1534 zonePoints[nameI].deepCopy(pointZones[myZoneID]);
1540 CompactListList<label> zoneFaces;
1542 CompactListList<bool> zoneFaceFlip;
1546 labelList rowSizes(faceZoneNames.size(), 0);
1548 forAll(faceZoneNames, nameI)
1550 label myZoneID = faceZones.findIndex(faceZoneNames[nameI]);
1554 rowSizes[nameI] = faceZones[myZoneID].size();
1558 zoneFaces.setSize(rowSizes);
1559 zoneOrientation.setSize(faceZoneNames.size(),
false);
1560 zoneFaceFlip.setSize(rowSizes);
1562 forAll(faceZoneNames, nameI)
1564 label myZoneID = faceZones.findIndex(faceZoneNames[nameI]);
1568 zoneFaces[nameI].deepCopy(faceZones[myZoneID]);
1570 if (faceZones[myZoneID].oriented())
1572 zoneOrientation[nameI] =
true;
1573 zoneFaceFlip[nameI].deepCopy(faceZones[myZoneID].flipMap());
1580 CompactListList<label> zoneCells;
1584 labelList rowSizes(cellZoneNames.size(), 0);
1586 forAll(cellZoneNames, nameI)
1588 label myZoneID = cellZones.findIndex(cellZoneNames[nameI]);
1592 rowSizes[nameI] = cellZones[myZoneID].size();
1596 zoneCells.setSize(rowSizes);
1598 forAll(cellZoneNames, nameI)
1600 label myZoneID = cellZones.findIndex(cellZoneNames[nameI]);
1604 zoneCells[nameI].deepCopy(cellZones[myZoneID]);
1642 << sourcePointMaster;
1647 Pout<<
"Started sending mesh to domain " << domain
1659 const Time& runTime,
1670 faceList domainFaces = CompactListList<label>(fromNbr).list<
face>();
1673 PtrList<entry> patchEntries(fromNbr);
1675 CompactListList<label> zonePoints(fromNbr);
1676 CompactListList<label> zoneFaces(fromNbr);
1678 CompactListList<bool> zoneFaceFlip(fromNbr);
1679 CompactListList<label> zoneCells(fromNbr);
1684 >> domainSourcePatch
1685 >> domainSourceNbrPatch
1686 >> domainSourceNewNbrProc
1687 >> domainSourcePointMaster;
1690 autoPtr<fvMesh> domainMeshPtr
1703 move(domainAllOwner),
1704 move(domainAllNeighbour),
1708 fvMesh& domainMesh = domainMeshPtr();
1710 List<polyPatch*>
patches(patchEntries.size());
1716 patchEntries[
patchi].keyword(),
1719 domainMesh.boundaryMesh()
1723 domainMesh.addFvPatches(
patches,
false);
1726 List<pointZone*> pZonePtrs(pointZoneNames.size());
1729 pZonePtrs[i] =
new pointZone
1733 domainMesh.pointZones()
1737 List<faceZone*> fZonePtrs(faceZoneNames.size());
1740 if (zoneOrientation[i])
1742 fZonePtrs[i] =
new faceZone
1747 domainMesh.faceZones()
1752 fZonePtrs[i] =
new faceZone
1756 domainMesh.faceZones()
1761 List<cellZone*> cZonePtrs(cellZoneNames.size());
1764 cZonePtrs[i] =
new cellZone
1768 domainMesh.cellZones()
1771 domainMesh.addZones(pZonePtrs, fZonePtrs, cZonePtrs);
1773 return domainMeshPtr;
1802 <<
"At index " << celli <<
" distribution:" << newProc
1820 <<
"Size of distribution:"
1821 <<
distribution.size() <<
" mesh nCells:" << mesh_.nCells()
1829 if (
patches.checkParallelSync(
true))
1832 <<
"This application requires all non-processor patches"
1833 <<
" to be present in the same order on all patches" <<
nl
1834 <<
"followed by the processor patches (which of course are unique)."
1836 <<
"Local patches:" << mesh_.boundaryMesh().names()
1841 const label nOldPoints(mesh_.nPoints());
1842 const label nOldFaces(mesh_.nFaces());
1843 const label nOldCells(mesh_.nCells());
1866 move(oldPatchStarts),
1867 move(oldPatchNMeshPoints),
1884 const wordList pointZoneNames(mergeWordList(mesh_.pointZones().toc()));
1885 const wordList faceZoneNames(mergeWordList(mesh_.faceZones().toc()));
1886 const wordList cellZoneNames(mergeWordList(mesh_.cellZones().toc()));
1948 mesh_.resetMotion();
1955 fieldNames(volScalarField::typeName, nFields)
1959 fieldNames(volVectorField::typeName, nFields)
1963 fieldNames(volSphericalTensorField::typeName, nFields)
1967 volSymmTensorField::typeName, nFields)
1971 fieldNames(volTensorField::typeName, nFields)
1976 fieldNames(surfaceScalarField::typeName, nFields)
1980 fieldNames(surfaceVectorField::typeName, nFields)
1984 fieldNames(surfaceSphericalTensorField::typeName, nFields)
1988 fieldNames(surfaceSymmTensorField::typeName, nFields)
1992 fieldNames(surfaceTensorField::typeName, nFields)
1997 fieldNames(pointScalarField::typeName, nFields)
2001 fieldNames(pointVectorField::typeName, nFields)
2005 fieldNames(pointSphericalTensorField::typeName, nFields)
2009 fieldNames(pointSymmTensorField::typeName, nFields)
2013 fieldNames(pointTensorField::typeName, nFields)
2018 fieldNames(volScalarField::Internal::typeName, nFields)
2022 fieldNames(volVectorField::Internal::typeName, nFields)
2026 fieldNames(volSphericalTensorField::Internal::typeName, nFields)
2030 fieldNames(volSymmTensorField::Internal::typeName, nFields)
2034 fieldNames(volTensorField::Internal::typeName, nFields)
2040 const label oldInternalPatchi =
2042 ? findInternalPatch()
2043 : findNonEmptyPatch();
2050 deleteProcPatches(oldInternalPatchi);
2053 repatchFaceMap = repatchMap().faceMap();
2060 repatchMap().reverseFaceMap(),
2061 mesh_.nFaces() - mesh_.nInternalFaces(),
2062 mesh_.nInternalFaces()
2064 - mesh_.nInternalFaces()
2078 Pout<<
nl <<
"MESH WITH PROC PATCHES DELETED:" <<
endl;
2079 printMeshInfo(mesh_);
2080 printFieldInfo<volScalarField>(mesh_);
2081 printFieldInfo<volVectorField>(mesh_);
2082 printFieldInfo<volSphericalTensorField>(mesh_);
2083 printFieldInfo<volSymmTensorField>(mesh_);
2084 printFieldInfo<volTensorField>(mesh_);
2085 printFieldInfo<surfaceScalarField>(mesh_);
2086 printFieldInfo<surfaceVectorField>(mesh_);
2087 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2088 printFieldInfo<surfaceSymmTensorField>(mesh_);
2089 printFieldInfo<surfaceTensorField>(mesh_);
2090 printFieldInfo<pointScalarField>(mesh_);
2091 printFieldInfo<pointVectorField>(mesh_);
2092 printFieldInfo<pointSphericalTensorField>(mesh_);
2093 printFieldInfo<pointSymmTensorField>(mesh_);
2094 printFieldInfo<pointTensorField>(mesh_);
2146 <<
"SUBSETTING FOR DOMAIN " << recvProc
2147 <<
" cells to send:"
2168 subCellMap[recvProc] = subsetter.
cellMap();
2170 inplaceRenumberWithFlip
2175 subFaceMap[recvProc]
2177 subPointMap[recvProc] = subsetter.
pointMap();
2178 subPatchMap[recvProc] = subsetter.
patchMap();
2198 mesh_.faceNeighbour(),
2199 mesh_.nInternalFaces(),
2212 procSourceNewNbrProc,
2213 procSourcePointMaster
2231 procSourceNewNbrProc,
2232 procSourcePointMaster,
2238 sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
2239 sendFields<volVectorField>(recvProc, volVectors, subsetter, str);
2240 sendFields<volSphericalTensorField>
2247 sendFields<volSymmTensorField>
2254 sendFields<volTensorField>(recvProc, volTensors, subsetter, str);
2257 sendFields<surfaceScalarField>
2264 sendFields<surfaceVectorField>
2271 sendFields<surfaceSphericalTensorField>
2278 sendFields<surfaceSymmTensorField>
2285 sendFields<surfaceTensorField>
2294 sendFields<pointScalarField>
2301 sendFields<pointVectorField>
2308 sendFields<pointSphericalTensorField>
2315 sendFields<pointSymmTensorField>
2322 sendFields<pointTensorField>
2331 sendFields<volScalarField::Internal>
2338 sendFields<volVectorField::Internal>
2345 sendFields<volSphericalTensorField::Internal>
2352 sendFields<volSymmTensorField::Internal>
2359 sendFields<volTensorField::Internal>
2382 const labelList oldFaceOwner(mesh_.faceOwner());
2383 const labelList oldFaceNeighbour(mesh_.faceNeighbour());
2384 const label oldInternalFaces = mesh_.nInternalFaces();
2412 label facei = iter.key();
2436 subMap().pointMap(),
2455 domainSourceNbrPatch,
2456 domainSourceNewNbrProc,
2457 domainSourcePointMaster
2460 sourceFace.
transfer(domainSourceFace);
2461 sourceProc.
transfer(domainSourceProc);
2462 sourcePatch.
transfer(domainSourcePatch);
2463 sourceNbrPatch.
transfer(domainSourceNbrPatch);
2464 sourceNewNbrProc.
transfer(domainSourceNewNbrProc);
2465 sourcePointMaster.
transfer(domainSourcePointMaster);
2473 printMeshInfo(mesh_);
2474 printFieldInfo<volScalarField>(mesh_);
2475 printFieldInfo<volVectorField>(mesh_);
2476 printFieldInfo<volSphericalTensorField>(mesh_);
2477 printFieldInfo<volSymmTensorField>(mesh_);
2478 printFieldInfo<volTensorField>(mesh_);
2479 printFieldInfo<surfaceScalarField>(mesh_);
2480 printFieldInfo<surfaceVectorField>(mesh_);
2481 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2482 printFieldInfo<surfaceSymmTensorField>(mesh_);
2483 printFieldInfo<surfaceTensorField>(mesh_);
2484 printFieldInfo<pointScalarField>(mesh_);
2485 printFieldInfo<pointVectorField>(mesh_);
2486 printFieldInfo<pointSphericalTensorField>(mesh_);
2487 printFieldInfo<pointSymmTensorField>(mesh_);
2488 printFieldInfo<pointTensorField>(mesh_);
2500 forAll(nSendCells, sendProc)
2512 <<
"RECEIVING FROM DOMAIN " << sendProc
2513 <<
" cells to receive:"
2560 domainMeshPtr = receiveMesh
2567 const_cast<Time&
>(mesh_.time()),
2571 domainSourceNbrPatch,
2572 domainSourceNewNbrProc,
2573 domainSourcePointMaster,
2576 fvMesh& domainMesh = domainMeshPtr();
2586 receiveFields<volScalarField>
2592 fieldDicts.
subDict(volScalarField::typeName)
2594 receiveFields<volVectorField>
2600 fieldDicts.
subDict(volVectorField::typeName)
2602 receiveFields<volSphericalTensorField>
2608 fieldDicts.
subDict(volSphericalTensorField::typeName)
2610 receiveFields<volSymmTensorField>
2616 fieldDicts.
subDict(volSymmTensorField::typeName)
2618 receiveFields<volTensorField>
2624 fieldDicts.
subDict(volTensorField::typeName)
2628 receiveFields<surfaceScalarField>
2634 fieldDicts.
subDict(surfaceScalarField::typeName)
2636 receiveFields<surfaceVectorField>
2642 fieldDicts.
subDict(surfaceVectorField::typeName)
2644 receiveFields<surfaceSphericalTensorField>
2650 fieldDicts.
subDict(surfaceSphericalTensorField::typeName)
2652 receiveFields<surfaceSymmTensorField>
2658 fieldDicts.
subDict(surfaceSymmTensorField::typeName)
2660 receiveFields<surfaceTensorField>
2666 fieldDicts.
subDict(surfaceTensorField::typeName)
2672 receiveFields<pointScalarField>
2678 fieldDicts.
subDict(pointScalarField::typeName)
2680 receiveFields<pointVectorField>
2686 fieldDicts.
subDict(pointVectorField::typeName)
2688 receiveFields<pointSphericalTensorField>
2694 fieldDicts.
subDict(pointSphericalTensorField::typeName)
2696 receiveFields<pointSymmTensorField>
2702 fieldDicts.
subDict(pointSymmTensorField::typeName)
2704 receiveFields<pointTensorField>
2710 fieldDicts.
subDict(pointTensorField::typeName)
2714 receiveFields<volScalarField::Internal>
2722 volScalarField::Internal::typeName
2725 receiveFields<volVectorField::Internal>
2733 volVectorField::Internal::typeName
2736 receiveFields<volSphericalTensorField::Internal>
2748 receiveFields<volSymmTensorField::Internal>
2756 volSymmTensorField::Internal::typeName
2759 receiveFields<volTensorField::Internal>
2767 volTensorField::Internal::typeName
2771 const fvMesh& domainMesh = domainMeshPtr();
2777 constructPatchMap[sendProc] =
2784 Pout<<
nl <<
"RECEIVED MESH FROM:" << sendProc <<
endl;
2785 printMeshInfo(domainMesh);
2786 printFieldInfo<volScalarField>(domainMesh);
2787 printFieldInfo<volVectorField>(domainMesh);
2788 printFieldInfo<volSphericalTensorField>(domainMesh);
2789 printFieldInfo<volSymmTensorField>(domainMesh);
2790 printFieldInfo<volTensorField>(domainMesh);
2791 printFieldInfo<surfaceScalarField>(domainMesh);
2792 printFieldInfo<surfaceVectorField>(domainMesh);
2793 printFieldInfo<surfaceSphericalTensorField>(domainMesh);
2794 printFieldInfo<surfaceSymmTensorField>(domainMesh);
2795 printFieldInfo<surfaceTensorField>(domainMesh);
2796 printFieldInfo<pointScalarField>(domainMesh);
2797 printFieldInfo<pointVectorField>(domainMesh);
2798 printFieldInfo<pointSphericalTensorField>(domainMesh);
2799 printFieldInfo<pointSymmTensorField>(domainMesh);
2800 printFieldInfo<pointTensorField>(domainMesh);
2854 sourceFace = mapBoundaryData
2862 sourceProc = mapBoundaryData
2870 sourcePatch = mapBoundaryData
2878 sourceNbrPatch = mapBoundaryData
2884 domainSourceNbrPatch
2886 sourceNewNbrProc = mapBoundaryData
2892 domainSourceNewNbrProc
2895 sourcePointMaster = mapPointData
2900 domainSourcePointMaster
2906 const labelList& oldCellMap = map().oldCellMap();
2907 const labelList& oldFaceMap = map().oldFaceMap();
2908 const labelList& oldPointMap = map().oldPointMap();
2909 const labelList& oldPatchMap = map().oldPatchMap();
2912 forAll(constructPatchMap, proci)
2914 if (proci != sendProc && constructPatchMap[proci].size())
2918 inplaceRenumberWithFlip
2923 constructFaceMap[proci]
2936 flippedAddedFaces.
resize(nBnd/4);
2941 domainFacei < domainMesh.
nFaces();
2945 label newFacei = map().addedFaceMap()[domainFacei];
2946 label newCellI = mesh_.faceOwner()[newFacei];
2950 if (newCellI != map().addedCellMap()[domainCellI])
2952 flippedAddedFaces.
insert(domainFacei);
2963 label domainFacei = iter.key();
2964 label& val = constructFaceMap[sendProc][domainFacei];
2967 inplaceRenumberWithFlip
2969 map().addedFaceMap(),
2972 constructFaceMap[sendProc]
2980 Pout<<
nl <<
"MERGED MESH FROM:" << sendProc <<
endl;
2981 printMeshInfo(mesh_);
2982 printFieldInfo<volScalarField>(mesh_);
2983 printFieldInfo<volVectorField>(mesh_);
2984 printFieldInfo<volSphericalTensorField>(mesh_);
2985 printFieldInfo<volSymmTensorField>(mesh_);
2986 printFieldInfo<volTensorField>(mesh_);
2987 printFieldInfo<surfaceScalarField>(mesh_);
2988 printFieldInfo<surfaceVectorField>(mesh_);
2989 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2990 printFieldInfo<surfaceSymmTensorField>(mesh_);
2991 printFieldInfo<surfaceTensorField>(mesh_);
2992 printFieldInfo<pointScalarField>(mesh_);
2993 printFieldInfo<pointVectorField>(mesh_);
2994 printFieldInfo<pointSphericalTensorField>(mesh_);
2995 printFieldInfo<pointSymmTensorField>(mesh_);
2996 printFieldInfo<pointTensorField>(mesh_);
3008 printMeshInfo(mesh_);
3009 printFieldInfo<volScalarField>(mesh_);
3010 printFieldInfo<volVectorField>(mesh_);
3011 printFieldInfo<volSphericalTensorField>(mesh_);
3012 printFieldInfo<volSymmTensorField>(mesh_);
3013 printFieldInfo<volTensorField>(mesh_);
3014 printFieldInfo<surfaceScalarField>(mesh_);
3015 printFieldInfo<surfaceVectorField>(mesh_);
3016 printFieldInfo<surfaceSphericalTensorField>(mesh_);
3017 printFieldInfo<surfaceSymmTensorField>(mesh_);
3018 printFieldInfo<surfaceTensorField>(mesh_);
3019 printFieldInfo<pointScalarField>(mesh_);
3020 printFieldInfo<pointVectorField>(mesh_);
3021 printFieldInfo<pointSphericalTensorField>(mesh_);
3022 printFieldInfo<pointSymmTensorField>(mesh_);
3023 printFieldInfo<pointTensorField>(mesh_);
3030 mergeSharedPoints(sourcePointMaster, constructPointMap);
3042 addProcPatches(sourceNewNbrProc, sourcePatch, sourceNbrPatch, procPatchID);
3061 repatch(newPatchID, constructFaceMap);
3066 addNccProcPatches();
3069 correctCoupledPatchFields<volScalarField>();
3070 correctCoupledPatchFields<volVectorField>();
3071 correctCoupledPatchFields<volSphericalTensorField>();
3072 correctCoupledPatchFields<volSymmTensorField>();
3073 correctCoupledPatchFields<volTensorField>();
3075 mesh_.setInstance(mesh_.time().name());
3082 printMeshInfo(mesh_);
3083 printFieldInfo<volScalarField>(mesh_);
3084 printFieldInfo<volVectorField>(mesh_);
3085 printFieldInfo<volSphericalTensorField>(mesh_);
3086 printFieldInfo<volSymmTensorField>(mesh_);
3087 printFieldInfo<volTensorField>(mesh_);
3088 printFieldInfo<surfaceScalarField>(mesh_);
3089 printFieldInfo<surfaceVectorField>(mesh_);
3090 printFieldInfo<surfaceSphericalTensorField>(mesh_);
3091 printFieldInfo<surfaceSymmTensorField>(mesh_);
3092 printFieldInfo<surfaceTensorField>(mesh_);
3093 printFieldInfo<pointScalarField>(mesh_);
3094 printFieldInfo<pointVectorField>(mesh_);
3095 printFieldInfo<pointSphericalTensorField>(mesh_);
3096 printFieldInfo<pointSymmTensorField>(mesh_);
3097 printFieldInfo<pointTensorField>(mesh_);
3111 move(oldPatchStarts),
3112 move(oldPatchNMeshPoints),
3119 move(constructPointMap),
3120 move(constructFaceMap),
3121 move(constructCellMap),
3122 move(constructPatchMap),
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
bool insert(const Key &key)
Insert a new entry.
friend class const_iterator
Declare friendship with the const_iterator.
void resize(const label newSize)
Resize the hash table for efficiency.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual const fileName & name() const
Return the name of the stream.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A List obtained as a section of another List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Input inter-processor communications stream operating on external buffer.
label size() const
Return the number of elements in the UList.
Output inter-processor communications stream operating on external buffer.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label size() const
Return the number of elements in the UPtrList.
const word & name() const
Return name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A bounding box defined in terms of the points at its extremities.
Named list of cell indices representing a sub-set of the mesh.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Base class for statistical distributions.
Container for information needed to couple to meshes. When constructed from two meshes and a list of ...
Named list of face indices representing a sub-set of the mesh faces.
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.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
static void printCoupleInfo(const primitiveMesh &, const labelList &, const labelList &, const labelList &, const labelList &)
Print some info on coupling data.
fvMeshDistribute(fvMesh &mesh)
Construct from mesh.
autoPtr< polyDistributionMap > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
static void printMeshInfo(const fvMesh &)
Print some info on mesh.
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells,...
const labelList & faceMap() const
Return face map.
const labelList & cellMap() const
Return cell map.
const labelList & faceFlipMap() const
Return face map with sign to encode flipped faces.
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 fvMesh & subMesh() const
Return reference to subset mesh.
const labelList & patchMap() const
Return patch map.
const labelList & pointMap() const
Return point map.
Mesh data needed to do the Finite Volume discretisation.
static const HashSet< word > curGeometryFields
Set of names of registered current-time geometric fields.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Less function class that can be used for sorting processor patches.
lessProcPatches(const labelList &nbrProc, const labelList &referPatchID, const labelList &referNbrPatchID)
bool operator()(const label a, const label b)
const word & name() const
Return name.
Mesh representing a set of points created from polyMesh.
Named list of point indices representing a sub-set of the mesh faces.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const pointZoneList & pointZones() const
Return point zones.
const cellZoneList & cellZones() const
Return cell zones.
static word defaultRegion
Return the default region name.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const faceZoneList & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
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.
label start() const
Return start label of this patch in the polyMesh face list.
Cell-face mesh analysis engine.
const vectorField & faceCentres() const
label nInternalFaces() const
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static List< word > fieldNames
const fvPatchList & patches
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
Pair< label > labelPair
Label pair.
List< label > labelList
A List of labels.
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
labelList first(const UList< labelPair > &p)
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
void add(LagrangianPatchField< typename typeOfSum< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void offset(label &lst, const label o)
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
UList< label > labelUList
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.