71 referPatchID_(referPatchID),
72 referNbrPatchID_(referNbrPatchID)
78 if (nbrProc_[a] < nbrProc_[b])
82 else if (nbrProc_[a] > nbrProc_[b])
88 else if (referPatchID_[a] == -1)
92 else if (referPatchID_[b] == -1)
102 return referPatchID_[a] < referPatchID_[
b];
106 return referNbrPatchID_[a] < referNbrPatchID_[
b];
116 void Foam::fvMeshDistribute::inplaceRenumberWithFlip
119 const bool oldToNewHasFlip,
120 const bool lstHasFlip,
124 if (!lstHasFlip && !oldToNewHasFlip)
135 label val = lst[elemI];
151 <<
"Problem : zero value " << val
152 <<
" at index " << elemI <<
" out of " << lst.
size()
159 label newVal = oldToNew[val];
175 <<
"Problem : zero value " << newVal
176 <<
" at index " << elemI <<
" out of " 184 lst[elemI] = sign*(newVal+1);
192 const bool selectEqual,
201 if (selectEqual == (values[i] == value))
212 if (selectEqual == (values[i] == value))
222 void Foam::fvMeshDistribute::checkEqualWordList
235 if (allNames[proci] != allNames[0])
238 <<
"When checking for equal " << msg.c_str() <<
" :" <<
endl 239 <<
"processor0 has:" << allNames[0] <<
endl 240 <<
"processor" << proci <<
" has:" << allNames[proci] <<
endl 241 << msg.c_str() <<
" need to be synchronised on all processors." 258 forAll(allNames[proci], i)
260 mergedNames.
insert(allNames[proci][i]);
263 return mergedNames.
toc();
270 Pout<<
"Primitives:" <<
nl 274 <<
" faces :" << mesh.
nFaces() <<
nl 275 <<
" cells :" << mesh.
nCells() <<
nl;
285 <<
" size:" << pp.size()
286 <<
" start:" << pp.
start()
287 <<
" type:" << pp.type()
297 Pout<<
" " << zoneI <<
" name:" << pz.
name()
298 <<
" size:" << pz.
size()
308 Pout<<
" " << zoneI <<
" name:" << fz.
name()
309 <<
" size:" << fz.
size()
319 Pout<<
" " << zoneI <<
" name:" << cz.
name()
320 <<
" size:" << cz.
size()
337 <<
"Current coupling info:" 340 forAll(sourceFace, bFacei)
344 Pout<<
" meshFace:" << meshFacei
346 <<
" connects to proc:" << sourceProc[bFacei]
347 <<
"/face:" << sourceFace[bFacei]
348 <<
" which will move to proc:" << sourceNewNbrProc[bFacei]
355 Foam::label Foam::fvMeshDistribute::findInternalPatch()
const 359 label internalPatchi = -1;
365 if (isA<internalPolyPatch>(pp))
372 if (internalPatchi != -1)
374 return internalPatchi;
377 label nonEmptyPatchi = -1;
383 if (!isA<emptyPolyPatch>(pp) && !pp.
coupled())
390 if (nonEmptyPatchi == -1)
393 <<
"Cannot find a patch which is neither of type empty nor" 394 <<
" coupled in patches " << patches.
names() <<
endl 395 <<
"There has to be at least one such patch for" 401 Pout<<
"findInternalPatch : using patch " << nonEmptyPatchi
402 <<
" name:" << patches[nonEmptyPatchi].
name()
403 <<
" type:" << patches[nonEmptyPatchi].type()
404 <<
" to put exposed faces into." <<
endl;
410 label procPatchi = -1;
414 if (isA<processorPolyPatch>(patches[
patchi]))
418 else if (procPatchi != -1)
421 <<
"Processor patches should be at end of patch list." 423 <<
"Have processor patch " << procPatchi
424 <<
" followed by non-processor patch " << patchi
425 <<
" in patches " << patches.
names()
430 return nonEmptyPatchi;
438 const label destinationPatch
443 labelList newPatchID(mesh_.nFaces() - mesh_.nInternalFaces(), -1);
445 label nProcPatches = 0;
451 if (isA<processorPolyPatch>(pp))
455 Pout<<
"Moving all faces of patch " << pp.
name()
456 <<
" into patch " << destinationPatch
460 label offset = pp.
start() - mesh_.nInternalFaces();
464 newPatchID[offset+i] = destinationPatch;
485 if (!isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
487 oldToNew[
patchi] = newI++;
490 label nNonProcPatches = newI;
495 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
497 oldToNew[
patchi] = newI++;
516 forAll(newPatchID, bFacei)
518 if (newPatchID[bFacei] != -1)
520 label facei = mesh_.nInternalFaces() + bFacei;
522 label zoneID = mesh_.faceZones().whichZone(facei);
523 bool zoneFlip =
false;
527 const faceZone& fZone = mesh_.faceZones()[zoneID];
535 mesh_.faces()[facei],
537 mesh_.faceOwner()[facei],
555 saveBoundaryFields<scalar, surfaceMesh>(sFlds);
557 saveBoundaryFields<vector, surfaceMesh>(vFlds);
559 saveBoundaryFields<sphericalTensor, surfaceMesh>(sptFlds);
561 saveBoundaryFields<symmTensor, surfaceMesh>(sytFlds);
563 saveBoundaryFields<tensor, surfaceMesh>(tFlds);
575 mesh_.updateMesh(map);
579 mapBoundaryFields<scalar, surfaceMesh>(map, sFlds);
580 mapBoundaryFields<vector, surfaceMesh>(map, vFlds);
581 mapBoundaryFields<sphericalTensor, surfaceMesh>(map, sptFlds);
582 mapBoundaryFields<symmTensor, surfaceMesh>(map, sytFlds);
583 mapBoundaryFields<tensor, surfaceMesh>(map, tFlds);
587 if (map().hasMotionPoints())
589 mesh_.movePoints(map().preMotionPoints());
601 <<
"reverseFaceMap contains -1 at index:" 603 <<
"This means that the repatch operation was not just" 608 forAll(constructFaceMap, proci)
610 inplaceRenumberWithFlip
612 map().reverseFaceMap(),
615 constructFaceMap[proci]
639 forAll(pointToGlobalMaster, pointi)
641 if (pointToGlobalMaster[pointi] != -1)
647 Map<label> globalMasterToLocalMaster(2*nShared);
650 forAll(pointToGlobalMaster, pointi)
652 label globali = pointToGlobalMaster[pointi];
660 if (iter == globalMasterToLocalMaster.
end())
663 globalMasterToLocalMaster.
insert(globali, pointi);
664 pointToMaster.
insert(pointi, pointi);
668 pointToMaster.
insert(pointi, iter());
682 forAll(mesh_.points(), pointi)
686 if (iter != pointToMaster.
end())
688 if (iter() != pointi)
690 meshMod.removePoint(pointi, iter());
697 const faceList& faces = mesh_.faces();
701 const face&
f = faces[facei];
703 bool hasMerged =
false;
707 label pointi = f[fp];
711 if (iter != pointToMaster.
end())
713 if (iter() != pointi)
727 label pointi = f[fp];
730 pointToMaster.
find(pointi);
732 if (iter != pointToMaster.
end())
738 label patchID = mesh_.boundaryMesh().whichPatch(facei);
739 label nei = (patchID == -1 ? mesh_.faceNeighbour()[facei] : -1);
740 label zoneID = mesh_.faceZones().whichZone(facei);
741 bool zoneFlip =
false;
745 const faceZone& fZone = mesh_.faceZones()[zoneID];
755 mesh_.faceOwner()[facei],
772 mesh_.updateMesh(map);
775 forAll(constructPointMap, proci)
777 labelList& constructMap = constructPointMap[proci];
781 label oldPointi = constructMap[i];
787 constructMap[i] = -newPointi-2;
789 else if (newPointi >= 0)
796 <<
"Problem. oldPointi:" << oldPointi
805 void Foam::fvMeshDistribute::getCouplingData
819 label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
824 sourceNewNbrProc.
setSize(nBnd);
838 label offset = pp.
start() - mesh_.nInternalFaces();
843 label bndI = offset + i;
844 nbrFaces[bndI] = pp.
start()+i;
862 label offset = pp.
start() - mesh_.nInternalFaces();
864 if (isA<processorPolyPatch>(pp))
867 refCast<const processorPolyPatch>(pp);
871 if (procPatch.
owner())
876 label bndI = offset + i;
877 sourceFace[bndI] = pp.
start()+i;
879 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
887 label bndI = offset + i;
888 sourceFace[bndI] = nbrFaces[bndI];
890 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
896 if (isA<processorCyclicPolyPatch>(pp))
899 refCast<const processorCyclicPolyPatch>(pp)
902 refCast<const cyclicPolyPatch>(patches[
patchi])
909 label bndI = offset + i;
910 sourcePatch[bndI] =
patchi;
911 sourceNbrPatch[bndI] = nbrPatchi;
914 else if (isA<cyclicPolyPatch>(pp))
922 label bndI = offset + i;
923 sourceFace[bndI] = pp.
start()+i;
925 sourcePatch[bndI] =
patchi;
927 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
934 label bndI = offset + i;
935 sourceFace[bndI] = nbrFaces[bndI];
937 sourcePatch[bndI] =
patchi;
939 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
948 label bndI = offset + i;
949 sourceFace[bndI] = -1;
950 sourceProc[bndI] = -1;
951 sourcePatch[bndI] =
patchi;
952 sourceNbrPatch[bndI] = -1;
953 sourceNewNbrProc[bndI] = -1;
960 sourcePointMaster.
setSize(mesh_.nPoints());
961 sourcePointMaster = -1;
969 const mapDistribute& slavesMap = gmd.globalCoPointSlavesMap();
973 forAll(meshPoints, pointi)
982 elems[pointi] = globalPointi;
985 label sloti = slots[i];
986 if (sloti >= meshPoints.
size())
990 elems[slots[i]] = globalPointi;
1000 forAll(meshPoints, pointi)
1002 sourcePointMaster[meshPoints[pointi]] = elems[pointi];
1009 void Foam::fvMeshDistribute::subsetCouplingData
1019 const label oldInternalFaces,
1042 forAll(subFace, newBFacei)
1046 label oldFacei = faceMap[newFacei];
1049 if (oldFacei < oldInternalFaces)
1051 subFace[newBFacei] = oldFacei;
1053 subPatch[newBFacei] = -1;
1055 label oldOwn = oldFaceOwner[oldFacei];
1056 label oldNei = oldFaceNeighbour[oldFacei];
1058 if (oldOwn == cellMap[mesh.
faceOwner()[newFacei]])
1061 subNewNbrProc[newBFacei] = oldDistribution[oldNei];
1066 subNewNbrProc[newBFacei] = oldDistribution[oldOwn];
1072 label oldBFacei = oldFacei - oldInternalFaces;
1074 subFace[newBFacei] = sourceFace[oldBFacei];
1075 subProc[newBFacei] = sourceProc[oldBFacei];
1076 subPatch[newBFacei] = sourcePatch[oldBFacei];
1077 subNbrPatch[newBFacei] = sourceNbrPatch[oldBFacei];
1078 subNewNbrProc[newBFacei] = sourceNewNbrProc[oldBFacei];
1089 void Foam::fvMeshDistribute::findCouples
1110 forAll(domainProc, bFacei)
1112 if (domainProc[bFacei] != -1 && domainPatch[bFacei] == -1)
1116 labelPair(domainFace[bFacei], domainProc[bFacei]),
1129 forAll(sourceFace, bFacei)
1131 if (sourceProc[bFacei] != -1 && sourcePatch[bFacei] == -1)
1133 labelPair myData(sourceFace[bFacei], sourceProc[bFacei]);
1136 iter = map.find(myData);
1138 if (iter != map.end())
1140 label nbrBFacei = iter();
1143 slaveCoupledFaces[coupledI] =
1152 masterCoupledFaces.
setSize(coupledI);
1153 slaveCoupledFaces.
setSize(coupledI);
1157 Pout<<
"findCouples : found " << coupledI
1158 <<
" faces that will be stitched" <<
nl <<
endl;
1169 const label nInternalFaces1,
1175 forAll(boundaryData0, oldBFacei)
1183 boundaryData0[oldBFacei];
1187 forAll(boundaryData1, addedBFacei)
1194 boundaryData1[addedBFacei];
1198 return newBoundaryData;
1212 forAll(boundaryData0, oldPointi)
1219 newBoundaryData[
newPointi] = boundaryData0[oldPointi];
1223 forAll(boundaryData1, addedPointi)
1229 newBoundaryData[
newPointi] = boundaryData1[addedPointi];
1233 return newBoundaryData;
1241 const label oldInternalPatchi
1259 labelList(exposedFaces.size(), oldInternalPatchi),
1271 saveInternalFields(sFlds);
1273 saveInternalFields(vFlds);
1275 saveInternalFields(sptFlds);
1277 saveInternalFields(sytFlds);
1279 saveInternalFields(tFlds);
1285 mesh_.updateMesh(map);
1292 mapExposedFaces(map(), sFlds);
1293 mapExposedFaces(map(), vFlds);
1294 mapExposedFaces(map(), sptFlds);
1295 mapExposedFaces(map(), sytFlds);
1296 mapExposedFaces(map(), tFlds);
1304 if (map().hasMotionPoints())
1306 mesh_.movePoints(map().preMotionPoints());
1315 void Foam::fvMeshDistribute::addProcPatches
1343 label bFacei = indices[i];
1344 label proci = nbrProc[bFacei];
1348 if (!procPatchID[proci].
found(referPatchID[bFacei]))
1353 if (referPatchID[bFacei] == -1)
1361 mesh_.boundaryMesh().size(),
1362 mesh_.boundaryMesh(),
1367 procPatchID[proci].insert
1369 referPatchID[bFacei],
1383 = refCast<const coupledPolyPatch>
1385 mesh_.boundaryMesh()[referPatchID[bFacei]]
1391 mesh_.boundaryMesh().size(),
1392 mesh_.boundaryMesh(),
1398 procPatchID[proci].insert
1400 referPatchID[bFacei],
1431 label origPatchi = referPatchID[bFacei];
1432 patchIDs[bFacei] = origPatchi;
1434 else if (nbrProc[bFacei] != -1)
1436 label origPatchi = referPatchID[bFacei];
1437 patchIDs[bFacei] = procPatchID[nbrProc[bFacei]][origPatchi];
1441 patchIDs[bFacei] = -1;
1449 void Foam::fvMeshDistribute::sendMesh
1469 Pout<<
"Sending to domain " << domain <<
nl 1471 <<
" nFaces:" << mesh.
nFaces() <<
nl 1472 <<
" nCells:" << mesh.
nCells() <<
nl 1485 forAll(pointZoneNames, nameI)
1491 rowSizes[nameI] = pointZones[myZoneID].
size();
1496 forAll(pointZoneNames, nameI)
1502 zonePoints[nameI].deepCopy(pointZones[myZoneID]);
1515 forAll(faceZoneNames, nameI)
1521 rowSizes[nameI] = faceZones[myZoneID].
size();
1526 zoneFaceFlip.
setSize(rowSizes);
1528 forAll(faceZoneNames, nameI)
1534 zoneFaces[nameI].deepCopy(faceZones[myZoneID]);
1535 zoneFaceFlip[nameI].deepCopy(faceZones[myZoneID].flipMap());
1547 forAll(cellZoneNames, nameI)
1553 rowSizes[nameI] = cellZones[myZoneID].
size();
1559 forAll(cellZoneNames, nameI)
1565 zoneCells[nameI].deepCopy(cellZones[myZoneID]);
1606 << sourcePointMaster;
1611 Pout<<
"Started sending mesh to domain " << domain
1624 const Time& runTime,
1652 >> domainSourcePatch
1653 >> domainSourceNbrPatch
1654 >> domainSourceNewNbrProc
1655 >> domainSourcePointMaster;
1671 move(domainAllOwner),
1672 move(domainAllNeighbour),
1676 fvMesh& domainMesh = domainMeshPtr();
1684 patchEntries[
patchi].keyword(),
1734 domainMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
1736 return domainMeshPtr;
1757 forAll(distribution, celli)
1759 label newProc = distribution[celli];
1766 <<
"At index " << celli <<
" distribution:" << newProc
1784 <<
"Size of distribution:" 1785 << distribution.
size() <<
" mesh nCells:" << mesh_.
nCells()
1796 <<
"This application requires all non-processor patches" 1797 <<
" to be present in the same order on all patches" <<
nl 1798 <<
"followed by the processor patches (which of course are unique)." 1813 oldPatchNMeshPoints[
patchi] = patches[
patchi].nPoints();
1830 move(oldPatchStarts),
1831 move(oldPatchNMeshPoints),
1919 checkEqualWordList(
"volScalarFields", volScalars);
1921 checkEqualWordList(
"volVectorFields", volVectors);
1926 checkEqualWordList(
"volSphericalTensorFields", volSphereTensors);
1928 checkEqualWordList(
"volSymmTensorFields", volSymmTensors);
1930 checkEqualWordList(
"volTensorField", volTensors);
1933 checkEqualWordList(
"surfaceScalarFields", surfScalars);
1935 checkEqualWordList(
"surfaceVectorFields", surfVectors);
1940 checkEqualWordList(
"surfaceSphericalTensorFields", surfSphereTensors);
1945 checkEqualWordList(
"surfaceSymmTensorFields", surfSymmTensors);
1947 checkEqualWordList(
"surfaceTensorFields", surfTensors);
1950 checkEqualWordList(
"pointScalarFields", pointScalars);
1952 checkEqualWordList(
"pointVectorFields", pointVectors);
1957 checkEqualWordList(
"pointSphericalTensorFields", pointSphereTensors);
1962 checkEqualWordList(
"pointSymmTensorFields", pointSymmTensors);
1964 checkEqualWordList(
"pointTensorFields", pointTensors);
1969 const wordList dimScalars(mesh_.
names(dimScalType::typeName));
1970 checkEqualWordList(
"volScalarField::Internal", dimScalars);
1973 const wordList dimVectors(mesh_.
names(dimVecType::typeName));
1974 checkEqualWordList(
"volVectorField::Internal", dimVectors);
1977 const wordList dimSphereTensors(mesh_.
names(dimSphereType::typeName));
1980 "volSphericalTensorField::Internal",
1985 const wordList dimSymmTensors(mesh_.
names(dimSymmTensorType::typeName));
1988 "volSymmTensorField::Internal",
1993 const wordList dimTensors(mesh_.
names(dimTensorType::typeName));
1994 checkEqualWordList(
"volTensorField::Internal", dimTensors);
1999 label oldInternalPatchi = findInternalPatch();
2010 repatchFaceMap = repatchMap().faceMap();
2017 repatchMap().reverseFaceMap(),
2036 Pout<<
nl <<
"MESH WITH PROC PATCHES DELETED:" <<
endl;
2038 printFieldInfo<volScalarField>(mesh_);
2039 printFieldInfo<volVectorField>(mesh_);
2040 printFieldInfo<volSphericalTensorField>(mesh_);
2041 printFieldInfo<volSymmTensorField>(mesh_);
2042 printFieldInfo<volTensorField>(mesh_);
2043 printFieldInfo<surfaceScalarField>(mesh_);
2044 printFieldInfo<surfaceVectorField>(mesh_);
2045 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2046 printFieldInfo<surfaceSymmTensorField>(mesh_);
2047 printFieldInfo<surfaceTensorField>(mesh_);
2048 printFieldInfo<pointScalarField>(mesh_);
2049 printFieldInfo<pointVectorField>(mesh_);
2050 printFieldInfo<pointSphericalTensorField>(mesh_);
2051 printFieldInfo<pointSymmTensorField>(mesh_);
2052 printFieldInfo<pointTensorField>(mesh_);
2104 <<
"SUBSETTING FOR DOMAIN " << recvProc
2105 <<
" cells to send:" 2126 subCellMap[recvProc] = subsetter.
cellMap();
2128 inplaceRenumberWithFlip
2133 subFaceMap[recvProc]
2135 subPointMap[recvProc] = subsetter.
pointMap();
2136 subPatchMap[recvProc] = subsetter.
patchMap();
2170 procSourceNewNbrProc,
2171 procSourcePointMaster
2189 procSourceNewNbrProc,
2190 procSourcePointMaster,
2196 sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
2197 sendFields<volVectorField>(recvProc, volVectors, subsetter, str);
2198 sendFields<volSphericalTensorField>
2205 sendFields<volSymmTensorField>
2212 sendFields<volTensorField>(recvProc, volTensors, subsetter, str);
2215 sendFields<surfaceScalarField>
2222 sendFields<surfaceVectorField>
2229 sendFields<surfaceSphericalTensorField>
2236 sendFields<surfaceSymmTensorField>
2243 sendFields<surfaceTensorField>
2252 sendFields<pointScalarField>
2259 sendFields<pointVectorField>
2266 sendFields<pointSphericalTensorField>
2273 sendFields<pointSymmTensorField>
2280 sendFields<pointTensorField>
2289 sendFields<volScalarField::Internal>
2296 sendFields<volVectorField::Internal>
2303 sendFields<volSphericalTensorField::Internal>
2310 sendFields<volSymmTensorField::Internal>
2317 sendFields<volTensorField::Internal>
2365 faceMap[facei] += 1;
2370 label facei = iter.key();
2371 faceMap[facei] = -faceMap[facei];
2394 subMap().pointMap(),
2413 domainSourceNbrPatch,
2414 domainSourceNewNbrProc,
2415 domainSourcePointMaster
2418 sourceFace.
transfer(domainSourceFace);
2419 sourceProc.
transfer(domainSourceProc);
2420 sourcePatch.
transfer(domainSourcePatch);
2421 sourceNbrPatch.
transfer(domainSourceNbrPatch);
2422 sourceNewNbrProc.
transfer(domainSourceNewNbrProc);
2423 sourcePointMaster.
transfer(domainSourcePointMaster);
2432 printFieldInfo<volScalarField>(mesh_);
2433 printFieldInfo<volVectorField>(mesh_);
2434 printFieldInfo<volSphericalTensorField>(mesh_);
2435 printFieldInfo<volSymmTensorField>(mesh_);
2436 printFieldInfo<volTensorField>(mesh_);
2437 printFieldInfo<surfaceScalarField>(mesh_);
2438 printFieldInfo<surfaceVectorField>(mesh_);
2439 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2440 printFieldInfo<surfaceSymmTensorField>(mesh_);
2441 printFieldInfo<surfaceTensorField>(mesh_);
2442 printFieldInfo<pointScalarField>(mesh_);
2443 printFieldInfo<pointVectorField>(mesh_);
2444 printFieldInfo<pointSphericalTensorField>(mesh_);
2445 printFieldInfo<pointSymmTensorField>(mesh_);
2446 printFieldInfo<pointTensorField>(mesh_);
2458 forAll(nSendCells, sendProc)
2470 <<
"RECEIVING FROM DOMAIN " << sendProc
2471 <<
" cells to receive:" 2518 domainMeshPtr = receiveMesh
2525 const_cast<Time&>(mesh_.
time()),
2529 domainSourceNbrPatch,
2530 domainSourceNewNbrProc,
2531 domainSourcePointMaster,
2534 fvMesh& domainMesh = domainMeshPtr();
2544 receiveFields<volScalarField>
2552 receiveFields<volVectorField>
2560 receiveFields<volSphericalTensorField>
2568 receiveFields<volSymmTensorField>
2576 receiveFields<volTensorField>
2586 receiveFields<surfaceScalarField>
2594 receiveFields<surfaceVectorField>
2602 receiveFields<surfaceSphericalTensorField>
2610 receiveFields<surfaceSymmTensorField>
2618 receiveFields<surfaceTensorField>
2630 receiveFields<pointScalarField>
2638 receiveFields<pointVectorField>
2646 receiveFields<pointSphericalTensorField>
2654 receiveFields<pointSymmTensorField>
2662 receiveFields<pointTensorField>
2672 receiveFields<volScalarField::Internal>
2683 receiveFields<volVectorField::Internal>
2694 receiveFields<volSphericalTensorField::Internal>
2706 receiveFields<volSymmTensorField::Internal>
2717 receiveFields<volTensorField::Internal>
2729 const fvMesh& domainMesh = domainMeshPtr();
2732 constructCellMap[sendProc] =
identity(domainMesh.nCells());
2733 constructFaceMap[sendProc] =
identity(domainMesh.nFaces()) + 1;
2734 constructPointMap[sendProc] =
identity(domainMesh.nPoints());
2735 constructPatchMap[sendProc] =
2736 identity(domainMesh.boundaryMesh().size());
2742 Pout<<
nl <<
"RECEIVED MESH FROM:" << sendProc <<
endl;
2744 printFieldInfo<volScalarField>(domainMesh);
2745 printFieldInfo<volVectorField>(domainMesh);
2746 printFieldInfo<volSphericalTensorField>(domainMesh);
2747 printFieldInfo<volSymmTensorField>(domainMesh);
2748 printFieldInfo<volTensorField>(domainMesh);
2749 printFieldInfo<surfaceScalarField>(domainMesh);
2750 printFieldInfo<surfaceVectorField>(domainMesh);
2751 printFieldInfo<surfaceSphericalTensorField>(domainMesh);
2752 printFieldInfo<surfaceSymmTensorField>(domainMesh);
2753 printFieldInfo<surfaceTensorField>(domainMesh);
2754 printFieldInfo<pointScalarField>(domainMesh);
2755 printFieldInfo<pointVectorField>(domainMesh);
2756 printFieldInfo<pointSphericalTensorField>(domainMesh);
2757 printFieldInfo<pointSymmTensorField>(domainMesh);
2758 printFieldInfo<pointTensorField>(domainMesh);
2812 sourceFace = mapBoundaryData
2817 domainMesh.nInternalFaces(),
2820 sourceProc = mapBoundaryData
2825 domainMesh.nInternalFaces(),
2828 sourcePatch = mapBoundaryData
2833 domainMesh.nInternalFaces(),
2836 sourceNbrPatch = mapBoundaryData
2841 domainMesh.nInternalFaces(),
2842 domainSourceNbrPatch
2844 sourceNewNbrProc = mapBoundaryData
2849 domainMesh.nInternalFaces(),
2850 domainSourceNewNbrProc
2853 sourcePointMaster = mapPointData
2858 domainSourcePointMaster
2864 const labelList& oldCellMap = map().oldCellMap();
2865 const labelList& oldFaceMap = map().oldFaceMap();
2866 const labelList& oldPointMap = map().oldPointMap();
2867 const labelList& oldPatchMap = map().oldPatchMap();
2870 forAll(constructPatchMap, proci)
2872 if (proci != sendProc && constructPatchMap[proci].size())
2876 inplaceRenumberWithFlip
2881 constructFaceMap[proci]
2893 label nBnd = domainMesh.nFaces()-domainMesh.nInternalFaces();
2894 flippedAddedFaces.
resize(nBnd/4);
2898 label domainFacei = domainMesh.nInternalFaces();
2899 domainFacei < domainMesh.nFaces();
2903 label newFacei = map().addedFaceMap()[domainFacei];
2906 label domainCellI = domainMesh.faceOwner()[domainFacei];
2908 if (newCellI != map().addedCellMap()[domainCellI])
2910 flippedAddedFaces.
insert(domainFacei);
2921 label domainFacei = iter.key();
2922 label& val = constructFaceMap[sendProc][domainFacei];
2925 inplaceRenumberWithFlip
2927 map().addedFaceMap(),
2930 constructFaceMap[sendProc]
2937 Pout<<
nl <<
"MERGED MESH FROM:" << sendProc <<
endl;
2939 printFieldInfo<volScalarField>(mesh_);
2940 printFieldInfo<volVectorField>(mesh_);
2941 printFieldInfo<volSphericalTensorField>(mesh_);
2942 printFieldInfo<volSymmTensorField>(mesh_);
2943 printFieldInfo<volTensorField>(mesh_);
2944 printFieldInfo<surfaceScalarField>(mesh_);
2945 printFieldInfo<surfaceVectorField>(mesh_);
2946 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2947 printFieldInfo<surfaceSymmTensorField>(mesh_);
2948 printFieldInfo<surfaceTensorField>(mesh_);
2949 printFieldInfo<pointScalarField>(mesh_);
2950 printFieldInfo<pointVectorField>(mesh_);
2951 printFieldInfo<pointSphericalTensorField>(mesh_);
2952 printFieldInfo<pointSymmTensorField>(mesh_);
2953 printFieldInfo<pointTensorField>(mesh_);
2966 printFieldInfo<volScalarField>(mesh_);
2967 printFieldInfo<volVectorField>(mesh_);
2968 printFieldInfo<volSphericalTensorField>(mesh_);
2969 printFieldInfo<volSymmTensorField>(mesh_);
2970 printFieldInfo<volTensorField>(mesh_);
2971 printFieldInfo<surfaceScalarField>(mesh_);
2972 printFieldInfo<surfaceVectorField>(mesh_);
2973 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2974 printFieldInfo<surfaceSymmTensorField>(mesh_);
2975 printFieldInfo<surfaceTensorField>(mesh_);
2976 printFieldInfo<pointScalarField>(mesh_);
2977 printFieldInfo<pointVectorField>(mesh_);
2978 printFieldInfo<pointSphericalTensorField>(mesh_);
2979 printFieldInfo<pointSymmTensorField>(mesh_);
2980 printFieldInfo<pointTensorField>(mesh_);
2987 mergeSharedPoints(sourcePointMaster, constructPointMap);
2999 addProcPatches(sourceNewNbrProc, sourcePatch, sourceNbrPatch, procPatchID);
3018 repatch(newPatchID, constructFaceMap);
3021 correctProcessorPatchFields<volScalarField>();
3022 correctProcessorPatchFields<volVectorField>();
3023 correctProcessorPatchFields<volSphericalTensorField>();
3024 correctProcessorPatchFields<volSymmTensorField>();
3025 correctProcessorPatchFields<volTensorField>();
3034 printFieldInfo<volScalarField>(mesh_);
3035 printFieldInfo<volVectorField>(mesh_);
3036 printFieldInfo<volSphericalTensorField>(mesh_);
3037 printFieldInfo<volSymmTensorField>(mesh_);
3038 printFieldInfo<volTensorField>(mesh_);
3039 printFieldInfo<surfaceScalarField>(mesh_);
3040 printFieldInfo<surfaceVectorField>(mesh_);
3041 printFieldInfo<surfaceSphericalTensorField>(mesh_);
3042 printFieldInfo<surfaceSymmTensorField>(mesh_);
3043 printFieldInfo<surfaceTensorField>(mesh_);
3044 printFieldInfo<pointScalarField>(mesh_);
3045 printFieldInfo<pointVectorField>(mesh_);
3046 printFieldInfo<pointSphericalTensorField>(mesh_);
3047 printFieldInfo<pointSymmTensorField>(mesh_);
3048 printFieldInfo<pointTensorField>(mesh_);
3062 move(oldPatchStarts),
3063 move(oldPatchNMeshPoints),
3070 move(constructPointMap),
3071 move(constructFaceMap),
3072 move(constructCellMap),
3073 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.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
label findZoneID(const word &zoneName) const
Find zone index given a name.
#define forAll(list, i)
Loop across all elements in list.
lessProcPatches(const labelList &nbrProc, const labelList &referPatchID, const labelList &referNbrPatchID)
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.
fvMeshDistribute(fvMesh &mesh)
Construct from mesh.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Class describing modification of a face.
A face is a list of labels corresponding to mesh vertices.
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.
const meshCellZones & cellZones() const
Return cell zones.
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.
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.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
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.
const labelList & faceFlipMap() const
Return face map with sign to encode flipped faces.
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.
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 & faceMap() const
Return face map.
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)
const meshPointZones & pointZones() const
Return point zones.
Various functions to operate on Lists.
Container for information needed to couple to meshes. When constructed from two meshes and a list of ...
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.
wordList names() const
Return a list of zone names.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
const fvMesh & subMesh() const
Return reference to subset mesh.
const labelList & patchMap() const
Return patch map.
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 nOldInternalFaces() const
Number of old internal faces.
wordList names() const
Return a list of patch names.
virtual const labelList & faceOwner() const
Return face owner.
const labelList & oldFaceMap() const
const labelList & pointMap() const
Return point map.
Pair< label > labelPair
Label pair.
List< label > labelList
A List of labels.
const word & name() const
Return name.
const labelList & cellMap() const
Return cell map.
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)
static pointMesh & New(polyMesh &mesh)
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.
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.
const meshFaceZones & faceZones() const
Return face zones.
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...
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.
virtual label nbrPatchID() const
Neighbour patchID.
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.