38 template<
class T,
class CombineOp>
39 void Foam::syncTools::combine
49 if (iter != pointValues.end())
55 pointValues.insert(index, val);
60 template<
class T,
class CombineOp>
61 void Foam::syncTools::combine
63 EdgeMap<T>& edgeValues,
71 if (iter != edgeValues.end())
77 edgeValues.insert(index, val);
82 template<
class T,
class CombineOp,
class TransformOp>
88 const TransformOp& top
97 Map<T> sharedPointValues(0);
106 sharedPointValues.
resize(sharedPtAddr.
size());
111 label meshPointi = sharedPtLabels[i];
114 pointValues.
find(meshPointi);
116 if (fnd != pointValues.
end())
140 isA<processorPolyPatch>(patches[
patchi])
141 && patches[patchi].
nPoints() > 0
145 refCast<const processorPolyPatch>(patches[
patchi]);
154 Map<T> patchInfo(meshPts.size() / 20);
159 pointValues.
find(meshPts[i]);
161 if (iter != pointValues.
end())
163 patchInfo.insert(nbrPts[i], iter());
168 toNeighb << patchInfo;
180 isA<processorPolyPatch>(patches[
patchi])
181 && patches[patchi].
nPoints() > 0
185 refCast<const processorPolyPatch>(patches[
patchi]);
188 Map<T> nbrPatchInfo(fromNb);
191 top(procPatch, nbrPatchInfo);
202 meshPts[nbrIter.key()],
213 if (isA<cyclicPolyPatch>(patches[
patchi]))
216 refCast<const cyclicPolyPatch>(patches[
patchi]);
218 if (cycPatch.
owner())
229 Map<T> half1Values(half0Values.size());
233 const edge&
e = coupledPoints[i];
236 pointValues.
find(meshPtsA[e[0]]);
238 if (point0Fnd != pointValues.
end())
240 half0Values.insert(i, point0Fnd());
244 pointValues.
find(meshPtsB[e[1]]);
246 if (point1Fnd != pointValues.
end())
248 half1Values.insert(i, point1Fnd());
253 top(cycPatch, half1Values);
254 top(nbrPatch, half0Values);
258 const edge&
e = coupledPoints[i];
263 if (half0Fnd != half0Values.end())
277 if (half1Fnd != half1Values.end())
315 Map<T> nbrValues(fromSlave);
339 toSlave << sharedPointValues;
347 toMaster << sharedPointValues;
356 fromMaster >> sharedPointValues;
369 sharedToMeshPoint.insert(sharedPtAddr[i], sharedPtLabels[i]);
376 sharedPointValues.
find(iter.key());
378 if (sharedFnd != sharedPointValues.
end())
380 pointValues.
set(iter(), sharedFnd());
387 template<
class T,
class CombineOp,
class TransformOp>
392 const CombineOp& cop,
393 const TransformOp& top
416 isA<processorPolyPatch>(patches[
patchi])
417 && patches[patchi].nEdges() > 0
421 refCast<const processorPolyPatch>(patches[
patchi]);
434 const edge&
e = edges[i];
435 const edge meshEdge(meshPts[e[0]], meshPts[e[1]]);
438 edgeValues.
find(meshEdge);
440 if (iter != edgeValues.
end())
442 const edge nbrEdge(nbrPts[e[0]], nbrPts[e[1]]);
443 patchInfo.insert(nbrEdge, iter());
448 toNeighb << patchInfo;
460 isA<processorPolyPatch>(patches[
patchi])
461 && patches[patchi].nEdges() > 0
465 refCast<const processorPolyPatch>(patches[
patchi]);
470 fromNbr >> nbrPatchInfo;
474 top(procPatch, nbrPatchInfo);
482 const edge&
e = nbrIter.key();
483 const edge meshEdge(meshPts[e[0]], meshPts[e[1]]);
503 if (isA<cyclicPolyPatch>(patches[
patchi]))
506 refCast<const cyclicPolyPatch>(patches[
patchi]);
508 if (cycPatch.
owner())
521 Map<T> half1Values(half0Values.size());
525 const edge& twoEdges = coupledEdges[i];
528 const edge& e0 = edgesA[twoEdges[0]];
529 const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
532 edgeValues.
find(meshEdge0);
534 if (iter != edgeValues.
end())
536 half0Values.insert(i, iter());
540 const edge& e1 = edgesB[twoEdges[1]];
541 const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
544 edgeValues.
find(meshEdge1);
546 if (iter != edgeValues.
end())
548 half1Values.insert(i, iter());
554 top(cycPatch, half1Values);
555 top(nbrPatch, half0Values);
562 const edge& twoEdges = coupledEdges[i];
567 if (half1Fnd != half1Values.end())
569 const edge& e0 = edgesA[twoEdges[0]];
570 const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
583 if (half0Fnd != half0Values.end())
585 const edge& e1 = edgesB[twoEdges[1]];
586 const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
614 meshToShared.insert(sharedPtLabels[i], sharedPtAddr[i]);
618 EdgeMap<T> sharedEdgeValues(meshToShared.size());
638 if (v0Fnd != meshToShared.
end())
642 if (v1Fnd != meshToShared.
end())
644 const edge meshEdge(v0, v1);
647 const edge sharedEdge(v0Fnd(), v1Fnd());
650 potentialSharedEdge.insert(sharedEdge, meshEdge);
653 edgeValues.
find(meshEdge);
655 if (edgeFnd != edgeValues.
end())
716 toSlave << sharedEdgeValues;
724 toMaster << sharedEdgeValues;
729 fromMaster >> sharedEdgeValues;
741 const edge& sharedEdge = iter.key();
742 const edge& meshEdge = iter();
746 sharedEdgeValues.
find(sharedEdge);
748 if (sharedFnd != sharedEdgeValues.
end())
980 template<
class T,
class CombineOp,
class TransformOp>
985 const CombineOp& cop,
987 const TransformOp& top
993 <<
"Number of values " << pointValues.
size()
994 <<
" is not equal to the number of points in the mesh " 1023 template<
class T,
class CombineOp,
class TransformOp>
1029 const CombineOp& cop,
1031 const TransformOp& top
1034 if (pointValues.
size() != meshPoints.
size())
1037 <<
"Number of values " << pointValues.
size()
1038 <<
" is not equal to the number of meshPoints " 1049 label pointi = meshPoints[i];
1051 if (iter != mpm.
end())
1053 cppFld[iter()] = pointValues[i];
1070 label pointi = meshPoints[i];
1072 if (iter != mpm.
end())
1074 pointValues[i] = cppFld[iter()];
1137 template<
class T,
class CombineOp,
class TransformOp>
1142 const CombineOp& cop,
1144 const TransformOp& top
1150 <<
"Number of values " << edgeValues.
size()
1151 <<
" is not equal to the number of edges in the mesh " 1176 edgeValues[meshEdges[i]] = cppFld[i];
1225 template<
class T,
class CombineOp,
class TransformOp>
1231 const CombineOp& cop,
1233 const TransformOp& top
1236 if (edgeValues.
size() != meshEdges.
size())
1239 <<
"Number of values " << edgeValues.
size()
1240 <<
" is not equal to the number of meshEdges " 1251 label edgeI = meshEdges[i];
1253 if (iter != mpm.
end())
1255 cppFld[iter()] = edgeValues[i];
1272 label edgeI = meshEdges[i];
1274 if (iter != mpm.
end())
1276 edgeValues[i] = cppFld[iter()];
1281 template<
class T,
class CombineOp,
class TransformOp>
1286 const CombineOp& cop,
1287 const TransformOp& top,
1293 if (faceValues.
size() != nBFaces)
1296 <<
"Number of values " << faceValues.
size()
1297 <<
" is not equal to the number of boundary faces in the mesh " 1313 isA<processorPolyPatch>(patches[
patchi])
1314 && patches[patchi].size() > 0
1318 refCast<const processorPolyPatch>(patches[
patchi]);
1323 toNbr << SubField<T>(faceValues, procPatch.size(), patchStart);
1337 isA<processorPolyPatch>(patches[
patchi])
1338 && patches[patchi].size() > 0
1342 refCast<const processorPolyPatch>(patches[
patchi]);
1344 Field<T> nbrPatchInfo(procPatch.size());
1347 fromNeighb >> nbrPatchInfo;
1349 top(procPatch, nbrPatchInfo);
1355 cop(faceValues[bFacei++], nbrPatchInfo[i]);
1364 if (isA<cyclicPolyPatch>(patches[
patchi]))
1367 refCast<const cyclicPolyPatch>(patches[
patchi]);
1369 if (cycPatch.
owner())
1376 label sz = cycPatch.size();
1380 top(nbrPatch, ownVals);
1383 top(cycPatch, nbrVals);
1385 label i0 = ownStart;
1388 cop(faceValues[i0++], nbrVals[i]);
1391 label i1 = nbrStart;
1394 cop(faceValues[i1++], ownVals[i]);
1404 template<
unsigned nBits,
class CombineOp>
1409 const CombineOp& cop,
1416 <<
"Number of values " << faceValues.
size()
1417 <<
" is not equal to the number of faces in the mesh " 1433 isA<processorPolyPatch>(patches[
patchi])
1434 && patches[patchi].size() > 0
1438 refCast<const processorPolyPatch>(patches[
patchi]);
1443 patchInfo[i] = faceValues[procPatch.
start()+i];
1460 isA<processorPolyPatch>(patches[
patchi])
1461 && patches[patchi].size() > 0
1465 refCast<const processorPolyPatch>(patches[
patchi]);
1470 fromNbr >> patchInfo;
1476 unsigned int patchVal = patchInfo[i];
1478 unsigned int faceVal = faceValues[meshFacei];
1479 cop(faceVal, patchVal);
1480 faceValues[meshFacei] = faceVal;
1489 if (isA<cyclicPolyPatch>(patches[
patchi]))
1492 refCast<const cyclicPolyPatch>(patches[
patchi]);
1494 if (cycPatch.
owner())
1499 for (
label i = 0; i < cycPatch.size(); i++)
1502 unsigned int val0 = faceValues[meshFace0];
1504 unsigned int val1 = faceValues[meshFace1];
1506 unsigned int t = val0;
1508 faceValues[meshFace0] = t;
1511 faceValues[meshFace1] = val1;
1530 <<
"Number of cell values " << cellData.
size()
1531 <<
" is not equal to the number of cells in the mesh " 1539 neighbourCellData.
setSize(nBnd);
1548 neighbourCellData[bFacei] = cellData[faceCells[i]];
1555 template<
unsigned nBits>
1566 template<
unsigned nBits,
class CombineOp>
1571 const CombineOp& cop,
1572 const unsigned int nullValue
1578 <<
"Number of values " << pointValues.
size()
1579 <<
" is not equal to the number of points in the mesh " 1589 cppFld[i] = pointValues[meshPoints[i]];
1604 pointValues[meshPoints[i]] = cppFld[i];
1609 template<
unsigned nBits,
class CombineOp>
1614 const CombineOp& cop,
1615 const unsigned int nullValue
1621 <<
"Number of values " << edgeValues.
size()
1622 <<
" is not equal to the number of edges in the mesh " 1632 cppFld[i] = edgeValues[meshEdges[i]];
1647 edgeValues[meshEdges[i]] = cppFld[i];
const cyclicPolyPatch & neighbPatch() const
label nPoints() const
Return number of points supporting patch faces.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
#define forAll(list, i)
Loop across all elements in list.
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
intWM_LABEL_SIZE_t 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.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
An STL-conforming const_iterator.
A face is a list of labels corresponding to mesh vertices.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
const double e
Elementary charge.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static int firstSlave()
Process index of first slave.
HashTable< T, label, Hash< label > >::iterator iterator
const mapDistribute & globalPointSlavesMap() const
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
int neighbProcNo() const
Return neigbour processor number.
void size(const label)
Override size to be inconsistent with allocated storage.
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 Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
Pre-declare related SubField type.
const labelListList & globalPointSlaves() const
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Neighbour processor patch.
Input inter-processor communications stream.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
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.
label start() const
Return start label of this patch in the polyMesh face list.
A dynamically allocatable list of packed unsigned integers.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const edgeList & coupledEdges() const
Return connected edges (from patch local to neighbour patch local).
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
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...
const mapDistribute & globalEdgeSlavesMap() const
const globalMeshData & globalData() const
Return parallel info.
Output inter-processor communications stream operating on external buffer.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
Map from edge (expressed as its endpoints) to value.
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
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 labelListList & globalEdgeTransformedSlaves() const
label nEdges() const
Return number of edges in patch.
static void syncData(List< Type > &pointData, const labelListList &slaves, const labelListList &transformedSlaves, const mapDistribute &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
label size() const
Return the number of elements in the UList.
void setSize(const label)
Reset size of List.
bool set(const label &, const T &newElmt)
Assign a new hashedEntry, overwriting existing entries.
const labelListList & globalPointTransformedSlaves() const
static bool & parRun()
Is this a parallel run?
Class containing processor-to-processor mapping information.
const labelUList & faceCells() const
Return face-cell addressing.
A List with indirect addressing.
const labelListList & globalEdgeSlaves() const
const labelList & neighbPoints() const
Return neighbour point labels. WIP.
virtual bool owner() const
Does this side own the patch ?
void resize(const label newSize)
Resize the hash table for efficiency.
Mesh consisting of general polyhedral cells.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
A patch is a list of labels that address the faces in the global face list.
const Map< label > & coupledPatchMeshEdgeMap() const
Return map from mesh edges to coupledPatch edges.
friend class iterator
Declare friendship with the iterator.
virtual const faceList & faces() const
Return raw faces.
label constructSize() const
Constructed data size.
label size() const
Number of entries.
Combine operator for AMIInterpolation.
label nGlobalPoints() const
Return number of globally shared points.
void syncPointData(List< Type > &pointData, const CombineOp &cop, const TransformOp &top) const
Helper to synchronise coupled patch point data.
label nInternalFaces() const
static int lastSlave(const label communicator=0)
Process index of last slave.
A HashTable to objects of type <T> with a label key.