ENH: use concise forms for walking processor and cyclic boundaries
This commit is contained in:
parent
f24e3f113f
commit
6cdf89dced
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -82,25 +83,15 @@ void Foam::conformalVoronoiMesh::selectSeparatedCoupledFaces
|
||||
boolList& selected
|
||||
) const
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(patches, patchi)
|
||||
for (const polyPatch& pp : mesh.boundaryMesh())
|
||||
{
|
||||
// Check all coupled. Avoid using .coupled() so we also pick up AMI.
|
||||
if (isA<coupledPolyPatch>(patches[patchi]))
|
||||
{
|
||||
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[patchi]
|
||||
);
|
||||
|
||||
if (cpp.separated() || !cpp.parallel())
|
||||
{
|
||||
forAll(cpp, i)
|
||||
{
|
||||
selected[cpp.start()+i] = true;
|
||||
}
|
||||
}
|
||||
const auto* cpp = isA<coupledPolyPatch>(patches[patchi]);
|
||||
|
||||
if (cpp && (cpp->separated() || !cpp->parallel())
|
||||
{
|
||||
SubList<bool>(selected, pp.size(), pp.start()) = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -205,18 +205,14 @@ void filterPatches(polyMesh& mesh, const wordHashSet& addedPatchNames)
|
||||
// Dump for all patches the current match
|
||||
void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(patches, patchi)
|
||||
for (const polyPatch& pp : mesh.boundaryMesh())
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<cyclicPolyPatch>(patches[patchi])
|
||||
&& refCast<const cyclicPolyPatch>(patches[patchi]).owner()
|
||||
)
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchi]);
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
// Dump patches
|
||||
{
|
||||
@ -231,7 +227,6 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
|
||||
);
|
||||
}
|
||||
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
{
|
||||
OFstream str(prefix+nbrPatch.name()+".obj");
|
||||
Pout<< "Dumping " << nbrPatch.name()
|
||||
@ -325,22 +320,16 @@ void syncPoints
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Send
|
||||
const labelList& procPatches = mesh.globalData().processorPatches();
|
||||
|
||||
forAll(patches, patchi)
|
||||
// Send
|
||||
for (const label patchi : procPatches)
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
const auto& procPatch = refCast<const processorPolyPatch>(pp);
|
||||
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(pp)
|
||||
&& pp.nPoints() > 0
|
||||
&& refCast<const processorPolyPatch>(pp).owner()
|
||||
)
|
||||
if (pp.nPoints() && procPatch.owner())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
|
||||
// Get data per patchPoint in neighbouring point numbers.
|
||||
pointField patchInfo(procPatch.nPoints(), nullValue);
|
||||
|
||||
@ -368,20 +357,13 @@ void syncPoints
|
||||
|
||||
// Receive and set.
|
||||
|
||||
forAll(patches, patchi)
|
||||
for (const label patchi : procPatches)
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
const auto& procPatch = refCast<const processorPolyPatch>(pp);
|
||||
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(pp)
|
||||
&& pp.nPoints() > 0
|
||||
&& !refCast<const processorPolyPatch>(pp).owner()
|
||||
)
|
||||
if (pp.nPoints() && !procPatch.owner())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
|
||||
pointField nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
// We do not know the number of points on the other side
|
||||
@ -419,22 +401,19 @@ void syncPoints
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
forAll(patches, patchi)
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if
|
||||
(
|
||||
isA<cyclicPolyPatch>(pp)
|
||||
&& refCast<const cyclicPolyPatch>(pp).owner()
|
||||
)
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
// Owner does all.
|
||||
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPts = cycPatch.meshPoints();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshPts = nbrPatch.meshPoints();
|
||||
|
||||
pointField half0Values(coupledPoints.size());
|
||||
|
@ -117,39 +117,37 @@ void writeWeights(const polyMesh& mesh)
|
||||
|
||||
for (const polyPatch& pp : mesh.boundaryMesh())
|
||||
{
|
||||
if (isA<cyclicAMIPolyPatch>(pp))
|
||||
const auto* cpp = isA<cyclicAMIPolyPatch>(pp);
|
||||
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
const cyclicAMIPolyPatch& cpp =
|
||||
refCast<const cyclicAMIPolyPatch>(pp);
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
if (cpp.owner())
|
||||
{
|
||||
Info<< "Calculating AMI weights between owner patch: "
|
||||
<< cpp.name() << " and neighbour patch: "
|
||||
<< cpp.neighbPatch().name() << endl;
|
||||
const AMIPatchToPatchInterpolation& ami = cycPatch.AMI();
|
||||
|
||||
const AMIPatchToPatchInterpolation& ami =
|
||||
cpp.AMI();
|
||||
Info<< "Calculating AMI weights between owner patch: "
|
||||
<< cycPatch.name() << " and neighbour patch: "
|
||||
<< nbrPatch.name() << endl;
|
||||
|
||||
writeWeights
|
||||
(
|
||||
mesh,
|
||||
ami.tgtWeightsSum(),
|
||||
cpp.neighbPatch(),
|
||||
outputDir,
|
||||
"patch" + Foam::name(pp.index()) + "-tgt",
|
||||
mesh.time()
|
||||
);
|
||||
writeWeights
|
||||
(
|
||||
mesh,
|
||||
ami.srcWeightsSum(),
|
||||
cpp,
|
||||
outputDir,
|
||||
"patch" + Foam::name(pp.index()) + "-src",
|
||||
mesh.time()
|
||||
);
|
||||
}
|
||||
writeWeights
|
||||
(
|
||||
mesh,
|
||||
ami.tgtWeightsSum(),
|
||||
nbrPatch,
|
||||
outputDir,
|
||||
"patch" + Foam::name(pp.index()) + "-tgt",
|
||||
mesh.time()
|
||||
);
|
||||
writeWeights
|
||||
(
|
||||
mesh,
|
||||
ami.srcWeightsSum(),
|
||||
cycPatch,
|
||||
outputDir,
|
||||
"patch" + Foam::name(pp.index()) + "-src",
|
||||
mesh.time()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -44,22 +45,18 @@ void Foam::domainDecomposition::processInterCyclics
|
||||
// Processor boundaries from split cyclics
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchi]))
|
||||
{
|
||||
const cyclicPolyPatch& pp = refCast<const cyclicPolyPatch>
|
||||
(
|
||||
patches[patchi]
|
||||
);
|
||||
const auto& pp = patches[patchi];
|
||||
const auto* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (pp.owner() != owner)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (cpp && cpp->owner() == owner)
|
||||
{
|
||||
// cyclic: check opposite side on this processor
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
// cyclic: check opposite side on this processor
|
||||
const labelUList& patchFaceCells = pp.faceCells();
|
||||
const labelUList& nbrPatchFaceCells =
|
||||
pp.neighbPatch().faceCells();
|
||||
const labelUList& nbrPatchFaceCells = nbrPatch.faceCells();
|
||||
|
||||
// Store old sizes. Used to detect which inter-proc patches
|
||||
// have been added to.
|
||||
|
@ -130,13 +130,13 @@ void Foam::syncTools::syncPointMap
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.nPoints() > 0)
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.nPoints())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
// Get data per patchPoint in neighbouring point numbers.
|
||||
|
||||
@ -165,13 +165,13 @@ void Foam::syncTools::syncPointMap
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.nPoints() > 0)
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.nPoints())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
Map<T> nbrPatchInfo(fromNbr);
|
||||
@ -199,76 +199,74 @@ void Foam::syncTools::syncPointMap
|
||||
// Do the cyclics.
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
// Owner does all.
|
||||
|
||||
if (cycPatch.owner())
|
||||
const cyclicPolyPatch& cycPatch = *cpp;
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPtsA = cycPatch.meshPoints();
|
||||
const labelList& meshPtsB = nbrPatch.meshPoints();
|
||||
|
||||
// Extract local values. Create map from coupled-edge to value.
|
||||
Map<T> half0Values(meshPtsA.size() / 20);
|
||||
Map<T> half1Values(half0Values.size());
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
// Owner does all.
|
||||
const edge& e = coupledPoints[i];
|
||||
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPtsA = cycPatch.meshPoints();
|
||||
const labelList& meshPtsB = nbrPatch.meshPoints();
|
||||
const auto point0Fnd = pointValues.cfind(meshPtsA[e[0]]);
|
||||
|
||||
// Extract local values. Create map from coupled-edge to value.
|
||||
Map<T> half0Values(meshPtsA.size() / 20);
|
||||
Map<T> half1Values(half0Values.size());
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
if (point0Fnd.found())
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
|
||||
const auto point0Fnd = pointValues.cfind(meshPtsA[e[0]]);
|
||||
|
||||
if (point0Fnd.found())
|
||||
{
|
||||
half0Values.insert(i, *point0Fnd);
|
||||
}
|
||||
|
||||
const auto point1Fnd = pointValues.cfind(meshPtsB[e[1]]);
|
||||
|
||||
if (point1Fnd.found())
|
||||
{
|
||||
half1Values.insert(i, *point1Fnd);
|
||||
}
|
||||
half0Values.insert(i, *point0Fnd);
|
||||
}
|
||||
|
||||
// Transform to receiving side
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
const auto point1Fnd = pointValues.cfind(meshPtsB[e[1]]);
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
if (point1Fnd.found())
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
half1Values.insert(i, *point1Fnd);
|
||||
}
|
||||
}
|
||||
|
||||
const auto half0Fnd = half0Values.cfind(i);
|
||||
// Transform to receiving side
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
if (half0Fnd.found())
|
||||
{
|
||||
combine
|
||||
(
|
||||
pointValues,
|
||||
cop,
|
||||
meshPtsB[e[1]],
|
||||
*half0Fnd
|
||||
);
|
||||
}
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
|
||||
const auto half1Fnd = half1Values.cfind(i);
|
||||
const auto half0Fnd = half0Values.cfind(i);
|
||||
|
||||
if (half1Fnd.found())
|
||||
{
|
||||
combine
|
||||
(
|
||||
pointValues,
|
||||
cop,
|
||||
meshPtsA[e[0]],
|
||||
*half1Fnd
|
||||
);
|
||||
}
|
||||
if (half0Fnd.found())
|
||||
{
|
||||
combine
|
||||
(
|
||||
pointValues,
|
||||
cop,
|
||||
meshPtsB[e[1]],
|
||||
*half0Fnd
|
||||
);
|
||||
}
|
||||
|
||||
const auto half1Fnd = half1Values.cfind(i);
|
||||
|
||||
if (half1Fnd.found())
|
||||
{
|
||||
combine
|
||||
(
|
||||
pointValues,
|
||||
cop,
|
||||
meshPtsA[e[0]],
|
||||
*half1Fnd
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -386,14 +384,13 @@ void Foam::syncTools::syncEdgeMap
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.nEdges() > 0)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.nEdges())
|
||||
{
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
// Get data per patch edge in neighbouring edge.
|
||||
|
||||
@ -424,13 +421,13 @@ void Foam::syncTools::syncEdgeMap
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.nEdges() > 0)
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.nEdges())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
EdgeMap<T> nbrPatchInfo;
|
||||
{
|
||||
@ -468,96 +465,96 @@ void Foam::syncTools::syncEdgeMap
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
// Owner does all.
|
||||
|
||||
if (cycPatch.owner())
|
||||
const cyclicPolyPatch& cycPatch = *cpp;
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
const edgeList& coupledEdges = cycPatch.coupledEdges();
|
||||
|
||||
const labelList& meshPtsA = cycPatch.meshPoints();
|
||||
const edgeList& edgesA = cycPatch.edges();
|
||||
|
||||
const labelList& meshPtsB = nbrPatch.meshPoints();
|
||||
const edgeList& edgesB = nbrPatch.edges();
|
||||
|
||||
// Extract local values. Create map from edge to value.
|
||||
Map<T> half0Values(edgesA.size() / 20);
|
||||
Map<T> half1Values(half0Values.size());
|
||||
|
||||
forAll(coupledEdges, edgei)
|
||||
{
|
||||
// Owner does all.
|
||||
const edge& twoEdges = coupledEdges[edgei];
|
||||
|
||||
const edgeList& coupledEdges = cycPatch.coupledEdges();
|
||||
const labelList& meshPtsA = cycPatch.meshPoints();
|
||||
const edgeList& edgesA = cycPatch.edges();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& meshPtsB = nbrPatch.meshPoints();
|
||||
const edgeList& edgesB = nbrPatch.edges();
|
||||
|
||||
// Extract local values. Create map from edge to value.
|
||||
Map<T> half0Values(edgesA.size() / 20);
|
||||
Map<T> half1Values(half0Values.size());
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
const edge& twoEdges = coupledEdges[i];
|
||||
const edge& e0 = edgesA[twoEdges[0]];
|
||||
const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
|
||||
|
||||
const auto iter = edgeValues.cfind(meshEdge0);
|
||||
|
||||
if (iter.found())
|
||||
{
|
||||
const edge& e0 = edgesA[twoEdges[0]];
|
||||
const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
|
||||
|
||||
const auto iter = edgeValues.cfind(meshEdge0);
|
||||
|
||||
if (iter.found())
|
||||
{
|
||||
half0Values.insert(i, *iter);
|
||||
}
|
||||
}
|
||||
{
|
||||
const edge& e1 = edgesB[twoEdges[1]];
|
||||
const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
|
||||
|
||||
const auto iter = edgeValues.cfind(meshEdge1);
|
||||
|
||||
if (iter.found())
|
||||
{
|
||||
half1Values.insert(i, *iter);
|
||||
}
|
||||
half0Values.insert(edgei, *iter);
|
||||
}
|
||||
}
|
||||
|
||||
// Transform to this side
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
|
||||
// Extract and combine information
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
const edge& twoEdges = coupledEdges[i];
|
||||
const edge& e1 = edgesB[twoEdges[1]];
|
||||
const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
|
||||
|
||||
const auto half1Fnd = half1Values.cfind(i);
|
||||
const auto iter = edgeValues.cfind(meshEdge1);
|
||||
|
||||
if (half1Fnd.found())
|
||||
if (iter.found())
|
||||
{
|
||||
const edge& e0 = edgesA[twoEdges[0]];
|
||||
const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
|
||||
|
||||
combine
|
||||
(
|
||||
edgeValues,
|
||||
cop,
|
||||
meshEdge0, // edge
|
||||
*half1Fnd // value
|
||||
);
|
||||
half1Values.insert(edgei, *iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto half0Fnd = half0Values.cfind(i);
|
||||
// Transform to this side
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
if (half0Fnd.found())
|
||||
{
|
||||
const edge& e1 = edgesB[twoEdges[1]];
|
||||
const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
|
||||
|
||||
combine
|
||||
(
|
||||
edgeValues,
|
||||
cop,
|
||||
meshEdge1, // edge
|
||||
*half0Fnd // value
|
||||
);
|
||||
}
|
||||
// Extract and combine information
|
||||
|
||||
forAll(coupledEdges, edgei)
|
||||
{
|
||||
const edge& twoEdges = coupledEdges[edgei];
|
||||
|
||||
const auto half1Fnd = half1Values.cfind(edgei);
|
||||
|
||||
if (half1Fnd.found())
|
||||
{
|
||||
const edge& e0 = edgesA[twoEdges[0]];
|
||||
const edge meshEdge0(meshPtsA[e0[0]], meshPtsA[e0[1]]);
|
||||
|
||||
combine
|
||||
(
|
||||
edgeValues,
|
||||
cop,
|
||||
meshEdge0, // edge
|
||||
*half1Fnd // value
|
||||
);
|
||||
}
|
||||
|
||||
const auto half0Fnd = half0Values.cfind(edgei);
|
||||
|
||||
if (half0Fnd.found())
|
||||
{
|
||||
const edge& e1 = edgesB[twoEdges[1]];
|
||||
const edge meshEdge1(meshPtsB[e1[0]], meshPtsB[e1[1]]);
|
||||
|
||||
combine
|
||||
(
|
||||
edgeValues,
|
||||
cop,
|
||||
meshEdge1, // edge
|
||||
*half0Fnd // value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1022,6 +1019,8 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
|
||||
if (parRun)
|
||||
{
|
||||
// Avoid mesh.globalData() - possible race condition
|
||||
|
||||
if
|
||||
(
|
||||
is_contiguous<T>::value
|
||||
@ -1036,16 +1035,17 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
// Set up reads
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size() > 0)
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
SubList<T> fld
|
||||
(
|
||||
receivedValues,
|
||||
procPatch.size(),
|
||||
procPatch.offset()
|
||||
pp.size(),
|
||||
pp.start()-boundaryOffset
|
||||
);
|
||||
|
||||
IPstream::read
|
||||
@ -1061,16 +1061,17 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
// Set up writes
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size() > 0)
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
const SubList<T> fld
|
||||
(
|
||||
faceValues,
|
||||
procPatch.size(),
|
||||
procPatch.offset()
|
||||
pp.size(),
|
||||
pp.start()-boundaryOffset
|
||||
);
|
||||
|
||||
OPstream::write
|
||||
@ -1089,15 +1090,17 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
// Combine with existing data
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size() > 0)
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
SubList<T> recvFld
|
||||
(
|
||||
receivedValues,
|
||||
procPatch.size(),
|
||||
procPatch.offset()
|
||||
pp.size(),
|
||||
pp.start()-boundaryOffset
|
||||
);
|
||||
const List<T>& fakeList = recvFld;
|
||||
top(procPatch, const_cast<List<T>&>(fakeList));
|
||||
@ -1105,9 +1108,10 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
SubList<T> patchValues
|
||||
(
|
||||
faceValues,
|
||||
procPatch.size(),
|
||||
procPatch.offset()
|
||||
pp.size(),
|
||||
pp.start()-boundaryOffset
|
||||
);
|
||||
|
||||
forAll(patchValues, i)
|
||||
{
|
||||
cop(patchValues[i], recvFld[i]);
|
||||
@ -1120,48 +1124,54 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size() > 0)
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
const label patchStart = procPatch.start()-boundaryOffset;
|
||||
const SubList<T> fld
|
||||
(
|
||||
faceValues,
|
||||
pp.size(),
|
||||
pp.start()-boundaryOffset
|
||||
);
|
||||
|
||||
// Send slice of values on the patch
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr <<
|
||||
SubList<T>(faceValues, procPatch.size(), patchStart);
|
||||
toNbr << fld;;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size() > 0)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
List<T> nbrVals(procPatch.size());
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const auto& procPatch = *ppp;
|
||||
|
||||
List<T> recvFld(pp.size());
|
||||
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> nbrVals;
|
||||
fromNbr >> recvFld;
|
||||
|
||||
top(procPatch, nbrVals);
|
||||
top(procPatch, recvFld);
|
||||
|
||||
label bFacei = procPatch.start()-boundaryOffset;
|
||||
SubList<T> patchValues
|
||||
(
|
||||
faceValues,
|
||||
pp.size(),
|
||||
pp.start()-boundaryOffset
|
||||
);
|
||||
|
||||
for (const T& nbrVal : nbrVals)
|
||||
forAll(patchValues, i)
|
||||
{
|
||||
cop(faceValues[bFacei++], nbrVal);
|
||||
cop(patchValues[i], recvFld[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1171,38 +1181,45 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
// Do the cyclics.
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
// Owner does all.
|
||||
|
||||
if (cycPatch.owner())
|
||||
const cyclicPolyPatch& cycPatch = *cpp;
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const label patchSize = cycPatch.size();
|
||||
|
||||
SubList<T> ownPatchValues
|
||||
(
|
||||
faceValues,
|
||||
patchSize,
|
||||
cycPatch.start()-boundaryOffset
|
||||
);
|
||||
|
||||
SubList<T> nbrPatchValues
|
||||
(
|
||||
faceValues,
|
||||
patchSize,
|
||||
nbrPatch.start()-boundaryOffset
|
||||
);
|
||||
|
||||
// Transform (copy of) data on both sides
|
||||
List<T> ownVals(ownPatchValues);
|
||||
top(nbrPatch, ownVals);
|
||||
|
||||
List<T> nbrVals(nbrPatchValues);
|
||||
top(cycPatch, nbrVals);
|
||||
|
||||
forAll(ownPatchValues, i)
|
||||
{
|
||||
// Owner does all.
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
cop(ownPatchValues[i], nbrVals[i]);
|
||||
}
|
||||
|
||||
const label patchSize = cycPatch.size();
|
||||
const label ownStart = cycPatch.start()-boundaryOffset;
|
||||
const label nbrStart = nbrPatch.start()-boundaryOffset;
|
||||
|
||||
// Transform (copy of) data on both sides
|
||||
List<T> ownVals(SubList<T>(faceValues, patchSize, ownStart));
|
||||
top(nbrPatch, ownVals);
|
||||
|
||||
List<T> nbrVals(SubList<T>(faceValues, patchSize, nbrStart));
|
||||
top(cycPatch, nbrVals);
|
||||
|
||||
label bFacei = ownStart;
|
||||
for (T& nbrVal : nbrVals)
|
||||
{
|
||||
cop(faceValues[bFacei++], nbrVal);
|
||||
}
|
||||
|
||||
bFacei = nbrStart;
|
||||
for (T& ownVal : ownVals)
|
||||
{
|
||||
cop(faceValues[bFacei++], ownVal);
|
||||
}
|
||||
forAll(nbrPatchValues, i)
|
||||
{
|
||||
cop(nbrPatchValues[i], ownVals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1224,17 +1241,14 @@ void Foam::syncTools::syncFaceList
|
||||
// Offset (global to local) for start of boundaries
|
||||
const label boundaryOffset = (isBoundaryOnly ? mesh.nInternalFaces() : 0);
|
||||
|
||||
if
|
||||
(
|
||||
faceValues.size()
|
||||
!= (isBoundaryOnly ? mesh.nBoundaryFaces() : mesh.nFaces())
|
||||
)
|
||||
// Check size
|
||||
if (faceValues.size() != (mesh.nFaces() - boundaryOffset))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Number of values " << faceValues.size()
|
||||
<< " is not equal to the number of "
|
||||
<< (isBoundaryOnly ? "boundary" : "mesh") << " faces "
|
||||
<< (isBoundaryOnly ? mesh.nBoundaryFaces() : mesh.nFaces()) << nl
|
||||
<< ((mesh.nFaces() - boundaryOffset)) << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -1250,13 +1264,13 @@ void Foam::syncTools::syncFaceList
|
||||
// Set up reads
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
const label patchSize = procPatch.size();
|
||||
const label patchi = procPatch.index();
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const auto& procPatch = *ppp;
|
||||
const label patchi = pp.index();
|
||||
const label patchSize = pp.size();
|
||||
|
||||
recvInfos.set(patchi, new PackedList<Width>(patchSize));
|
||||
PackedList<Width>& recvInfo = recvInfos[patchi];
|
||||
@ -1277,18 +1291,18 @@ void Foam::syncTools::syncFaceList
|
||||
// Set up writes
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size())
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto& procPatch = *ppp;
|
||||
const label patchi = pp.index();
|
||||
|
||||
const labelRange range
|
||||
(
|
||||
procPatch.start()-boundaryOffset,
|
||||
procPatch.size()
|
||||
pp.start()-boundaryOffset,
|
||||
pp.size()
|
||||
);
|
||||
const label patchi = procPatch.index();
|
||||
|
||||
sendInfos.set
|
||||
(
|
||||
patchi,
|
||||
@ -1312,17 +1326,17 @@ void Foam::syncTools::syncFaceList
|
||||
// Combine with existing data
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp) && pp.size())
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto* ppp = isA<processorPolyPatch>(pp);
|
||||
|
||||
if (ppp && pp.size())
|
||||
{
|
||||
const label patchi = pp.index();
|
||||
const label patchSize = pp.size();
|
||||
|
||||
const label patchSize = procPatch.size();
|
||||
const label patchi = procPatch.index();
|
||||
const PackedList<Width>& recvInfo = recvInfos[patchi];
|
||||
|
||||
// Combine (bitwise)
|
||||
label bFacei = procPatch.start()-boundaryOffset;
|
||||
label bFacei = pp.start()-boundaryOffset;
|
||||
for (label i = 0; i < patchSize; ++i)
|
||||
{
|
||||
unsigned int recvVal = recvInfo[i];
|
||||
@ -1335,101 +1349,38 @@ void Foam::syncTools::syncFaceList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
//
|
||||
//// Send
|
||||
//
|
||||
//for (const polyPatch& pp : patches)
|
||||
//{
|
||||
// if (isA<processorPolyPatch>(pp) && pp.size())
|
||||
// {
|
||||
// const processorPolyPatch& procPatch =
|
||||
// refCast<const processorPolyPatch>(pp);
|
||||
//
|
||||
// const labelRange range
|
||||
// (
|
||||
// procPatch.start()-boundaryOffset,
|
||||
// procPatch.size()
|
||||
// );
|
||||
//
|
||||
// // Send slice of values on the patch
|
||||
// UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
// toNbr<< PackedList<Width>(faceValues, range);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//pBufs.finishedSends();
|
||||
//
|
||||
//
|
||||
//// Receive and combine.
|
||||
//
|
||||
//for (const polyPatch& pp : patches)
|
||||
//{
|
||||
// if (isA<processorPolyPatch>(pp) && pp.size())
|
||||
// {
|
||||
// const processorPolyPatch& procPatch =
|
||||
// refCast<const processorPolyPatch>(pp);
|
||||
//
|
||||
// const label patchSize = procPatch.size();
|
||||
//
|
||||
// // Recv slice of values on the patch
|
||||
// PackedList<Width> recvInfo(patchSize);
|
||||
// {
|
||||
// UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
// fromNbr >> recvInfo;
|
||||
// }
|
||||
//
|
||||
// // Combine (bitwise)
|
||||
// label bFacei = procPatch.start()-boundaryOffset;
|
||||
// for (label i = 0; i < patchSize; ++i)
|
||||
// {
|
||||
// unsigned int recvVal = recvInfo[i];
|
||||
// unsigned int faceVal = faceValues[bFacei];
|
||||
//
|
||||
// cop(faceVal, recvVal);
|
||||
// faceValues.set(bFacei, faceVal);
|
||||
//
|
||||
// ++bFacei;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
// Do the cyclics.
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
// Owner does all.
|
||||
|
||||
if (cycPatch.owner())
|
||||
const cyclicPolyPatch& cycPatch = *cpp;
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const label patchSize = cycPatch.size();
|
||||
|
||||
label face0 = cycPatch.start()-boundaryOffset;
|
||||
label face1 = nbrPatch.start()-boundaryOffset;
|
||||
for (label i = 0; i < patchSize; ++i)
|
||||
{
|
||||
// Owner does all.
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
unsigned int val0 = faceValues[face0];
|
||||
unsigned int val1 = faceValues[face1];
|
||||
|
||||
const label patchSize = cycPatch.size();
|
||||
unsigned int t = val0;
|
||||
cop(t, val1);
|
||||
faceValues[face0] = t;
|
||||
|
||||
label face0 = cycPatch.start()-boundaryOffset;
|
||||
label face1 = nbrPatch.start()-boundaryOffset;
|
||||
for (label i = 0; i < patchSize; ++i)
|
||||
{
|
||||
unsigned int val0 = faceValues[face0];
|
||||
unsigned int val1 = faceValues[face1];
|
||||
cop(val1, val0);
|
||||
faceValues[face1] = val1;
|
||||
|
||||
unsigned int t = val0;
|
||||
cop(t, val1);
|
||||
faceValues[face0] = t;
|
||||
|
||||
cop(val1, val0);
|
||||
faceValues[face1] = val1;
|
||||
|
||||
++face0;
|
||||
++face1;
|
||||
}
|
||||
++face0;
|
||||
++face1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1458,11 +1409,9 @@ void Foam::syncTools::swapBoundaryCellList
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
label bFacei = pp.start()-mesh.nInternalFaces();
|
||||
label bFacei = pp.offset();
|
||||
|
||||
const labelUList& faceCells = pp.faceCells();
|
||||
|
||||
for (const label celli : faceCells)
|
||||
for (const label celli : pp.faceCells())
|
||||
{
|
||||
neighbourCellData[bFacei] = cellData[celli];
|
||||
++bFacei;
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -312,13 +312,12 @@ Foam::label Foam::fvMeshDistribute::findNonEmptyPatch() const
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
const auto* cpp = isA<cyclicACMIPolyPatch>(pp);
|
||||
|
||||
if (isA<cyclicACMIPolyPatch>(pp))
|
||||
if (cpp)
|
||||
{
|
||||
isCoupledPatch.set(patchi);
|
||||
const cyclicACMIPolyPatch& cpp =
|
||||
refCast<const cyclicACMIPolyPatch>(pp);
|
||||
const label dupPatchID = cpp.nonOverlapPatchID();
|
||||
const label dupPatchID = cpp->nonOverlapPatchID();
|
||||
if (dupPatchID != -1)
|
||||
{
|
||||
isCoupledPatch.set(dupPatchID);
|
||||
@ -510,12 +509,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::deleteProcPatches
|
||||
// or new patchID
|
||||
labelList newPatchID(mesh_.nBoundaryFaces(), -1);
|
||||
|
||||
label nProcPatches = 0;
|
||||
|
||||
forAll(mesh_.boundaryMesh(), patchi)
|
||||
for (const polyPatch& pp : mesh_.boundaryMesh())
|
||||
{
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
|
||||
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
if (debug)
|
||||
@ -525,14 +520,12 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::deleteProcPatches
|
||||
<< endl;
|
||||
}
|
||||
|
||||
label offset = pp.start() - mesh_.nInternalFaces();
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
newPatchID[offset+i] = destinationPatch;
|
||||
}
|
||||
|
||||
nProcPatches++;
|
||||
SubList<label>
|
||||
(
|
||||
newPatchID,
|
||||
pp.size(),
|
||||
pp.offset()
|
||||
) = destinationPatch;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -136,12 +136,13 @@ void Foam::fvMeshSubset::doCoupledPatches
|
||||
// Send face usage across processor patches
|
||||
for (const polyPatch& pp : oldPatches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto* procPatch = isA<processorPolyPatch>(pp);
|
||||
|
||||
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
if (procPatch)
|
||||
{
|
||||
const label nbrProci = procPatch->neighbProcNo();
|
||||
|
||||
UOPstream toNeighbour(nbrProci, pBufs);
|
||||
|
||||
if (!nCellsUsingFace.empty())
|
||||
{
|
||||
@ -160,12 +161,13 @@ void Foam::fvMeshSubset::doCoupledPatches
|
||||
// Receive face usage count and check for faces that become uncoupled.
|
||||
for (const polyPatch& pp : oldPatches)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
const auto* procPatch = isA<processorPolyPatch>(pp);
|
||||
|
||||
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
if (procPatch)
|
||||
{
|
||||
const label nbrProci = procPatch->neighbProcNo();
|
||||
|
||||
UIPstream fromNeighbour(nbrProci, pBufs);
|
||||
|
||||
const labelList nbrList(fromNeighbour);
|
||||
|
||||
@ -199,27 +201,25 @@ void Foam::fvMeshSubset::doCoupledPatches
|
||||
// Do same for cyclics.
|
||||
for (const polyPatch& pp : oldPatches)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp && !nCellsUsingFace.empty())
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
const auto& cycPatch = *cpp;
|
||||
|
||||
if (!nCellsUsingFace.empty())
|
||||
forAll(cycPatch, i)
|
||||
{
|
||||
forAll(cycPatch, i)
|
||||
{
|
||||
label thisFacei = cycPatch.start() + i;
|
||||
label otherFacei = cycPatch.transformGlobalFace(thisFacei);
|
||||
label thisFacei = cycPatch.start() + i;
|
||||
label otherFacei = cycPatch.transformGlobalFace(thisFacei);
|
||||
|
||||
if
|
||||
(
|
||||
nCellsUsingFace[thisFacei] == 1
|
||||
&& nCellsUsingFace[otherFacei] == 0
|
||||
)
|
||||
{
|
||||
nCellsUsingFace[thisFacei] = 3;
|
||||
++nUncoupled;
|
||||
}
|
||||
if
|
||||
(
|
||||
nCellsUsingFace[thisFacei] == 1
|
||||
&& nCellsUsingFace[otherFacei] == 0
|
||||
)
|
||||
{
|
||||
nCellsUsingFace[thisFacei] = 3;
|
||||
++nUncoupled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -315,21 +315,16 @@ bool Foam::functionObjects::AMIWeights::read(const dictionary& dict)
|
||||
{
|
||||
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
|
||||
{
|
||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||
|
||||
patchIDs_.clear();
|
||||
labelHashSet ids;
|
||||
forAll(pbm, patchi)
|
||||
{
|
||||
if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
|
||||
{
|
||||
const auto& ami =
|
||||
static_cast<const cyclicAMIPolyPatch&>(pbm[patchi]);
|
||||
|
||||
if (ami.owner())
|
||||
{
|
||||
ids.insert(patchi);
|
||||
}
|
||||
for (const polyPatch& pp : mesh_.boundaryMesh())
|
||||
{
|
||||
const auto* amicpp = isA<cyclicAMIPolyPatch>(pp);
|
||||
|
||||
if (amicpp && amicpp->owner())
|
||||
{
|
||||
ids.insert(pp.index());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,16 +211,11 @@ void Foam::functionObjects::extractEulerianParticles::setBlockedFaces
|
||||
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
|
||||
const scalarField& alphafp = alphaf.boundaryField()[patchi];
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
if (cpp)
|
||||
{
|
||||
const coupledPolyPatch& cpp =
|
||||
refCast<const coupledPolyPatch>(pp);
|
||||
|
||||
if (cpp.owner())
|
||||
{
|
||||
patchFacei = cpp.whichFace(facei);
|
||||
}
|
||||
patchFacei = (cpp->owner() ? pp.whichFace(facei) : -1);
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
|
@ -193,21 +193,15 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
|
||||
{
|
||||
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
if (cpp)
|
||||
{
|
||||
if (refCast<const coupledPolyPatch>(pp).owner())
|
||||
{
|
||||
faceId = pp.whichFace(meshFacei);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceId = -1;
|
||||
}
|
||||
faceId = (cpp->owner() ? pp.whichFace(meshFacei) : -1);
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
faceId = meshFacei - pp.start();
|
||||
faceId = pp.whichFace(meshFacei);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -208,6 +208,7 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
|
||||
forAll(fZone, i)
|
||||
{
|
||||
label facei = fZone[i];
|
||||
const bool isFlip = fZone.flipMap()[i];
|
||||
|
||||
label faceID = -1;
|
||||
label facePatchID = -1;
|
||||
@ -220,20 +221,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
|
||||
{
|
||||
facePatchID = mesh_.boundaryMesh().whichPatch(facei);
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
|
||||
if (cpp)
|
||||
{
|
||||
if (refCast<const coupledPolyPatch>(pp).owner())
|
||||
{
|
||||
faceID = pp.whichFace(facei);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceID = -1;
|
||||
}
|
||||
faceID = (cpp->owner() ? pp.whichFace(facei) : -1);
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
faceID = facei - pp.start();
|
||||
faceID = pp.whichFace(facei);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -245,15 +241,7 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
|
||||
if (faceID >= 0)
|
||||
{
|
||||
// Orientation set by faceZone flip map
|
||||
if (fZone.flipMap()[i])
|
||||
{
|
||||
flips.append(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
flips.append(false);
|
||||
}
|
||||
|
||||
flips.append(isFlip);
|
||||
faceIDs.append(faceID);
|
||||
facePatchIDs.append(facePatchID);
|
||||
}
|
||||
@ -317,20 +305,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection
|
||||
{
|
||||
facePatchID = mesh_.boundaryMesh().whichPatch(facei);
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
|
||||
if (cpp)
|
||||
{
|
||||
if (refCast<const coupledPolyPatch>(pp).owner())
|
||||
{
|
||||
faceID = pp.whichFace(facei);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceID = -1;
|
||||
}
|
||||
faceID = (cpp->owner() ? pp.whichFace(facei) : -1);
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
faceID = facei - pp.start();
|
||||
faceID = pp.whichFace(facei);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -82,7 +82,7 @@ void Foam::fv::directionalPressureGradientExplicitSource::initialise()
|
||||
label count = 0;
|
||||
forAll(fZone, i)
|
||||
{
|
||||
label faceI = fZone[i];
|
||||
const label faceI = fZone[i];
|
||||
|
||||
label faceId = -1;
|
||||
label facePatchId = -1;
|
||||
@ -95,20 +95,15 @@ void Foam::fv::directionalPressureGradientExplicitSource::initialise()
|
||||
{
|
||||
facePatchId = mesh_.boundaryMesh().whichPatch(faceI);
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
|
||||
if (cpp)
|
||||
{
|
||||
if (refCast<const coupledPolyPatch>(pp).owner())
|
||||
{
|
||||
faceId = pp.whichFace(faceI);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceId = -1;
|
||||
}
|
||||
faceId = (cpp->owner() ? pp.whichFace(faceI) : -1);
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
faceId = faceI - pp.start();
|
||||
faceId = pp.whichFace(faceI);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -87,20 +87,15 @@ void Foam::fv::effectivenessHeatExchangerSource::initialise()
|
||||
{
|
||||
facePatchId = mesh_.boundaryMesh().whichPatch(facei);
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
|
||||
if (cpp)
|
||||
{
|
||||
if (refCast<const coupledPolyPatch>(pp).owner())
|
||||
{
|
||||
faceId = pp.whichFace(facei);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceId = -1;
|
||||
}
|
||||
faceId = (cpp->owner() ? pp.whichFace(facei) : -1);
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
faceId = facei - pp.start();
|
||||
faceId = pp.whichFace(facei);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,18 +41,17 @@ License
|
||||
template<class ParticleType>
|
||||
void Foam::Cloud<ParticleType>::checkPatches() const
|
||||
{
|
||||
const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh();
|
||||
bool ok = true;
|
||||
for (const polyPatch& pp : pbm)
|
||||
for (const polyPatch& pp : polyMesh_.boundaryMesh())
|
||||
{
|
||||
if (isA<cyclicAMIPolyPatch>(pp))
|
||||
{
|
||||
const cyclicAMIPolyPatch& cami =
|
||||
refCast<const cyclicAMIPolyPatch>(pp);
|
||||
const auto* camipp = isA<cyclicAMIPolyPatch>(pp);
|
||||
|
||||
if (cami.owner())
|
||||
if (camipp && camipp->owner())
|
||||
{
|
||||
ok = (camipp->AMI().singlePatchProc() != -1);
|
||||
if (!ok)
|
||||
{
|
||||
ok = ok && (cami.AMI().singlePatchProc() != -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -240,17 +240,11 @@ void Foam::meshRefinement::calcCellCellRays
|
||||
// coupled unset.
|
||||
bitSet isMaster(mesh_.nBoundaryFaces(), true);
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
for (const polyPatch& pp : patches)
|
||||
for (const polyPatch& pp : mesh_.boundaryMesh())
|
||||
{
|
||||
if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
|
||||
{
|
||||
const labelRange bSlice
|
||||
(
|
||||
pp.start()-mesh_.nInternalFaces(),
|
||||
pp.size()
|
||||
);
|
||||
isMaster.unset(bSlice);
|
||||
isMaster.unset(labelRange(pp.offset(), pp.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2447,25 +2441,14 @@ bool Foam::meshRefinement::getFaceZoneInfo
|
||||
|
||||
void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
forAll(patches, patchi)
|
||||
for (const polyPatch& pp : mesh_.boundaryMesh())
|
||||
{
|
||||
// Check all coupled. Avoid using .coupled() so we also pick up AMI.
|
||||
if (isA<coupledPolyPatch>(patches[patchi]))
|
||||
{
|
||||
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[patchi]
|
||||
);
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
|
||||
if (cpp.separated() || !cpp.parallel())
|
||||
{
|
||||
forAll(cpp, i)
|
||||
{
|
||||
selected[cpp.start()+i] = true;
|
||||
}
|
||||
}
|
||||
if (cpp && (cpp->separated() || !cpp->parallel()))
|
||||
{
|
||||
SubList<bool>(selected, pp.size(), pp.start()) = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -649,12 +649,12 @@ void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
|
||||
|
||||
for (const polyPatch& patch : mesh_.boundaryMesh())
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patch))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patch);
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(patch);
|
||||
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
if (cpp)
|
||||
{
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
// Allocate buffers
|
||||
label nReceiveFaces;
|
||||
@ -733,12 +733,12 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
|
||||
|
||||
for (const polyPatch& patch : mesh_.boundaryMesh())
|
||||
{
|
||||
if (isA<cyclicAMIPolyPatch>(patch))
|
||||
{
|
||||
const cyclicAMIPolyPatch& cycPatch =
|
||||
refCast<const cyclicAMIPolyPatch>(patch);
|
||||
const cyclicAMIPolyPatch* cpp = isA<cyclicAMIPolyPatch>(patch);
|
||||
|
||||
const cyclicAMIPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
if (cpp)
|
||||
{
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
List<Type> receiveInfo;
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -435,10 +436,12 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
|
||||
{
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[patchi];
|
||||
|
||||
if (isA<cyclicPolyPatch>(patch))
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(patch);
|
||||
|
||||
if (cpp)
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patch);
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
nbrInfo.clear();
|
||||
nbrInfo.reserve(cycPatch.nPoints());
|
||||
@ -449,7 +452,6 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
|
||||
|
||||
// Collect nbrPatch points that have changed
|
||||
{
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const edgeList& pairs = cycPatch.coupledPoints();
|
||||
const labelList& meshPoints = nbrPatch.meshPoints();
|
||||
|
||||
|
@ -232,7 +232,7 @@ void Foam::regionSplit::fillSeedMask
|
||||
{
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (bool(cpp) && cpp->owner())
|
||||
if (cpp && cpp->owner())
|
||||
{
|
||||
// Transfer from neighbourPatch to here or vice versa.
|
||||
const auto& cycPatch = *cpp;
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -111,22 +111,15 @@ Foam::labelList Foam::SloanRenumber::renumber
|
||||
const pointField& points
|
||||
) const
|
||||
{
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
// Construct graph : faceOwner + connections across cyclics.
|
||||
|
||||
// Determine neighbour cell
|
||||
labelList nbr(mesh.nBoundaryFaces(), -1);
|
||||
forAll(pbm, patchi)
|
||||
for (const polyPatch& pp : mesh.boundaryMesh())
|
||||
{
|
||||
if (pbm[patchi].coupled() && !isA<processorPolyPatch>(pbm[patchi]))
|
||||
if (pp.coupled() && !isA<processorPolyPatch>(pp))
|
||||
{
|
||||
SubList<label>
|
||||
(
|
||||
nbr,
|
||||
pbm[patchi].size(),
|
||||
pbm[patchi].start()-mesh.nInternalFaces()
|
||||
) = pbm[patchi].faceCells();
|
||||
SubList<label>(nbr, pp.size(), pp.offset()) = pp.faceCells();
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, nbr);
|
||||
@ -140,28 +133,29 @@ Foam::labelList Foam::SloanRenumber::renumber
|
||||
add_edge(mesh.faceOwner()[facei], mesh.faceNeighbour()[facei], G);
|
||||
}
|
||||
// Add cyclics
|
||||
forAll(pbm, patchi)
|
||||
for (const polyPatch& pp : mesh.boundaryMesh())
|
||||
{
|
||||
if
|
||||
(
|
||||
pbm[patchi].coupled()
|
||||
&& !isA<processorPolyPatch>(pbm[patchi])
|
||||
&& refCast<const coupledPolyPatch>(pbm[patchi]).owner()
|
||||
pp.coupled()
|
||||
&& !isA<processorPolyPatch>(pp)
|
||||
&& refCast<const coupledPolyPatch>(pp).owner()
|
||||
)
|
||||
{
|
||||
const labelUList& faceCells = pbm[patchi].faceCells();
|
||||
forAll(faceCells, i)
|
||||
{
|
||||
label bFacei = pbm[patchi].start()+i-mesh.nInternalFaces();
|
||||
label nbrCelli = nbr[bFacei];
|
||||
label bFacei = pp.offset();
|
||||
|
||||
if (faceCells[i] < nbrCelli)
|
||||
for (const label ownCelli : pp.faceCells())
|
||||
{
|
||||
const label nbrCelli = nbr[bFacei];
|
||||
++bFacei;
|
||||
|
||||
if (ownCelli < nbrCelli)
|
||||
{
|
||||
add_edge(faceCells[i], nbrCelli, G);
|
||||
add_edge(ownCelli, nbrCelli, G);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_edge(nbrCelli, faceCells[i], G);
|
||||
add_edge(nbrCelli, ownCelli, G);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -405,17 +405,11 @@ void Foam::meshToMesh::distributeCells
|
||||
forAll(tgtMesh.boundaryMesh(), patchi)
|
||||
{
|
||||
const polyPatch& pp = tgtMesh.boundaryMesh()[patchi];
|
||||
const auto* procPatch = isA<processorPolyPatch>(pp);
|
||||
|
||||
label nbrProci = -1;
|
||||
|
||||
// store info for faces on processor patches
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
const processorPolyPatch& ppp =
|
||||
dynamic_cast<const processorPolyPatch&>(pp);
|
||||
|
||||
nbrProci = ppp.neighbProcNo();
|
||||
}
|
||||
// Store info for faces on processor patches
|
||||
const label nbrProci =
|
||||
(procPatch ? procPatch->neighbProcNo() : -1);
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ bool Foam::sampledFaceZone::update()
|
||||
}
|
||||
else
|
||||
{
|
||||
faceId = meshFacei - pp.start();
|
||||
faceId = pp.whichFace(meshFacei);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -79,7 +79,7 @@ struct storeOp
|
||||
static inline bool collocatedPatch(const polyPatch& pp)
|
||||
{
|
||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||
return bool(cpp) && cpp->parallel() && !cpp->separated();
|
||||
return cpp && cpp->parallel() && !cpp->separated();
|
||||
}
|
||||
|
||||
|
||||
@ -158,21 +158,18 @@ void Foam::isoSurfacePoint::syncUnseparatedPoints
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Send
|
||||
for (const polyPatch& p : patches)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(p)
|
||||
&& p.nPoints() > 0
|
||||
&& collocatedPatch(p)
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& pp =
|
||||
refCast<const processorPolyPatch>(p);
|
||||
const labelList& procPatches = mesh_.globalData().processorPatches();
|
||||
|
||||
const labelList& meshPts = pp.meshPoints();
|
||||
const labelList& nbrPts = pp.neighbPoints();
|
||||
// Send
|
||||
for (const label patchi : procPatches)
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
const auto& procPatch = refCast<const processorPolyPatch>(pp);
|
||||
|
||||
if (pp.nPoints() && collocatedPatch(pp))
|
||||
{
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
pointField patchInfo(meshPts.size());
|
||||
|
||||
@ -185,38 +182,33 @@ void Foam::isoSurfacePoint::syncUnseparatedPoints
|
||||
OPstream toNbr
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
pp.neighbProcNo()
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
// Receive and combine.
|
||||
for (const polyPatch& p : patches)
|
||||
for (const label patchi : procPatches)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(p)
|
||||
&& p.nPoints() > 0
|
||||
&& collocatedPatch(p)
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& pp =
|
||||
refCast<const processorPolyPatch>(p);
|
||||
const polyPatch& pp = patches[patchi];
|
||||
const auto& procPatch = refCast<const processorPolyPatch>(pp);
|
||||
|
||||
pointField nbrPatchInfo(pp.nPoints());
|
||||
if (pp.nPoints() && collocatedPatch(pp))
|
||||
{
|
||||
pointField nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
// We do not know the number of points on the other side
|
||||
// so cannot use Pstream::read.
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
pp.neighbProcNo()
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
const labelList& meshPts = pp.meshPoints();
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
forAll(meshPts, pointi)
|
||||
{
|
||||
@ -232,41 +224,39 @@ void Foam::isoSurfacePoint::syncUnseparatedPoints
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
for (const polyPatch& p : patches)
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(p))
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp && cpp->owner() && collocatedPatch(*cpp))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(p);
|
||||
// Owner does all.
|
||||
|
||||
if (cycPatch.owner() && collocatedPatch(cycPatch))
|
||||
const auto& cycPatch = *cpp;
|
||||
const auto& nbrPatch = cycPatch.neighbPatch();
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPts = cycPatch.meshPoints();
|
||||
const labelList& nbrMeshPoints = nbrPatch.meshPoints();
|
||||
|
||||
pointField half0Values(coupledPoints.size());
|
||||
pointField half1Values(coupledPoints.size());
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
// Owner does all.
|
||||
const edge& e = coupledPoints[i];
|
||||
half0Values[i] = pointValues[meshPts[e[0]]];
|
||||
half1Values[i] = pointValues[nbrMeshPoints[e[1]]];
|
||||
}
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPts = cycPatch.meshPoints();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshPoints = nbrPatch.meshPoints();
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
const label p0 = meshPts[e[0]];
|
||||
const label p1 = nbrMeshPoints[e[1]];
|
||||
|
||||
pointField half0Values(coupledPoints.size());
|
||||
pointField half1Values(coupledPoints.size());
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
half0Values[i] = pointValues[meshPts[e[0]]];
|
||||
half1Values[i] = pointValues[nbrMeshPoints[e[1]]];
|
||||
}
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
const label p0 = meshPts[e[0]];
|
||||
const label p1 = nbrMeshPoints[e[1]];
|
||||
|
||||
minEqOp<point>()(pointValues[p0], half1Values[i]);
|
||||
minEqOp<point>()(pointValues[p1], half0Values[i]);
|
||||
}
|
||||
minEqOp<point>()(pointValues[p0], half1Values[i]);
|
||||
minEqOp<point>()(pointValues[p1], half0Values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user