33 bool Foam::syncTools::hasCouples(
const polyBoundaryMesh&
patches)
35 bool hasAnyCouples =
false;
39 if (patches[patchI].coupled())
49 void Foam::syncTools::checkTransform
51 const coupledPolyPatch& pp,
52 const bool applySeparation
55 if (!pp.parallel() && pp.forwardT().size() > 1)
57 FatalErrorIn(
"syncTools::checkTransform(const coupledPolyPatch&)")
58 <<
"Non-uniform transformation not supported for point or edge"
60 <<
"Patch:" << pp.
name()
63 if (applySeparation && pp.separated() && pp.separation().size() > 1)
65 FatalErrorIn(
"syncTools::checkTransform(const coupledPolyPatch&)")
66 <<
"Non-uniform separation vector not supported for point or edge"
68 <<
"Patch:" << pp.
name()
101 isMasterPoint.set(sharedPointLabels[i], 1u);
103 donePoint.set(sharedPointLabels[i], 1u);
114 if (patches[patchI].coupled())
119 && isA<processorPolyPatch>(patches[patchI])
123 refCast<const processorPolyPatch>(patches[patchI]);
129 label pointI = meshPoints[i];
131 if (donePoint.get(pointI) == 0u)
133 donePoint.set(pointI, 1u);
137 isMasterPoint.set(pointI, 1u);
142 else if (isA<cyclicPolyPatch>(patches[patchI]))
145 refCast<const cyclicPolyPatch>(patches[patchI]);
154 const edge& pointPair = coupledPoints[i];
155 label p0 = meshPoints[pointPair[0]];
156 label p1 = meshPoints[pointPair[1]];
158 if (donePoint.get(p0) == 0u)
160 donePoint.set(p0, 1u);
161 isMasterPoint.set(p0, 1u);
162 donePoint.set(p1, 1u);
168 FatalErrorIn(
"syncTools::getMasterPoints(const polyMesh&)")
169 <<
"Cannot handle coupled patch " << patches[patchI].
name()
170 <<
" of type " << patches[patchI].type()
182 if (donePoint.get(pointI) == 0u)
184 donePoint.set(pointI, 1u);
185 isMasterPoint.set(pointI, 1u);
189 return isMasterPoint;
220 isMasterEdge.set(sharedEdgeLabels[i], 1u);
222 doneEdge.set(sharedEdgeLabels[i], 1u);
233 if (patches[patchI].coupled())
238 && isA<processorPolyPatch>(patches[patchI])
242 refCast<const processorPolyPatch>(patches[patchI]);
248 label edgeI = meshEdges[i];
250 if (doneEdge.get(edgeI) == 0u)
252 doneEdge.set(edgeI, 1u);
256 isMasterEdge.set(edgeI, 1u);
261 else if (isA<cyclicPolyPatch>(patches[patchI]))
264 refCast<const cyclicPolyPatch>(patches[patchI]);
273 const edge& edgePair = coupledEdges[i];
274 label e0 = meshEdges[edgePair[0]];
275 label e1 = meshEdges[edgePair[1]];
277 if (doneEdge.get(e0) == 0u)
279 doneEdge.set(e0, 1u);
280 isMasterEdge.set(e0, 1u);
281 doneEdge.set(e1, 1u);
287 FatalErrorIn(
"syncTools::getMasterEdges(const polyMesh&)")
288 <<
"Cannot handle coupled patch " << patches[patchI].
name()
289 <<
" of type " << patches[patchI].type()
301 if (doneEdge.get(edgeI) == 0u)
303 doneEdge.set(edgeI, 1u);
304 isMasterEdge.set(edgeI, 1u);
321 if (patches[patchI].coupled())
326 refCast<const processorPolyPatch>(patches[patchI]);
332 isMasterFace.set(pp.
start()+i, 0);
336 else if (isA<cyclicPolyPatch>(patches[patchI]))
339 refCast<const cyclicPolyPatch>(patches[patchI]);
341 for (label i = pp.size()/2; i < pp.size(); i++)
343 isMasterFace.set(pp.
start()+i, 0);
348 FatalErrorIn(
"syncTools::getMasterFaces(const polyMesh&)")
349 <<
"Cannot handle coupled patch " << patches[patchI].name()
350 <<
" of type " << patches[patchI].type()
361 void Foam::syncTools::separateList
367 if (separation.
size() == 1)
373 field[i] += separation[0];
376 else if (separation.
size() == field.
size())
380 field[i] += separation[i];
387 "syncTools::separateList(const vectorField&, UList<vector>&)"
388 ) <<
"Sizes of field and transformation not equal. field:"
389 << field.
size() <<
" transformation:" << separation.
size()
396 void Foam::syncTools::separateList
402 if (separation.
size() == 1)
407 iter() += separation[0];
410 else if (separation.
size() == field.
size())
414 iter() += separation[iter.key()];
421 "syncTools::separateList(const vectorField&, Map<vector>&)"
422 ) <<
"Sizes of field and transformation not equal. field:"
423 << field.
size() <<
" transformation:" << separation.
size()
430 void Foam::syncTools::separateList
436 if (separation.
size() == 1)
441 iter() += separation[0];
448 "syncTools::separateList(const vectorField&, EdgeMap<vector>&)"
449 ) <<
"Multiple separation vectors not supported. field:"
450 << field.
size() <<
" transformation:" << separation.
size()