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())
158 pointValues.
find(meshPts[i]);
160 if (iter != pointValues.
end())
162 patchInfo.
insert(nbrPts[i], iter());
167 toNeighb << patchInfo;
187 Map<T> nbrPatchInfo(fromNb);
190 top(procPatch, nbrPatchInfo);
201 meshPts[nbrIter.key()],
217 if (cycPatch.
owner())
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
437 const edge&
e = edges[i];
443 if (iter != edgeValues.
end())
445 const edge nbrEdge(nbrPts[
e[0]], nbrPts[
e[1]]);
446 patchInfo.
insert(nbrEdge, iter());
451 toNeighb << patchInfo;
473 fromNbr >> nbrPatchInfo;
477 top(procPatch, nbrPatchInfo);
485 const edge&
e = nbrIter.key();
511 if (cycPatch.
owner())
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]);
641 if (v0Fnd != meshToShared.
end())
645 if (v1Fnd != meshToShared.
end())
650 const edge sharedEdge(v0Fnd(), v1Fnd());
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 "
1334 toNbr << SubField<T>(faceValues, procPatch.
size(), patchStart);
1358 fromNeighb >> nbrPatchInfo;
1360 top(procPatch, nbrPatchInfo);
1366 cop(faceValues[bFacei++], nbrPatchInfo[i]);
1380 if (cycPatch.
owner())
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 "
1454 patchInfo[i] = faceValues[procPatch.
start()+i];
1481 fromNbr >> patchInfo;
1487 unsigned int patchVal = patchInfo[i];
1489 unsigned int faceVal = faceValues[meshFacei];
1490 cop(faceVal, patchVal);
1491 faceValues[meshFacei] = faceVal;
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];
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Map from edge (expressed as its endpoints) to value.
bool set(const Key &, const T &newElmt)
Set a new hashedEntry, overwriting existing entries.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
friend class iterator
Declare friendship with the iterator.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void resize(const label newSize)
Resize the hash table for efficiency.
Input inter-processor communications stream.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
A HashTable to objects of type <T> with a label key.
Output inter-processor communications stream.
A dynamically allocatable list of packed unsigned integers.
label size() const
Number of entries.
label nEdges() const
Return number of edges in patch.
label nPoints() const
Return number of points supporting patch faces.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
Pre-declare related SubField type.
Input inter-processor communications stream operating on external buffer.
A List with indirect addressing.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label size() const
Return the number of elements in the UList.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Output inter-processor communications stream operating on external buffer.
static int masterNo()
Process index of the master.
static bool master(const label communicator=0)
Am I the master process.
static int lastSlave(const label communicator=0)
Process index of last slave.
static int firstSlave()
Process index of first slave.
static bool & parRun()
Is this a parallel run?
const cyclicPolyPatch & nbrPatch() const
virtual bool owner() const
Does this side own the patch ?
const edgeList & coupledEdges() const
Return connected edges (from patch local to neighbour patch local).
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
label constructSize() const
Constructed data size.
Class containing processor-to-processor mapping information.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
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.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
const labelListList & globalEdgeTransformedSlaves() const
const Map< label > & coupledPatchMeshEdgeMap() const
Return map from mesh edges to coupledPatch edges.
label nGlobalPoints() const
Return number of globally shared points.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
const distributionMap & globalEdgeSlavesMap() const
const distributionMap & globalPointSlavesMap() const
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
void syncPointData(List< Type > &pointData, const CombineOp &cop, const TransformOp &top) const
Helper to synchronise coupled patch point data.
const labelListList & globalPointSlaves() const
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
const labelListList & globalPointTransformedSlaves() const
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
const labelListList & globalEdgeSlaves() const
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
const globalMeshData & globalData() const
Return parallel info.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
const labelUList & faceCells() const
Return face-cell addressing.
label nInternalFaces() const
Neighbour processor patch.
int neighbProcNo() const
Return neighbour processor number.
const labelList & nbrPoints() const
Return neighbour point labels. WIP.
Template function to specify if the data of a type are contiguous.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManip< error > abort(error &err)
edge meshEdge(const PrimitivePatch< FaceList, PointField > &p, const label edgei)
treeBoundBox combine(const treeBoundBox &a, const treeBoundBox &b)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable