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))
221 Foam::label Foam::fvMeshDistribute::checkEqualWordList
234 if (allNames[proci] != allNames[0])
237 <<
"When checking for equal " << msg.c_str() <<
" :" <<
endl 238 <<
"processor0 has:" << allNames[0] <<
endl 239 <<
"processor" << proci <<
" has:" << allNames[proci] <<
endl 240 << msg.c_str() <<
" need to be synchronised on all processors." 259 forAll(allNames[proci], i)
261 mergedNames.
insert(allNames[proci][i]);
264 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]
354 Foam::label Foam::fvMeshDistribute::findInternalPatch()
const 358 label internalPatchi = -1;
364 if (isA<internalPolyPatch>(pp))
371 if (internalPatchi == -1)
374 <<
"Cannot find a internal patch in " << patches.
names() <<
nl 375 <<
" of types " << patches.
types() <<
nl 376 <<
" An internal patch must be provided for the exposed " 382 Pout<<
"findInternalPatch : using patch " << internalPatchi
383 <<
" name:" << patches[internalPatchi].
name()
384 <<
" type:" << patches[internalPatchi].type()
385 <<
" for the exposed internal faces." <<
endl;
390 label procPatchi = -1;
394 if (isA<processorPolyPatch>(patches[
patchi]))
398 else if (procPatchi != -1)
401 <<
"Processor patches should be at end of patch list." 403 <<
"Have processor patch " << procPatchi
404 <<
" followed by non-processor patch " << patchi
405 <<
" in patches " << patches.
names()
410 return internalPatchi;
413 Foam::label Foam::fvMeshDistribute::findNonEmptyPatch()
const 417 label nonEmptyPatchi = -1;
423 if (!isA<emptyPolyPatch>(pp) && !pp.
coupled())
430 if (nonEmptyPatchi == -1)
433 <<
"Cannot find a non-empty patch in " << patches.
names() <<
nl 434 <<
" of types " << patches.
types() <<
nl 435 <<
" An non-empty patch must be provided for the exposed " 441 Pout<<
"findNonEmptyPatch : using patch " << nonEmptyPatchi
442 <<
" name:" << patches[nonEmptyPatchi].
name()
443 <<
" type:" << patches[nonEmptyPatchi].type()
444 <<
" for the exposed non-empty faces." <<
endl;
447 return nonEmptyPatchi;
453 const label destinationPatch
458 labelList newPatchID(mesh_.nFaces() - mesh_.nInternalFaces(), -1);
460 label nProcPatches = 0;
466 if (isA<processorPolyPatch>(pp))
470 Pout<<
"Moving all faces of patch " << pp.
name()
471 <<
" into patch " << destinationPatch
475 label offset = pp.
start() - mesh_.nInternalFaces();
479 newPatchID[offset+i] = destinationPatch;
500 if (!isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
502 oldToNew[
patchi] = newI++;
505 label nNonProcPatches = newI;
510 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
512 oldToNew[
patchi] = newI++;
530 forAll(newPatchID, bFacei)
532 if (newPatchID[bFacei] != -1)
534 label facei = mesh_.nInternalFaces() + bFacei;
536 label zoneID = mesh_.faceZones().whichZone(facei);
537 bool zoneFlip =
false;
541 const faceZone& fZone = mesh_.faceZones()[zoneID];
549 mesh_.faces()[facei],
551 mesh_.faceOwner()[facei],
569 saveBoundaryFields<scalar, surfaceMesh>(sFlds);
571 saveBoundaryFields<vector, surfaceMesh>(vFlds);
573 saveBoundaryFields<sphericalTensor, surfaceMesh>(sptFlds);
575 saveBoundaryFields<symmTensor, surfaceMesh>(sytFlds);
577 saveBoundaryFields<tensor, surfaceMesh>(tFlds);
589 mesh_.mapFields(map);
593 mapBoundaryFields<scalar, surfaceMesh>(map, sFlds);
594 mapBoundaryFields<vector, surfaceMesh>(map, vFlds);
595 mapBoundaryFields<sphericalTensor, surfaceMesh>(map, sptFlds);
596 mapBoundaryFields<symmTensor, surfaceMesh>(map, sytFlds);
597 mapBoundaryFields<tensor, surfaceMesh>(map, tFlds);
608 <<
"reverseFaceMap contains -1 at index:" 610 <<
"This means that the repatch operation was not just" 615 forAll(constructFaceMap, proci)
617 inplaceRenumberWithFlip
619 map().reverseFaceMap(),
622 constructFaceMap[proci]
641 forAll(pointToGlobalMaster, pointi)
643 if (pointToGlobalMaster[pointi] != -1)
649 Map<label> globalMasterToLocalMaster(2*nShared);
652 forAll(pointToGlobalMaster, pointi)
654 label globali = pointToGlobalMaster[pointi];
662 if (iter == globalMasterToLocalMaster.
end())
665 globalMasterToLocalMaster.
insert(globali, pointi);
666 pointToMaster.
insert(pointi, pointi);
670 pointToMaster.
insert(pointi, iter());
684 forAll(mesh_.points(), pointi)
688 if (iter != pointToMaster.
end())
690 if (iter() != pointi)
692 meshMod.removePoint(pointi, iter());
699 const faceList& faces = mesh_.faces();
703 const face&
f = faces[facei];
705 bool hasMerged =
false;
709 label pointi = f[fp];
713 if (iter != pointToMaster.
end())
715 if (iter() != pointi)
729 label pointi = f[fp];
732 pointToMaster.
find(pointi);
734 if (iter != pointToMaster.
end())
740 label patchID = mesh_.boundaryMesh().whichPatch(facei);
741 label nei = (patchID == -1 ? mesh_.faceNeighbour()[facei] : -1);
742 label zoneID = mesh_.faceZones().whichZone(facei);
743 bool zoneFlip =
false;
747 const faceZone& fZone = mesh_.faceZones()[zoneID];
757 mesh_.faceOwner()[facei],
774 mesh_.mapFields(map);
777 forAll(constructPointMap, proci)
779 labelList& constructMap = constructPointMap[proci];
783 label oldPointi = constructMap[i];
789 constructMap[i] = -newPointi-2;
791 else if (newPointi >= 0)
798 <<
"Problem. oldPointi:" << oldPointi
808 void Foam::fvMeshDistribute::getCouplingData
822 label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
827 sourceNewNbrProc.
setSize(nBnd);
841 label offset = pp.
start() - mesh_.nInternalFaces();
846 label bndI = offset + i;
847 nbrFaces[bndI] = pp.
start()+i;
865 label offset = pp.
start() - mesh_.nInternalFaces();
867 if (isA<processorPolyPatch>(pp))
870 refCast<const processorPolyPatch>(pp);
874 if (procPatch.
owner())
879 label bndI = offset + i;
880 sourceFace[bndI] = pp.
start()+i;
882 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
890 label bndI = offset + i;
891 sourceFace[bndI] = nbrFaces[bndI];
893 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
899 if (isA<processorCyclicPolyPatch>(pp))
902 refCast<const processorCyclicPolyPatch>(pp)
905 refCast<const cyclicPolyPatch>(patches[
patchi])
912 label bndI = offset + i;
913 sourcePatch[bndI] =
patchi;
914 sourceNbrPatch[bndI] = nbrPatchi;
917 else if (isA<cyclicPolyPatch>(pp))
925 label bndI = offset + i;
926 sourceFace[bndI] = pp.
start()+i;
928 sourcePatch[bndI] =
patchi;
930 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
937 label bndI = offset + i;
938 sourceFace[bndI] = nbrFaces[bndI];
940 sourcePatch[bndI] =
patchi;
942 sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
951 label bndI = offset + i;
952 sourceFace[bndI] = -1;
953 sourceProc[bndI] = -1;
954 sourcePatch[bndI] =
patchi;
955 sourceNbrPatch[bndI] = -1;
956 sourceNewNbrProc[bndI] = -1;
963 sourcePointMaster.
setSize(mesh_.nPoints());
964 sourcePointMaster = -1;
976 forAll(meshPoints, pointi)
985 elems[pointi] = globalPointi;
988 label sloti = slots[i];
989 if (sloti >= meshPoints.
size())
993 elems[slots[i]] = globalPointi;
1003 forAll(meshPoints, pointi)
1005 sourcePointMaster[meshPoints[pointi]] = elems[pointi];
1011 void Foam::fvMeshDistribute::subsetCouplingData
1021 const label oldInternalFaces,
1044 forAll(subFace, newBFacei)
1048 label oldFacei = faceMap[newFacei];
1051 if (oldFacei < oldInternalFaces)
1053 subFace[newBFacei] = oldFacei;
1055 subPatch[newBFacei] = -1;
1057 label oldOwn = oldFaceOwner[oldFacei];
1058 label oldNei = oldFaceNeighbour[oldFacei];
1060 if (oldOwn == cellMap[mesh.
faceOwner()[newFacei]])
1063 subNewNbrProc[newBFacei] = oldDistribution[oldNei];
1068 subNewNbrProc[newBFacei] = oldDistribution[oldOwn];
1074 label oldBFacei = oldFacei - oldInternalFaces;
1076 subFace[newBFacei] = sourceFace[oldBFacei];
1077 subProc[newBFacei] = sourceProc[oldBFacei];
1078 subPatch[newBFacei] = sourcePatch[oldBFacei];
1079 subNbrPatch[newBFacei] = sourceNbrPatch[oldBFacei];
1080 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;
1168 const label nInternalFaces1,
1174 forAll(boundaryData0, oldBFacei)
1182 boundaryData0[oldBFacei];
1186 forAll(boundaryData1, addedBFacei)
1193 boundaryData1[addedBFacei];
1197 return newBoundaryData;
1211 forAll(boundaryData0, oldPointi)
1218 newBoundaryData[
newPointi] = boundaryData0[oldPointi];
1222 forAll(boundaryData1, addedPointi)
1228 newBoundaryData[
newPointi] = boundaryData1[addedPointi];
1232 return newBoundaryData;
1239 const label oldInternalPatchi
1257 labelList(exposedFaces.size(), oldInternalPatchi),
1266 saveInternalFields(sFlds);
1268 saveInternalFields(vFlds);
1270 saveInternalFields(sptFlds);
1272 saveInternalFields(sytFlds);
1274 saveInternalFields(tFlds);
1280 mesh_.mapFields(map);
1286 mapExposedFaces(map(), sFlds);
1287 mapExposedFaces(map(), vFlds);
1288 mapExposedFaces(map(), sptFlds);
1289 mapExposedFaces(map(), sytFlds);
1290 mapExposedFaces(map(), tFlds);
1296 void Foam::fvMeshDistribute::addProcPatches
1324 label bFacei = indices[i];
1325 label proci = nbrProc[bFacei];
1329 if (!procPatchID[proci].
found(referPatchID[bFacei]))
1334 if (referPatchID[bFacei] == -1)
1342 mesh_.boundaryMesh().size(),
1343 mesh_.boundaryMesh(),
1348 procPatchID[proci].insert
1350 referPatchID[bFacei],
1364 = refCast<const coupledPolyPatch>
1366 mesh_.boundaryMesh()[referPatchID[bFacei]]
1372 mesh_.boundaryMesh().size(),
1373 mesh_.boundaryMesh(),
1379 procPatchID[proci].insert
1381 referPatchID[bFacei],
1411 label origPatchi = referPatchID[bFacei];
1412 patchIDs[bFacei] = origPatchi;
1414 else if (nbrProc[bFacei] != -1)
1416 label origPatchi = referPatchID[bFacei];
1417 patchIDs[bFacei] = procPatchID[nbrProc[bFacei]][origPatchi];
1421 patchIDs[bFacei] = -1;
1428 void Foam::fvMeshDistribute::sendMesh
1448 Pout<<
"Sending to domain " << domain <<
nl 1450 <<
" nFaces:" << mesh.
nFaces() <<
nl 1451 <<
" nCells:" << mesh.
nCells() <<
nl 1464 forAll(pointZoneNames, nameI)
1470 rowSizes[nameI] = pointZones[myZoneID].
size();
1475 forAll(pointZoneNames, nameI)
1481 zonePoints[nameI].
deepCopy(pointZones[myZoneID]);
1494 forAll(faceZoneNames, nameI)
1500 rowSizes[nameI] = faceZones[myZoneID].
size();
1505 zoneFaceFlip.
setSize(rowSizes);
1507 forAll(faceZoneNames, nameI)
1513 zoneFaces[nameI].
deepCopy(faceZones[myZoneID]);
1514 zoneFaceFlip[nameI].
deepCopy(faceZones[myZoneID].flipMap());
1526 forAll(cellZoneNames, nameI)
1532 rowSizes[nameI] = cellZones[myZoneID].
size();
1538 forAll(cellZoneNames, nameI)
1544 zoneCells[nameI].
deepCopy(cellZones[myZoneID]);
1585 << sourcePointMaster;
1590 Pout<<
"Started sending mesh to domain " << domain
1602 const Time& runTime,
1630 >> domainSourcePatch
1631 >> domainSourceNbrPatch
1632 >> domainSourceNewNbrProc
1633 >> domainSourcePointMaster;
1649 move(domainAllOwner),
1650 move(domainAllNeighbour),
1654 fvMesh& domainMesh = domainMeshPtr();
1662 patchEntries[
patchi].keyword(),
1712 domainMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
1714 return domainMeshPtr;
1734 forAll(distribution, celli)
1736 label newProc = distribution[celli];
1743 <<
"At index " << celli <<
" distribution:" << newProc
1761 <<
"Size of distribution:" 1762 << distribution.
size() <<
" mesh nCells:" << mesh_.
nCells()
1773 <<
"This application requires all non-processor patches" 1774 <<
" to be present in the same order on all patches" <<
nl 1775 <<
"followed by the processor patches (which of course are unique)." 1790 oldPatchNMeshPoints[
patchi] = patches[
patchi].nPoints();
1807 move(oldPatchStarts),
1808 move(oldPatchNMeshPoints),
1895 nFields += checkEqualWordList(
"volScalarFields", volScalars);
1897 nFields += checkEqualWordList(
"volVectorFields", volVectors);
1902 nFields += checkEqualWordList(
"volSphericalTensorFields", volSphereTensors);
1904 nFields += checkEqualWordList(
"volSymmTensorFields", volSymmTensors);
1906 nFields += checkEqualWordList(
"volTensorField", volTensors);
1909 nFields += checkEqualWordList(
"surfaceScalarFields", surfScalars);
1911 nFields += checkEqualWordList(
"surfaceVectorFields", surfVectors);
1916 nFields += checkEqualWordList
1918 "surfaceSphericalTensorFields",
1925 nFields += checkEqualWordList(
"surfaceSymmTensorFields", surfSymmTensors);
1927 nFields += checkEqualWordList(
"surfaceTensorFields", surfTensors);
1930 nFields += checkEqualWordList(
"pointScalarFields", pointScalars);
1932 nFields += checkEqualWordList(
"pointVectorFields", pointVectors);
1937 nFields += checkEqualWordList
1939 "pointSphericalTensorFields",
1946 nFields += checkEqualWordList(
"pointSymmTensorFields", pointSymmTensors);
1948 nFields += checkEqualWordList(
"pointTensorFields", pointTensors);
1951 nFields += checkEqualWordList(
"volScalarField::Internal", dimScalars);
1954 nFields += checkEqualWordList(
"volVectorField::Internal", dimVectors);
1960 nFields += checkEqualWordList
1962 "volSphericalTensorField::Internal",
1970 nFields += checkEqualWordList
1972 "volSymmTensorField::Internal",
1977 nFields += checkEqualWordList(
"volTensorField::Internal", dimTensors);
1982 const label oldInternalPatchi =
1984 ? findInternalPatch()
1985 : findNonEmptyPatch();
1992 deleteProcPatches(oldInternalPatchi);
1995 repatchFaceMap = repatchMap().faceMap();
2002 repatchMap().reverseFaceMap(),
2021 Pout<<
nl <<
"MESH WITH PROC PATCHES DELETED:" <<
endl;
2023 printFieldInfo<volScalarField>(mesh_);
2024 printFieldInfo<volVectorField>(mesh_);
2025 printFieldInfo<volSphericalTensorField>(mesh_);
2026 printFieldInfo<volSymmTensorField>(mesh_);
2027 printFieldInfo<volTensorField>(mesh_);
2028 printFieldInfo<surfaceScalarField>(mesh_);
2029 printFieldInfo<surfaceVectorField>(mesh_);
2030 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2031 printFieldInfo<surfaceSymmTensorField>(mesh_);
2032 printFieldInfo<surfaceTensorField>(mesh_);
2033 printFieldInfo<pointScalarField>(mesh_);
2034 printFieldInfo<pointVectorField>(mesh_);
2035 printFieldInfo<pointSphericalTensorField>(mesh_);
2036 printFieldInfo<pointSymmTensorField>(mesh_);
2037 printFieldInfo<pointTensorField>(mesh_);
2089 <<
"SUBSETTING FOR DOMAIN " << recvProc
2090 <<
" cells to send:" 2111 subCellMap[recvProc] = subsetter.
cellMap();
2113 inplaceRenumberWithFlip
2118 subFaceMap[recvProc]
2120 subPointMap[recvProc] = subsetter.
pointMap();
2121 subPatchMap[recvProc] = subsetter.
patchMap();
2155 procSourceNewNbrProc,
2156 procSourcePointMaster
2174 procSourceNewNbrProc,
2175 procSourcePointMaster,
2181 sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
2182 sendFields<volVectorField>(recvProc, volVectors, subsetter, str);
2183 sendFields<volSphericalTensorField>
2190 sendFields<volSymmTensorField>
2197 sendFields<volTensorField>(recvProc, volTensors, subsetter, str);
2200 sendFields<surfaceScalarField>
2207 sendFields<surfaceVectorField>
2214 sendFields<surfaceSphericalTensorField>
2221 sendFields<surfaceSymmTensorField>
2228 sendFields<surfaceTensorField>
2237 sendFields<pointScalarField>
2244 sendFields<pointVectorField>
2251 sendFields<pointSphericalTensorField>
2258 sendFields<pointSymmTensorField>
2265 sendFields<pointTensorField>
2274 sendFields<volScalarField::Internal>
2281 sendFields<volVectorField::Internal>
2288 sendFields<volSphericalTensorField::Internal>
2295 sendFields<volSymmTensorField::Internal>
2302 sendFields<volTensorField::Internal>
2350 faceMap[facei] += 1;
2355 label facei = iter.key();
2356 faceMap[facei] = -faceMap[facei];
2379 subMap().pointMap(),
2398 domainSourceNbrPatch,
2399 domainSourceNewNbrProc,
2400 domainSourcePointMaster
2403 sourceFace.
transfer(domainSourceFace);
2404 sourceProc.
transfer(domainSourceProc);
2405 sourcePatch.
transfer(domainSourcePatch);
2406 sourceNbrPatch.
transfer(domainSourceNbrPatch);
2407 sourceNewNbrProc.
transfer(domainSourceNewNbrProc);
2408 sourcePointMaster.
transfer(domainSourcePointMaster);
2417 printFieldInfo<volScalarField>(mesh_);
2418 printFieldInfo<volVectorField>(mesh_);
2419 printFieldInfo<volSphericalTensorField>(mesh_);
2420 printFieldInfo<volSymmTensorField>(mesh_);
2421 printFieldInfo<volTensorField>(mesh_);
2422 printFieldInfo<surfaceScalarField>(mesh_);
2423 printFieldInfo<surfaceVectorField>(mesh_);
2424 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2425 printFieldInfo<surfaceSymmTensorField>(mesh_);
2426 printFieldInfo<surfaceTensorField>(mesh_);
2427 printFieldInfo<pointScalarField>(mesh_);
2428 printFieldInfo<pointVectorField>(mesh_);
2429 printFieldInfo<pointSphericalTensorField>(mesh_);
2430 printFieldInfo<pointSymmTensorField>(mesh_);
2431 printFieldInfo<pointTensorField>(mesh_);
2443 forAll(nSendCells, sendProc)
2455 <<
"RECEIVING FROM DOMAIN " << sendProc
2456 <<
" cells to receive:" 2503 domainMeshPtr = receiveMesh
2510 const_cast<Time&>(mesh_.
time()),
2514 domainSourceNbrPatch,
2515 domainSourceNewNbrProc,
2516 domainSourcePointMaster,
2519 fvMesh& domainMesh = domainMeshPtr();
2529 receiveFields<volScalarField>
2537 receiveFields<volVectorField>
2545 receiveFields<volSphericalTensorField>
2553 receiveFields<volSymmTensorField>
2561 receiveFields<volTensorField>
2571 receiveFields<surfaceScalarField>
2579 receiveFields<surfaceVectorField>
2587 receiveFields<surfaceSphericalTensorField>
2595 receiveFields<surfaceSymmTensorField>
2603 receiveFields<surfaceTensorField>
2615 receiveFields<pointScalarField>
2623 receiveFields<pointVectorField>
2631 receiveFields<pointSphericalTensorField>
2639 receiveFields<pointSymmTensorField>
2647 receiveFields<pointTensorField>
2657 receiveFields<volScalarField::Internal>
2668 receiveFields<volVectorField::Internal>
2679 receiveFields<volSphericalTensorField::Internal>
2691 receiveFields<volSymmTensorField::Internal>
2702 receiveFields<volTensorField::Internal>
2714 const fvMesh& domainMesh = domainMeshPtr();
2717 constructCellMap[sendProc] =
identity(domainMesh.nCells());
2718 constructFaceMap[sendProc] =
identity(domainMesh.nFaces()) + 1;
2719 constructPointMap[sendProc] =
identity(domainMesh.nPoints());
2720 constructPatchMap[sendProc] =
2721 identity(domainMesh.boundaryMesh().size());
2727 Pout<<
nl <<
"RECEIVED MESH FROM:" << sendProc <<
endl;
2729 printFieldInfo<volScalarField>(domainMesh);
2730 printFieldInfo<volVectorField>(domainMesh);
2731 printFieldInfo<volSphericalTensorField>(domainMesh);
2732 printFieldInfo<volSymmTensorField>(domainMesh);
2733 printFieldInfo<volTensorField>(domainMesh);
2734 printFieldInfo<surfaceScalarField>(domainMesh);
2735 printFieldInfo<surfaceVectorField>(domainMesh);
2736 printFieldInfo<surfaceSphericalTensorField>(domainMesh);
2737 printFieldInfo<surfaceSymmTensorField>(domainMesh);
2738 printFieldInfo<surfaceTensorField>(domainMesh);
2739 printFieldInfo<pointScalarField>(domainMesh);
2740 printFieldInfo<pointVectorField>(domainMesh);
2741 printFieldInfo<pointSphericalTensorField>(domainMesh);
2742 printFieldInfo<pointSymmTensorField>(domainMesh);
2743 printFieldInfo<pointTensorField>(domainMesh);
2797 sourceFace = mapBoundaryData
2802 domainMesh.nInternalFaces(),
2805 sourceProc = mapBoundaryData
2810 domainMesh.nInternalFaces(),
2813 sourcePatch = mapBoundaryData
2818 domainMesh.nInternalFaces(),
2821 sourceNbrPatch = mapBoundaryData
2826 domainMesh.nInternalFaces(),
2827 domainSourceNbrPatch
2829 sourceNewNbrProc = mapBoundaryData
2834 domainMesh.nInternalFaces(),
2835 domainSourceNewNbrProc
2838 sourcePointMaster = mapPointData
2843 domainSourcePointMaster
2849 const labelList& oldCellMap = map().oldCellMap();
2850 const labelList& oldFaceMap = map().oldFaceMap();
2851 const labelList& oldPointMap = map().oldPointMap();
2852 const labelList& oldPatchMap = map().oldPatchMap();
2855 forAll(constructPatchMap, proci)
2857 if (proci != sendProc && constructPatchMap[proci].size())
2861 inplaceRenumberWithFlip
2866 constructFaceMap[proci]
2878 label nBnd = domainMesh.nFaces()-domainMesh.nInternalFaces();
2879 flippedAddedFaces.
resize(nBnd/4);
2883 label domainFacei = domainMesh.nInternalFaces();
2884 domainFacei < domainMesh.nFaces();
2888 label newFacei = map().addedFaceMap()[domainFacei];
2891 label domainCellI = domainMesh.faceOwner()[domainFacei];
2893 if (newCellI != map().addedCellMap()[domainCellI])
2895 flippedAddedFaces.
insert(domainFacei);
2906 label domainFacei = iter.key();
2907 label& val = constructFaceMap[sendProc][domainFacei];
2910 inplaceRenumberWithFlip
2912 map().addedFaceMap(),
2915 constructFaceMap[sendProc]
2922 Pout<<
nl <<
"MERGED MESH FROM:" << sendProc <<
endl;
2924 printFieldInfo<volScalarField>(mesh_);
2925 printFieldInfo<volVectorField>(mesh_);
2926 printFieldInfo<volSphericalTensorField>(mesh_);
2927 printFieldInfo<volSymmTensorField>(mesh_);
2928 printFieldInfo<volTensorField>(mesh_);
2929 printFieldInfo<surfaceScalarField>(mesh_);
2930 printFieldInfo<surfaceVectorField>(mesh_);
2931 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2932 printFieldInfo<surfaceSymmTensorField>(mesh_);
2933 printFieldInfo<surfaceTensorField>(mesh_);
2934 printFieldInfo<pointScalarField>(mesh_);
2935 printFieldInfo<pointVectorField>(mesh_);
2936 printFieldInfo<pointSphericalTensorField>(mesh_);
2937 printFieldInfo<pointSymmTensorField>(mesh_);
2938 printFieldInfo<pointTensorField>(mesh_);
2951 printFieldInfo<volScalarField>(mesh_);
2952 printFieldInfo<volVectorField>(mesh_);
2953 printFieldInfo<volSphericalTensorField>(mesh_);
2954 printFieldInfo<volSymmTensorField>(mesh_);
2955 printFieldInfo<volTensorField>(mesh_);
2956 printFieldInfo<surfaceScalarField>(mesh_);
2957 printFieldInfo<surfaceVectorField>(mesh_);
2958 printFieldInfo<surfaceSphericalTensorField>(mesh_);
2959 printFieldInfo<surfaceSymmTensorField>(mesh_);
2960 printFieldInfo<surfaceTensorField>(mesh_);
2961 printFieldInfo<pointScalarField>(mesh_);
2962 printFieldInfo<pointVectorField>(mesh_);
2963 printFieldInfo<pointSphericalTensorField>(mesh_);
2964 printFieldInfo<pointSymmTensorField>(mesh_);
2965 printFieldInfo<pointTensorField>(mesh_);
2972 mergeSharedPoints(sourcePointMaster, constructPointMap);
2984 addProcPatches(sourceNewNbrProc, sourcePatch, sourceNbrPatch, procPatchID);
3003 repatch(newPatchID, constructFaceMap);
3006 correctProcessorPatchFields<volScalarField>();
3007 correctProcessorPatchFields<volVectorField>();
3008 correctProcessorPatchFields<volSphericalTensorField>();
3009 correctProcessorPatchFields<volSymmTensorField>();
3010 correctProcessorPatchFields<volTensorField>();
3019 printFieldInfo<volScalarField>(mesh_);
3020 printFieldInfo<volVectorField>(mesh_);
3021 printFieldInfo<volSphericalTensorField>(mesh_);
3022 printFieldInfo<volSymmTensorField>(mesh_);
3023 printFieldInfo<volTensorField>(mesh_);
3024 printFieldInfo<surfaceScalarField>(mesh_);
3025 printFieldInfo<surfaceVectorField>(mesh_);
3026 printFieldInfo<surfaceSphericalTensorField>(mesh_);
3027 printFieldInfo<surfaceSymmTensorField>(mesh_);
3028 printFieldInfo<surfaceTensorField>(mesh_);
3029 printFieldInfo<pointScalarField>(mesh_);
3030 printFieldInfo<pointVectorField>(mesh_);
3031 printFieldInfo<pointSphericalTensorField>(mesh_);
3032 printFieldInfo<pointSymmTensorField>(mesh_);
3033 printFieldInfo<pointTensorField>(mesh_);
3047 move(oldPatchStarts),
3048 move(oldPatchNMeshPoints),
3055 move(constructPointMap),
3056 move(constructFaceMap),
3057 move(constructCellMap),
3058 move(constructPatchMap),
const labelList & oldPointMap() const
From old mesh point/face/cell to new mesh point/face/cell.
const fvPatchList & patches
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.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
autoPtr< polyTopoChangeMap > 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.
lessProcPatches(const labelList &nbrProc, const labelList &referPatchID, const labelList &referNbrPatchID)
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 reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
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.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
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.
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(...)
wordList types() const
Return a list of patch types.
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.
autoPtr< polyDistributionMap > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
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.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
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.
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...
label constructSize() const
Constructed data size.
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)
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.
const vectorField & faceCentres() const
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.
Class containing processor-to-processor mapping information.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
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.
A patch is a list of labels that address the faces in the global face list.
void deepCopy(const UCompactListList< T > &)
Copy the underlying data.
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.