37 template<
class T,
class CombineOp>
38 void Foam::syncTools::combine
48 if (iter != pointValues.end())
54 pointValues.insert(index, val);
59 template<
class T,
class CombineOp>
60 void Foam::syncTools::combine
62 EdgeMap<T>& edgeValues,
70 if (iter != edgeValues.end())
76 edgeValues.insert(index, val);
81 template<
class T,
class CombineOp,
class TransformOp>
87 const TransformOp& top
96 Map<T> sharedPointValues(0);
105 sharedPointValues.
resize(sharedPtAddr.
size());
110 label meshPointi = sharedPtLabels[i];
113 pointValues.
find(meshPointi);
115 if (fnd != pointValues.
end())
139 isA<processorPolyPatch>(patches[
patchi])
140 && patches[patchi].
nPoints() > 0
144 refCast<const processorPolyPatch>(patches[
patchi]);
153 Map<T> patchInfo(meshPts.size() / 20);
158 pointValues.
find(meshPts[i]);
160 if (iter != pointValues.
end())
162 patchInfo.insert(nbrPts[i], iter());
167 toNeighb << patchInfo;
179 isA<processorPolyPatch>(patches[
patchi])
180 && patches[patchi].
nPoints() > 0
184 refCast<const processorPolyPatch>(patches[
patchi]);
187 Map<T> nbrPatchInfo(fromNb);
190 top(procPatch, nbrPatchInfo);
201 meshPts[nbrIter.key()],
212 if (isA<cyclicPolyPatch>(patches[
patchi]))
215 refCast<const cyclicPolyPatch>(patches[
patchi]);
217 if (cycPatch.
owner())
228 Map<T> half1Values(half0Values.size());
232 const edge&
e = coupledPoints[i];
235 pointValues.
find(meshPtsA[e[0]]);
237 if (point0Fnd != pointValues.
end())
239 half0Values.insert(i, point0Fnd());
243 pointValues.
find(meshPtsB[e[1]]);
245 if (point1Fnd != pointValues.
end())
247 half1Values.insert(i, point1Fnd());
252 top(cycPatch, half1Values);
253 top(nbrPatch, half0Values);
257 const edge&
e = coupledPoints[i];
262 if (half0Fnd != half0Values.end())
276 if (half1Fnd != half1Values.end())
314 Map<T> nbrValues(fromSlave);
338 toSlave << sharedPointValues;
350 toMaster << sharedPointValues;
359 fromMaster >> sharedPointValues;
372 sharedToMeshPoint.insert(sharedPtAddr[i], sharedPtLabels[i]);
379 sharedPointValues.
find(iter.key());
381 if (sharedFnd != sharedPointValues.
end())
383 pointValues.
set(iter(), sharedFnd());
390 template<
class T,
class CombineOp,
class TransformOp>
395 const CombineOp& cop,
396 const TransformOp& top
419 isA<processorPolyPatch>(patches[
patchi])
420 && patches[patchi].nEdges() > 0
424 refCast<const processorPolyPatch>(patches[
patchi]);
437 const edge&
e = edges[i];
441 edgeValues.
find(meshEdge);
443 if (iter != edgeValues.
end())
445 const edge nbrEdge(nbrPts[e[0]], nbrPts[e[1]]);
446 patchInfo.insert(nbrEdge, iter());
451 toNeighb << patchInfo;
463 isA<processorPolyPatch>(patches[
patchi])
464 && patches[patchi].nEdges() > 0
468 refCast<const processorPolyPatch>(patches[
patchi]);
473 fromNbr >> nbrPatchInfo;
477 top(procPatch, nbrPatchInfo);
485 const edge&
e = nbrIter.key();
506 if (isA<cyclicPolyPatch>(patches[
patchi]))
509 refCast<const cyclicPolyPatch>(patches[
patchi]);
511 if (cycPatch.
owner())
524 Map<T> half1Values(half0Values.size());
528 const edge& twoEdges = coupledEdges[i];
531 const edge& e0 = edgesA[twoEdges[0]];
532 const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
535 edgeValues.
find(meshEdge0);
537 if (iter != edgeValues.
end())
539 half0Values.insert(i, iter());
543 const edge& e1 = edgesB[twoEdges[1]];
544 const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
547 edgeValues.
find(meshEdge1);
549 if (iter != edgeValues.
end())
551 half1Values.insert(i, iter());
557 top(cycPatch, half1Values);
558 top(nbrPatch, half0Values);
565 const edge& twoEdges = coupledEdges[i];
570 if (half1Fnd != half1Values.end())
572 const edge& e0 = edgesA[twoEdges[0]];
573 const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
586 if (half0Fnd != half0Values.end())
588 const edge& e1 = edgesB[twoEdges[1]];
589 const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
617 meshToShared.insert(sharedPtLabels[i], sharedPtAddr[i]);
621 EdgeMap<T> sharedEdgeValues(meshToShared.size());
641 if (v0Fnd != meshToShared.
end())
645 if (v1Fnd != meshToShared.
end())
650 const edge sharedEdge(v0Fnd(), v1Fnd());
653 potentialSharedEdge.insert(sharedEdge, meshEdge);
656 edgeValues.
find(meshEdge);
658 if (edgeFnd != edgeValues.
end())
719 toSlave << sharedEdgeValues;
731 toMaster << sharedEdgeValues;
740 fromMaster >> sharedEdgeValues;
752 const edge& sharedEdge = iter.key();
757 sharedEdgeValues.
find(sharedEdge);
759 if (sharedFnd != sharedEdgeValues.
end())
991 template<
class T,
class CombineOp,
class TransformOp>
996 const CombineOp& cop,
998 const TransformOp& top
1004 <<
"Number of values " << pointValues.
size()
1005 <<
" is not equal to the number of points in the mesh " 1034 template<
class T,
class CombineOp,
class TransformOp>
1040 const CombineOp& cop,
1042 const TransformOp& top
1045 if (pointValues.
size() != meshPoints.
size())
1048 <<
"Number of values " << pointValues.
size()
1049 <<
" is not equal to the number of meshPoints " 1060 label pointi = meshPoints[i];
1062 if (iter != mpm.
end())
1064 cppFld[iter()] = pointValues[i];
1081 label pointi = meshPoints[i];
1083 if (iter != mpm.
end())
1085 pointValues[i] = cppFld[iter()];
1148 template<
class T,
class CombineOp,
class TransformOp>
1153 const CombineOp& cop,
1155 const TransformOp& top
1161 <<
"Number of values " << edgeValues.
size()
1162 <<
" is not equal to the number of edges in the mesh " 1187 edgeValues[meshEdges[i]] = cppFld[i];
1236 template<
class T,
class CombineOp,
class TransformOp>
1242 const CombineOp& cop,
1244 const TransformOp& top
1247 if (edgeValues.
size() != meshEdges.
size())
1250 <<
"Number of values " << edgeValues.
size()
1251 <<
" is not equal to the number of meshEdges " 1262 label edgeI = meshEdges[i];
1264 if (iter != mpm.
end())
1266 cppFld[iter()] = edgeValues[i];
1283 label edgeI = meshEdges[i];
1285 if (iter != mpm.
end())
1287 edgeValues[i] = cppFld[iter()];
1292 template<
class T,
class CombineOp,
class TransformOp>
1297 const CombineOp& cop,
1298 const TransformOp& top,
1304 if (faceValues.
size() != nBFaces)
1307 <<
"Number of values " << faceValues.
size()
1308 <<
" is not equal to the number of boundary faces in the mesh " 1324 isA<processorPolyPatch>(patches[
patchi])
1325 && patches[patchi].size() > 0
1329 refCast<const processorPolyPatch>(patches[
patchi]);
1334 toNbr << SubField<T>(faceValues, procPatch.size(), patchStart);
1348 isA<processorPolyPatch>(patches[
patchi])
1349 && patches[patchi].size() > 0
1353 refCast<const processorPolyPatch>(patches[
patchi]);
1355 Field<T> nbrPatchInfo(procPatch.size());
1358 fromNeighb >> nbrPatchInfo;
1360 top(procPatch, nbrPatchInfo);
1366 cop(faceValues[bFacei++], nbrPatchInfo[i]);
1375 if (isA<cyclicPolyPatch>(patches[
patchi]))
1378 refCast<const cyclicPolyPatch>(patches[
patchi]);
1380 if (cycPatch.
owner())
1387 label sz = cycPatch.size();
1391 top(nbrPatch, ownVals);
1394 top(cycPatch, nbrVals);
1396 label i0 = ownStart;
1399 cop(faceValues[i0++], nbrVals[i]);
1402 label i1 = nbrStart;
1405 cop(faceValues[i1++], ownVals[i]);
1415 template<
unsigned nBits,
class CombineOp>
1420 const CombineOp& cop,
1427 <<
"Number of values " << faceValues.
size()
1428 <<
" is not equal to the number of faces in the mesh " 1444 isA<processorPolyPatch>(patches[
patchi])
1445 && patches[patchi].size() > 0
1449 refCast<const processorPolyPatch>(patches[
patchi]);
1454 patchInfo[i] = faceValues[procPatch.
start()+i];
1471 isA<processorPolyPatch>(patches[
patchi])
1472 && patches[patchi].size() > 0
1476 refCast<const processorPolyPatch>(patches[
patchi]);
1481 fromNbr >> patchInfo;
1487 unsigned int patchVal = patchInfo[i];
1489 unsigned int faceVal = faceValues[meshFacei];
1490 cop(faceVal, patchVal);
1491 faceValues[meshFacei] = faceVal;
1500 if (isA<cyclicPolyPatch>(patches[
patchi]))
1503 refCast<const cyclicPolyPatch>(patches[
patchi]);
1505 if (cycPatch.
owner())
1510 for (
label i = 0; i < cycPatch.size(); i++)
1513 unsigned int val0 = faceValues[meshFace0];
1515 unsigned int val1 = faceValues[meshFace1];
1517 unsigned int t = val0;
1519 faceValues[meshFace0] = t;
1522 faceValues[meshFace1] = val1;
1541 <<
"Number of cell values " << cellData.
size()
1542 <<
" is not equal to the number of cells in the mesh " 1550 neighbourCellData.
setSize(nBnd);
1559 neighbourCellData[bFacei] = cellData[faceCells[i]];
1566 template<
unsigned nBits>
1577 template<
unsigned nBits,
class CombineOp>
1582 const CombineOp& cop,
1583 const unsigned int nullValue
1589 <<
"Number of values " << pointValues.
size()
1590 <<
" is not equal to the number of points in the mesh " 1600 cppFld[i] = pointValues[meshPoints[i]];
1615 pointValues[meshPoints[i]] = cppFld[i];
1620 template<
unsigned nBits,
class CombineOp>
1625 const CombineOp& cop,
1626 const unsigned int nullValue
1632 <<
"Number of values " << edgeValues.
size()
1633 <<
" is not equal to the number of edges in the mesh " 1643 cppFld[i] = edgeValues[meshEdges[i]];
1658 edgeValues[meshEdges[i]] = cppFld[i];
const fvPatchList & patches
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
const Map< label > & coupledPatchMeshEdgeMap() const
Return map from mesh edges to coupledPatch edges.
label nPoints() const
Return number of points supporting patch faces.
const labelListList & globalPointSlaves() const
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static int masterNo()
Process index of the master.
const labelList & nbrPoints() const
Return neighbour point labels. WIP.
const labelListList & globalPointTransformedSlaves() const
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
An STL-conforming const_iterator.
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
A face is a list of labels corresponding to mesh vertices.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
#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
static int firstSlave()
Process index of first slave.
HashTable< T, label, Hash< label > >::iterator iterator
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
void size(const label)
Override size to be inconsistent with allocated storage.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const distributionMap & globalEdgeSlavesMap() const
Template function to specify if the data of a type are contiguous.
static bool master(const label communicator=0)
Am I the master process.
const labelListList & globalEdgeSlaves() const
const cyclicPolyPatch & nbrPatch() const
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
Pre-declare related SubField type.
const edgeList & coupledEdges() const
Return connected edges (from patch local to neighbour patch local).
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
Neighbour processor patch.
Input inter-processor communications stream.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Input inter-processor communications stream operating on external buffer.
A list of faces which address into the list of points.
virtual bool owner() const
Does this side own the patch ?
label nGlobalPoints() const
Return number of globally shared points.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
A dynamically allocatable list of packed unsigned integers.
const labelUList & faceCells() const
Return face-cell addressing.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const globalMeshData & globalData() const
Return parallel info.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
virtual const faceList & faces() const
Return raw faces.
int neighbProcNo() const
Return neighbour processor number.
errorManip< error > abort(error &err)
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.
Output inter-processor communications stream operating on external buffer.
label nEdges() const
Return number of edges in patch.
Map from edge (expressed as its endpoints) to value.
static void syncData(List< Type > &pointData, const labelListList &slaves, const labelListList &transformedSlaves, const distributionMap &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
Output inter-processor communications stream.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
edge meshEdge(const PrimitivePatch< FaceList, PointField > &p, const label edgei)
void setSize(const label)
Reset size of List.
bool set(const label &, const T &newElmt)
Assign a new hashedEntry, overwriting existing entries.
Class containing processor-to-processor mapping information.
static bool & parRun()
Is this a parallel run?
const distributionMap & globalPointSlavesMap() const
A List with indirect addressing.
label start() const
Return start label of this patch in the polyMesh face list.
void resize(const label newSize)
Resize the hash table for efficiency.
const doubleScalar e
Elementary charge.
label size() const
Number of entries.
Mesh consisting of general polyhedral cells.
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.
friend class iterator
Declare friendship with the iterator.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
static int lastSlave(const label communicator=0)
Process index of last slave.
A HashTable to objects of type <T> with a label key.
const labelListList & globalEdgeTransformedSlaves() const
void syncPointData(List< Type > &pointData, const CombineOp &cop, const TransformOp &top) const
Helper to synchronise coupled patch point data.