39 template<
class T,
class CombineOp>
50 if (iter != pointValues.end())
56 pointValues.insert(index, val);
62 template<
class T,
class CombineOp>
73 if (iter != edgeValues.end())
79 edgeValues.
insert(index, val);
84 template<
class T,
class CombineOp,
class TransformOp>
90 const TransformOp& top
99 Map<T> sharedPointValues(0);
108 sharedPointValues.resize(sharedPtAddr.
size());
113 label meshPointI = sharedPtLabels[i];
116 pointValues.find(meshPointI);
118 if (fnd != pointValues.end())
132 if (Pstream::parRun())
142 isA<processorPolyPatch>(
patches[patchI])
147 refCast<const processorPolyPatch>(
patches[patchI]);
161 pointValues.find(meshPts[i]);
163 if (iter != pointValues.end())
165 patchInfo.insert(nbrPts[i], iter());
170 toNeighb << patchInfo;
182 isA<processorPolyPatch>(
patches[patchI])
187 refCast<const processorPolyPatch>(
patches[patchI]);
190 Map<T> nbrPatchInfo(fromNb);
193 top(procPatch, nbrPatchInfo);
204 meshPts[nbrIter.key()],
215 if (isA<cyclicPolyPatch>(
patches[patchI]))
218 refCast<const cyclicPolyPatch>(
patches[patchI]);
220 if (cycPatch.
owner())
231 Map<T> half1Values(half0Values.size());
235 const edge&
e = coupledPoints[i];
238 pointValues.find(meshPtsA[
e[0]]);
240 if (point0Fnd != pointValues.end())
242 half0Values.insert(i, point0Fnd());
246 pointValues.find(meshPtsB[
e[1]]);
248 if (point1Fnd != pointValues.end())
250 half1Values.insert(i, point1Fnd());
255 top(cycPatch, half1Values);
256 top(nbrPatch, half0Values);
260 const edge&
e = coupledPoints[i];
265 if (half0Fnd != half0Values.end())
279 if (half1Fnd != half1Values.end())
304 if (Pstream::parRun())
306 if (Pstream::master())
311 int slave=Pstream::firstSlave();
312 slave<=Pstream::lastSlave();
316 IPstream fromSlave(Pstream::scheduled, slave);
317 Map<T> nbrValues(fromSlave);
335 int slave=Pstream::firstSlave();
336 slave<=Pstream::lastSlave();
340 OPstream toSlave(Pstream::scheduled, slave);
341 toSlave << sharedPointValues;
348 OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
349 toMaster << sharedPointValues;
358 fromMaster >> sharedPointValues;
371 sharedToMeshPoint.insert(sharedPtAddr[i], sharedPtLabels[i]);
378 sharedPointValues.find(iter.key());
380 if (sharedFnd != sharedPointValues.end())
382 pointValues.set(iter(), sharedFnd());
389 template<
class T,
class CombineOp,
class TransformOp>
394 const CombineOp& cop,
395 const TransformOp& top
408 if (Pstream::parRun())
418 isA<processorPolyPatch>(
patches[patchI])
419 &&
patches[patchI].nEdges() > 0
423 refCast<const processorPolyPatch>(
patches[patchI]);
436 const edge&
e = edges[i];
437 const edge meshEdge(meshPts[
e[0]], meshPts[
e[1]]);
440 edgeValues.
find(meshEdge);
442 if (iter != edgeValues.end())
444 const edge nbrEdge(nbrPts[
e[0]], nbrPts[
e[1]]);
445 patchInfo.
insert(nbrEdge, iter());
450 toNeighb << patchInfo;
462 isA<processorPolyPatch>(
patches[patchI])
463 &&
patches[patchI].nEdges() > 0
467 refCast<const processorPolyPatch>(
patches[patchI]);
472 fromNbr >> nbrPatchInfo;
476 top(procPatch, nbrPatchInfo);
484 const edge&
e = nbrIter.key();
485 const edge meshEdge(meshPts[
e[0]], meshPts[
e[1]]);
505 if (isA<cyclicPolyPatch>(
patches[patchI]))
508 refCast<const cyclicPolyPatch>(
patches[patchI]);
510 if (cycPatch.
owner())
523 Map<T> half1Values(half0Values.size());
527 const edge& twoEdges = coupledEdges[i];
530 const edge& e0 = edgesA[twoEdges[0]];
531 const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
534 edgeValues.
find(meshEdge0);
536 if (iter != edgeValues.end())
538 half0Values.insert(i, iter());
542 const edge& e1 = edgesB[twoEdges[1]];
543 const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
546 edgeValues.
find(meshEdge1);
548 if (iter != edgeValues.end())
550 half1Values.insert(i, iter());
556 top(cycPatch, half1Values);
557 top(nbrPatch, half0Values);
564 const edge& twoEdges = coupledEdges[i];
569 if (half1Fnd != half1Values.end())
571 const edge& e0 = edgesA[twoEdges[0]];
572 const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
585 if (half0Fnd != half0Values.end())
587 const edge& e1 = edgesB[twoEdges[1]];
588 const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
616 meshToShared.insert(sharedPtLabels[i], sharedPtAddr[i]);
620 EdgeMap<T> sharedEdgeValues(meshToShared.size());
629 for (
label faceI =
mesh.nInternalFaces(); faceI <
mesh.nFaces(); faceI++)
640 if (v0Fnd != meshToShared.end())
644 if (v1Fnd != meshToShared.end())
646 const edge meshEdge(v0, v1);
655 edgeValues.
find(meshEdge);
657 if (edgeFnd != edgeValues.end())
680 if (Pstream::parRun())
682 if (Pstream::master())
687 int slave=Pstream::firstSlave();
688 slave<=Pstream::lastSlave();
692 IPstream fromSlave(Pstream::scheduled, slave);
711 int slave=Pstream::firstSlave();
712 slave<=Pstream::lastSlave();
717 OPstream toSlave(Pstream::scheduled, slave);
718 toSlave << sharedEdgeValues;
725 OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
726 toMaster << sharedEdgeValues;
730 IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
731 fromMaster >> sharedEdgeValues;
744 const edge& meshEdge = iter();
750 if (sharedFnd != sharedEdgeValues.end())
982 template<
class T,
class CombineOp,
class TransformOp>
987 const CombineOp& cop,
989 const TransformOp& top
992 if (pointValues.
size() !=
mesh.nPoints())
995 <<
"Number of values " << pointValues.
size()
996 <<
" is not equal to the number of points in the mesh "
1000 mesh.globalData().syncPointData(pointValues, cop, top);
1025 template<
class T,
class CombineOp,
class TransformOp>
1031 const CombineOp& cop,
1033 const TransformOp& top
1036 if (pointValues.
size() != meshPoints.
size())
1039 <<
"Number of values " << pointValues.
size()
1040 <<
" is not equal to the number of meshPoints "
1051 label pointI = meshPoints[i];
1053 if (iter != mpm.end())
1055 cppFld[iter()] = pointValues[i];
1059 globalMeshData::syncData
1072 label pointI = meshPoints[i];
1074 if (iter != mpm.end())
1076 pointValues[i] = cppFld[iter()];
1139 template<
class T,
class CombineOp,
class TransformOp>
1144 const CombineOp& cop,
1146 const TransformOp& top
1149 if (edgeValues.
size() !=
mesh.nEdges())
1152 <<
"Number of values " << edgeValues.
size()
1153 <<
" is not equal to the number of edges in the mesh "
1164 globalMeshData::syncData
1178 edgeValues[meshEdges[i]] = cppFld[i];
1227 template<
class T,
class CombineOp,
class TransformOp>
1233 const CombineOp& cop,
1235 const TransformOp& top
1238 if (edgeValues.
size() != meshEdges.
size())
1241 <<
"Number of values " << edgeValues.
size()
1242 <<
" is not equal to the number of meshEdges "
1253 label edgeI = meshEdges[i];
1255 if (iter != mpm.end())
1257 cppFld[iter()] = edgeValues[i];
1261 globalMeshData::syncData
1274 label edgeI = meshEdges[i];
1276 if (iter != mpm.end())
1278 edgeValues[i] = cppFld[iter()];
1283 template<
class T,
class CombineOp,
class TransformOp>
1288 const CombineOp& cop,
1289 const TransformOp& top,
1293 const label nBFaces =
mesh.nFaces() -
mesh.nInternalFaces();
1295 if (faceValues.
size() != nBFaces)
1298 <<
"Number of values " << faceValues.
size()
1299 <<
" is not equal to the number of boundary faces in the mesh "
1315 isA<processorPolyPatch>(
patches[patchI])
1320 refCast<const processorPolyPatch>(
patches[patchI]);
1325 toNbr << SubField<T>(faceValues, procPatch.size(), patchStart);
1339 isA<processorPolyPatch>(
patches[patchI])
1344 refCast<const processorPolyPatch>(
patches[patchI]);
1346 Field<T> nbrPatchInfo(procPatch.size());
1349 fromNeighb >> nbrPatchInfo;
1351 top(procPatch, nbrPatchInfo);
1357 cop(faceValues[bFaceI++], nbrPatchInfo[i]);
1366 if (isA<cyclicPolyPatch>(
patches[patchI]))
1369 refCast<const cyclicPolyPatch>(
patches[patchI]);
1371 if (cycPatch.
owner())
1378 label sz = cycPatch.size();
1382 top(nbrPatch, ownVals);
1385 top(cycPatch, nbrVals);
1387 label i0 = ownStart;
1390 cop(faceValues[i0++], nbrVals[i]);
1393 label i1 = nbrStart;
1396 cop(faceValues[i1++], ownVals[i]);
1406 template<
unsigned nBits,
class CombineOp>
1411 const CombineOp& cop,
1415 if (faceValues.
size() !=
mesh.nFaces())
1418 <<
"Number of values " << faceValues.
size()
1419 <<
" is not equal to the number of faces in the mesh "
1435 isA<processorPolyPatch>(
patches[patchI])
1440 refCast<const processorPolyPatch>(
patches[patchI]);
1445 patchInfo[i] = faceValues[procPatch.
start()+i];
1462 isA<processorPolyPatch>(
patches[patchI])
1467 refCast<const processorPolyPatch>(
patches[patchI]);
1472 fromNbr >> patchInfo;
1478 unsigned int patchVal = patchInfo[i];
1480 unsigned int faceVal = faceValues[meshFaceI];
1481 cop(faceVal, patchVal);
1482 faceValues[meshFaceI] = faceVal;
1491 if (isA<cyclicPolyPatch>(
patches[patchI]))
1494 refCast<const cyclicPolyPatch>(
patches[patchI]);
1496 if (cycPatch.
owner())
1501 for (
label i = 0; i < cycPatch.size(); i++)
1504 unsigned int val0 = faceValues[meshFace0];
1506 unsigned int val1 = faceValues[meshFace1];
1508 unsigned int t = val0;
1510 faceValues[meshFace0] = t;
1513 faceValues[meshFace1] = val1;
1529 if (cellData.
size() !=
mesh.nCells())
1532 <<
"Number of cell values " << cellData.
size()
1533 <<
" is not equal to the number of cells in the mesh "
1541 neighbourCellData.
setSize(nBnd);
1550 neighbourCellData[bFaceI] = cellData[faceCells[i]];
1553 syncTools::swapBoundaryFaceList(
mesh, neighbourCellData);
1557 template<
unsigned nBits>
1568 template<
unsigned nBits,
class CombineOp>
1573 const CombineOp& cop,
1574 const unsigned int nullValue
1577 if (pointValues.
size() !=
mesh.nPoints())
1580 <<
"Number of values " << pointValues.
size()
1581 <<
" is not equal to the number of points in the mesh "
1591 cppFld[i] = pointValues[meshPoints[i]];
1594 globalMeshData::syncData
1606 pointValues[meshPoints[i]] = cppFld[i];
1611 template<
unsigned nBits,
class CombineOp>
1616 const CombineOp& cop,
1617 const unsigned int nullValue
1620 if (edgeValues.
size() !=
mesh.nEdges())
1623 <<
"Number of values " << edgeValues.
size()
1624 <<
" is not equal to the number of edges in the mesh "
1634 cppFld[i] = edgeValues[meshEdges[i]];
1637 globalMeshData::syncData
1649 edgeValues[meshEdges[i]] = cppFld[i];