mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-PtrList' into 'develop'
PtrListOps and adjustments for sync See merge request Development/openfoam!422
This commit is contained in:
@ -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.
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -136,8 +136,59 @@ struct greater
|
||||
};
|
||||
|
||||
|
||||
//- List of values generated by applying the access operation
|
||||
//- to each list item.
|
||||
//
|
||||
// For example,
|
||||
// \code
|
||||
// PtrListOps::get(mesh.boundaryMesh(), nameOp<polyPatch>());
|
||||
// \endcode
|
||||
template<class ReturnType, class T, class AccessOp>
|
||||
List<ReturnType> get
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const AccessOp& aop
|
||||
);
|
||||
|
||||
|
||||
//- List of names generated by calling \c name() for each list item
|
||||
//- and filtered for matches
|
||||
//
|
||||
// For example,
|
||||
// \code
|
||||
// wordRes matches(...);
|
||||
// PtrListOps::names(mesh.boundaryMesh(), matches);
|
||||
//
|
||||
// PtrListOps::names(mesh.boundaryMesh(), predicates::always());
|
||||
// \endcode
|
||||
template<class T, class UnaryMatchPredicate>
|
||||
List<word> names
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
);
|
||||
|
||||
|
||||
//- Find first list item with 'name()' that matches, -1 on failure
|
||||
template<class T, class UnaryMatchPredicate>
|
||||
label firstMatching
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
);
|
||||
|
||||
|
||||
//- Extract list indices for all items with 'name()' that matches
|
||||
template<class T, class UnaryMatchPredicate>
|
||||
labelList findMatching
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
);
|
||||
|
||||
} // End namespace ListOps
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -103,4 +103,118 @@ void Foam::shuffle(UPtrList<T>& list)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Templated implementation for types(), names(), etc - file-scope
|
||||
template<class ReturnType, class T, class AccessOp>
|
||||
Foam::List<ReturnType> Foam::PtrListOps::get
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const AccessOp& aop
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
List<ReturnType> output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
const T* ptr = list.get(i);
|
||||
|
||||
if (bool(ptr))
|
||||
{
|
||||
output[count++] = aop(*ptr);
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class UnaryMatchPredicate>
|
||||
Foam::List<Foam::word> Foam::PtrListOps::names
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
// Possible: const auto aop = nameOp<T>();
|
||||
|
||||
const label len = list.size();
|
||||
|
||||
List<word> output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
const T* ptr = list.get(i);
|
||||
|
||||
if (bool(ptr))
|
||||
{
|
||||
if (matcher(ptr->name()))
|
||||
{
|
||||
output[count++] = (ptr->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class UnaryMatchPredicate>
|
||||
Foam::label Foam::PtrListOps::firstMatching
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
const T* ptr = list.get(i);
|
||||
|
||||
if (bool(ptr) && matcher(ptr->name()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class UnaryMatchPredicate>
|
||||
Foam::labelList Foam::PtrListOps::findMatching
|
||||
(
|
||||
const UPtrList<T>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
labelList output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
const T* ptr = list.get(i);
|
||||
|
||||
if (bool(ptr) && matcher(ptr->name()))
|
||||
{
|
||||
output[count++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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.
|
||||
@ -34,6 +34,7 @@ License
|
||||
#include "lduSchedule.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "stringListOps.H"
|
||||
#include "PtrListOps.H"
|
||||
#include "edgeHashes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -43,81 +44,6 @@ namespace Foam
|
||||
defineTypeNameAndDebug(polyBoundaryMesh, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Templated implementation for types(), names(), etc - file-scope
|
||||
template<class ListType, class GetOp>
|
||||
static ListType getMethodImpl
|
||||
(
|
||||
const polyPatchList& list,
|
||||
const GetOp& getop
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
ListType output(len);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
output[i] = getop(list[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// Templated implementation for indices() - file-scope
|
||||
template<class UnaryMatchPredicate>
|
||||
static labelList indicesImpl
|
||||
(
|
||||
const polyPatchList& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
labelList output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
output[count++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// Templated implementation for findIndex() - file-scope
|
||||
template<class UnaryMatchPredicate>
|
||||
label findIndexImpl
|
||||
(
|
||||
const polyPatchList& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -592,20 +518,20 @@ Foam::label Foam::polyBoundaryMesh::nNonProcessor() const
|
||||
|
||||
Foam::wordList Foam::polyBoundaryMesh::names() const
|
||||
{
|
||||
return getMethodImpl<wordList>(*this, getNameOp<polyPatch>());
|
||||
return PtrListOps::get<word>(*this, nameOp<polyPatch>());
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::polyBoundaryMesh::types() const
|
||||
{
|
||||
return getMethodImpl<wordList>(*this, getTypeOp<polyPatch>());
|
||||
return PtrListOps::get<word>(*this, typeOp<polyPatch>());
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::polyBoundaryMesh::physicalTypes() const
|
||||
{
|
||||
return
|
||||
getMethodImpl<wordList>
|
||||
PtrListOps::get<word>
|
||||
(
|
||||
*this,
|
||||
[](const polyPatch& p) { return p.physicalType(); }
|
||||
@ -616,7 +542,7 @@ Foam::wordList Foam::polyBoundaryMesh::physicalTypes() const
|
||||
Foam::labelList Foam::polyBoundaryMesh::patchStarts() const
|
||||
{
|
||||
return
|
||||
getMethodImpl<labelList>
|
||||
PtrListOps::get<label>
|
||||
(
|
||||
*this,
|
||||
[](const polyPatch& p) { return p.start(); }
|
||||
@ -627,7 +553,7 @@ Foam::labelList Foam::polyBoundaryMesh::patchStarts() const
|
||||
Foam::labelList Foam::polyBoundaryMesh::patchSizes() const
|
||||
{
|
||||
return
|
||||
getMethodImpl<labelList>
|
||||
PtrListOps::get<label>
|
||||
(
|
||||
*this,
|
||||
[](const polyPatch& p) { return p.size(); }
|
||||
@ -681,8 +607,7 @@ Foam::labelList Foam::polyBoundaryMesh::indices
|
||||
if (key.isPattern())
|
||||
{
|
||||
const regExp matcher(key);
|
||||
|
||||
patchIndices = indicesImpl(*this, matcher);
|
||||
patchIndices = PtrListOps::findMatching(*this, matcher);
|
||||
|
||||
// Only examine patch groups if requested and when they exist.
|
||||
if (useGroups && !groupPatchIDs().empty())
|
||||
@ -713,8 +638,7 @@ Foam::labelList Foam::polyBoundaryMesh::indices
|
||||
// Special version of above for reduced memory footprint
|
||||
|
||||
const word& matcher = key;
|
||||
|
||||
const label patchId = findIndexImpl(*this, matcher);
|
||||
const label patchId = PtrListOps::firstMatching(*this, matcher);
|
||||
|
||||
if (patchId >= 0)
|
||||
{
|
||||
@ -750,14 +674,14 @@ Foam::label Foam::polyBoundaryMesh::findIndex(const keyType& key) const
|
||||
else if (key.isPattern())
|
||||
{
|
||||
// Find as regex
|
||||
regExp matcher(key);
|
||||
return findIndexImpl(*this, matcher);
|
||||
const regExp matcher(key);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find as literal string
|
||||
const word& matcher = key;
|
||||
return findIndexImpl(*this, matcher);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -773,7 +697,7 @@ Foam::label Foam::polyBoundaryMesh::findPatchID
|
||||
return -1;
|
||||
}
|
||||
|
||||
const label patchId = findIndexImpl(*this, patchName);
|
||||
const label patchId = PtrListOps::firstMatching(*this, patchName);
|
||||
|
||||
if (patchId >= 0)
|
||||
{
|
||||
@ -782,15 +706,18 @@ Foam::label Foam::polyBoundaryMesh::findPatchID
|
||||
|
||||
if (!allowNotFound)
|
||||
{
|
||||
string regionStr;
|
||||
if (mesh_.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
regionStr = "in region '" + mesh_.name() + "' ";
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Patch '" << patchName << "' not found. "
|
||||
<< "Available patch names " << regionStr << "include: " << names()
|
||||
<< "Available patch names";
|
||||
|
||||
if (polyMesh::defaultRegion != mesh_.name())
|
||||
{
|
||||
FatalError
|
||||
<< " in region '" << mesh_.name() << "'";
|
||||
}
|
||||
|
||||
FatalError
|
||||
<< " include: " << names() << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -799,7 +726,7 @@ Foam::label Foam::polyBoundaryMesh::findPatchID
|
||||
{
|
||||
Pout<< "label polyBoundaryMesh::findPatchID(const word&) const"
|
||||
<< "Patch named " << patchName << " not found. "
|
||||
<< "List of available patch names: " << names() << endl;
|
||||
<< "Available patch names: " << names() << endl;
|
||||
}
|
||||
|
||||
// Not found, return -1
|
||||
|
||||
@ -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-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "entry.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "Pstream.H"
|
||||
#include "PtrListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -138,91 +139,6 @@ bool Foam::ZoneMesh<ZoneType, MeshType>::read()
|
||||
}
|
||||
|
||||
|
||||
// Templated implementation for names()
|
||||
template<class ZoneType, class MeshType>
|
||||
template<class UnaryMatchPredicate>
|
||||
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::namesImpl
|
||||
(
|
||||
const PtrList<ZoneType>& list,
|
||||
const UnaryMatchPredicate& matcher,
|
||||
const bool doSort
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
wordList output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
const word& itemName = list[i].name();
|
||||
|
||||
if (matcher(itemName))
|
||||
{
|
||||
output[count++] = itemName;
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
if (doSort)
|
||||
{
|
||||
Foam::sort(output);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
template<class ZoneType, class MeshType>
|
||||
template<class UnaryMatchPredicate>
|
||||
Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indicesImpl
|
||||
(
|
||||
const PtrList<ZoneType>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
labelList output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
output[count++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
template<class ZoneType, class MeshType>
|
||||
template<class UnaryMatchPredicate>
|
||||
Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findIndexImpl
|
||||
(
|
||||
const PtrList<ZoneType>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ZoneType, class MeshType>
|
||||
@ -323,32 +239,14 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::whichZone
|
||||
template<class ZoneType, class MeshType>
|
||||
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::types() const
|
||||
{
|
||||
const PtrList<ZoneType>& zones = *this;
|
||||
|
||||
wordList list(zones.size());
|
||||
|
||||
forAll(zones, zonei)
|
||||
{
|
||||
list[zonei] = zones[zonei].type();
|
||||
}
|
||||
|
||||
return list;
|
||||
return PtrListOps::get<word>(*this, typeOp<ZoneType>());
|
||||
}
|
||||
|
||||
|
||||
template<class ZoneType, class MeshType>
|
||||
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names() const
|
||||
{
|
||||
const PtrList<ZoneType>& zones = *this;
|
||||
|
||||
wordList list(zones.size());
|
||||
|
||||
forAll(zones, zonei)
|
||||
{
|
||||
list[zonei] = zones[zonei].name();
|
||||
}
|
||||
|
||||
return list;
|
||||
return PtrListOps::get<word>(*this, nameOp<ZoneType>());
|
||||
}
|
||||
|
||||
|
||||
@ -358,7 +256,7 @@ Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names
|
||||
const wordRe& matcher
|
||||
) const
|
||||
{
|
||||
return namesImpl(*this, matcher, false);
|
||||
return PtrListOps::names(*this, matcher);
|
||||
}
|
||||
|
||||
|
||||
@ -369,7 +267,7 @@ Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names
|
||||
)
|
||||
const
|
||||
{
|
||||
return namesImpl(*this, matcher, false);
|
||||
return PtrListOps::names(*this, matcher);
|
||||
}
|
||||
|
||||
|
||||
@ -389,7 +287,10 @@ Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::sortedNames
|
||||
const wordRe& matcher
|
||||
) const
|
||||
{
|
||||
return namesImpl(*this, matcher, true);
|
||||
wordList sorted(this->names(matcher));
|
||||
Foam::sort(sorted);
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
|
||||
@ -400,7 +301,10 @@ Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::sortedNames
|
||||
)
|
||||
const
|
||||
{
|
||||
return namesImpl(*this, matcher, true);
|
||||
wordList sorted(this->names(matcher));
|
||||
Foam::sort(sorted);
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
|
||||
@ -417,14 +321,14 @@ Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices
|
||||
else if (key.isPattern())
|
||||
{
|
||||
// Match as regex
|
||||
regExp matcher(key);
|
||||
return indicesImpl(*this, matcher);
|
||||
const regExp matcher(key);
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compare as literal string
|
||||
const word& matcher = key;
|
||||
return indicesImpl(*this, matcher);
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,8 +343,7 @@ Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices
|
||||
{
|
||||
return labelList();
|
||||
}
|
||||
|
||||
return indicesImpl(*this, matcher);
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
|
||||
|
||||
@ -457,14 +360,14 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findIndex
|
||||
else if (key.isPattern())
|
||||
{
|
||||
// Find as regex
|
||||
regExp matcher(key);
|
||||
return findIndexImpl(*this, matcher);
|
||||
const regExp matcher(key);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find as literal string
|
||||
const word& matcher = key;
|
||||
return findIndexImpl(*this, matcher);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,7 +378,7 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findIndex
|
||||
const wordRes& matcher
|
||||
) const
|
||||
{
|
||||
return (matcher.empty() ? -1 : findIndexImpl(*this, matcher));
|
||||
return (matcher.empty() ? -1 : PtrListOps::firstMatching(*this, matcher));
|
||||
}
|
||||
|
||||
|
||||
@ -490,7 +393,7 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findZoneID
|
||||
return -1;
|
||||
}
|
||||
|
||||
label zoneId = findIndexImpl(*this, zoneName);
|
||||
label zoneId = PtrListOps::firstMatching(*this, zoneName);
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,32 +85,6 @@ class ZoneMesh
|
||||
//- Create zone map
|
||||
void calcZoneMap() const;
|
||||
|
||||
//- Templated implementation for names()
|
||||
template<class UnaryMatchPredicate>
|
||||
static wordList namesImpl
|
||||
(
|
||||
const PtrList<ZoneType>& list,
|
||||
const UnaryMatchPredicate& matcher,
|
||||
const bool doSort
|
||||
);
|
||||
|
||||
//- Templated implementation for indices()
|
||||
template<class UnaryMatchPredicate>
|
||||
static labelList indicesImpl
|
||||
(
|
||||
const PtrList<ZoneType>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
);
|
||||
|
||||
//- Templated implementation for findIndex()
|
||||
template<class UnaryMatchPredicate>
|
||||
static label findIndexImpl
|
||||
(
|
||||
const PtrList<ZoneType>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
);
|
||||
|
||||
|
||||
//- No copy construct
|
||||
ZoneMesh(const ZoneMesh&) = delete;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -271,30 +271,13 @@ struct compareOp
|
||||
};
|
||||
|
||||
|
||||
//- General get operation to extract the 'name' from an object as a word.
|
||||
// The default implementation uses the 'name()' method commonly used within
|
||||
// OpenFOAM.
|
||||
template<class T>
|
||||
struct getNameOp
|
||||
{
|
||||
word operator()(const T& x) const WARNRETURN
|
||||
{
|
||||
return x.name();
|
||||
}
|
||||
};
|
||||
//- Deprecated(2020-11) use nameOp (word.H)
|
||||
// \deprecated(2020-11) use nameOp
|
||||
template<class T> struct getNameOp : nameOp<T> {};
|
||||
|
||||
|
||||
//- General get operation to extract the 'type' from an object as a word.
|
||||
// The default implementation uses the 'type()' method commonly used within
|
||||
// OpenFOAM.
|
||||
template<class T>
|
||||
struct getTypeOp
|
||||
{
|
||||
word operator()(const T& x) const WARNRETURN
|
||||
{
|
||||
return x.type();
|
||||
}
|
||||
};
|
||||
//- Deprecated(2020-11) use typeOp (word.H)
|
||||
// \deprecated(2020-11) use typeOp
|
||||
template<class T> struct getTypeOp : typeOp<T> {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "Time.H"
|
||||
#include "PtrListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -135,31 +136,13 @@ Foam::polyTopoChanger::polyTopoChanger(polyMesh& mesh)
|
||||
|
||||
Foam::wordList Foam::polyTopoChanger::types() const
|
||||
{
|
||||
const PtrList<polyMeshModifier>& modifiers = *this;
|
||||
|
||||
wordList lst(modifiers.size());
|
||||
|
||||
forAll(modifiers, i)
|
||||
{
|
||||
lst[i] = modifiers[i].type();
|
||||
}
|
||||
|
||||
return lst;
|
||||
return PtrListOps::get<word>(*this, typeOp<polyMeshModifier>());
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::polyTopoChanger::names() const
|
||||
{
|
||||
const PtrList<polyMeshModifier>& modifiers = *this;
|
||||
|
||||
wordList lst(modifiers.size());
|
||||
|
||||
forAll(modifiers, i)
|
||||
{
|
||||
lst[i] = modifiers[i].name();
|
||||
}
|
||||
|
||||
return lst;
|
||||
return PtrListOps::get<word>(*this, typeOp<polyMeshModifier>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "PtrListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,82 +38,6 @@ namespace Foam
|
||||
defineTypeNameAndDebug(faBoundaryMesh, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Templated implementation for types(), names(), etc - file-scope
|
||||
template<class ListType, class GetOp>
|
||||
static ListType getMethodImpl
|
||||
(
|
||||
const faPatchList& list,
|
||||
const GetOp& getop
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
ListType output(len);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
output[i] = getop(list[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// Templated implementation for indices() - file-scope
|
||||
template<class UnaryMatchPredicate>
|
||||
static labelList indicesImpl
|
||||
(
|
||||
const faPatchList& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
labelList output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
output[count++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// Templated implementation for findIndex() - file-scope
|
||||
template<class UnaryMatchPredicate>
|
||||
label findIndexImpl
|
||||
(
|
||||
const faPatchList& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faBoundaryMesh::faBoundaryMesh
|
||||
@ -220,13 +145,13 @@ Foam::lduInterfacePtrsList Foam::faBoundaryMesh::interfaces() const
|
||||
|
||||
Foam::wordList Foam::faBoundaryMesh::names() const
|
||||
{
|
||||
return getMethodImpl<wordList>(*this, getNameOp<faPatch>());
|
||||
return PtrListOps::get<word>(*this, nameOp<faPatch>());
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::faBoundaryMesh::types() const
|
||||
{
|
||||
return getMethodImpl<wordList>(*this, getTypeOp<faPatch>());
|
||||
return PtrListOps::get<word>(*this, typeOp<faPatch>());
|
||||
}
|
||||
|
||||
|
||||
@ -244,8 +169,7 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
||||
if (key.isPattern())
|
||||
{
|
||||
const regExp matcher(key);
|
||||
|
||||
return indicesImpl(*this, matcher);
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -253,8 +177,7 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
||||
// Special version of above for reduced memory footprint
|
||||
|
||||
const word& matcher = key;
|
||||
|
||||
const label patchId = findIndexImpl(*this, matcher);
|
||||
const label patchId = PtrListOps::firstMatching(*this, matcher);
|
||||
|
||||
if (patchId >= 0)
|
||||
{
|
||||
@ -275,14 +198,14 @@ Foam::label Foam::faBoundaryMesh::findIndex(const keyType& key) const
|
||||
else if (key.isPattern())
|
||||
{
|
||||
// Find as regex
|
||||
regExp matcher(key);
|
||||
return findIndexImpl(*this, matcher);
|
||||
const regExp matcher(key);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find as literal string
|
||||
const word& matcher = key;
|
||||
return findIndexImpl(*this, matcher);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +217,7 @@ Foam::label Foam::faBoundaryMesh::findPatchID(const word& patchName) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
return findIndexImpl(*this, patchName);
|
||||
return PtrListOps::firstMatching(*this, patchName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,6 +27,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coordinateSystems.H"
|
||||
#include "predicates.H"
|
||||
#include "PtrListOps.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -42,99 +44,8 @@ namespace Foam
|
||||
static const char* headerTypeCompat = "IOPtrList<coordinateSystem>";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Templated implementation for names() - file-scope
|
||||
template<class UnaryMatchPredicate>
|
||||
static wordList namesImpl
|
||||
(
|
||||
const PtrList<coordinateSystem>& list,
|
||||
const UnaryMatchPredicate& matcher,
|
||||
const bool doSort
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
wordList output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
const word& itemName = list[i].name();
|
||||
|
||||
if (matcher(itemName))
|
||||
{
|
||||
output[count++] = itemName;
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
if (doSort)
|
||||
{
|
||||
Foam::sort(output);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// Templated implementation for indices() - file-scope
|
||||
template<class UnaryMatchPredicate>
|
||||
static labelList indicesImpl
|
||||
(
|
||||
const PtrList<coordinateSystem>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
labelList output(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
output[count++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
output.resize(count);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// Templated implementation for findIndex() - file-scope
|
||||
template<class UnaryMatchPredicate>
|
||||
label findIndexImpl
|
||||
(
|
||||
const PtrList<coordinateSystem>& list,
|
||||
const UnaryMatchPredicate& matcher
|
||||
)
|
||||
{
|
||||
const label len = list.size();
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (matcher(list[i].name()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
void Foam::coordinateSystems::readFromStream(const bool valid)
|
||||
{
|
||||
Istream& is = readStream(word::null, valid);
|
||||
@ -277,14 +188,14 @@ Foam::labelList Foam::coordinateSystems::indices(const keyType& key) const
|
||||
else if (key.isPattern())
|
||||
{
|
||||
// Match as regex
|
||||
regExp matcher(key);
|
||||
return indicesImpl(*this, matcher);
|
||||
const regExp matcher(key);
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compare as literal string
|
||||
const word& matcher = key;
|
||||
return indicesImpl(*this, matcher);
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,7 +206,7 @@ Foam::labelList Foam::coordinateSystems::indices(const wordRes& matcher) const
|
||||
{
|
||||
return labelList();
|
||||
}
|
||||
return indicesImpl(*this, matcher);
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
|
||||
|
||||
@ -305,18 +216,17 @@ Foam::label Foam::coordinateSystems::findIndex(const keyType& key) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (key.isPattern())
|
||||
else if (key.isPattern())
|
||||
{
|
||||
// Find as regex
|
||||
regExp matcher(key);
|
||||
return findIndexImpl(*this, matcher);
|
||||
const regExp matcher(key);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find as literal string
|
||||
const word& matcher = key;
|
||||
return findIndexImpl(*this, matcher);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,7 +237,7 @@ Foam::label Foam::coordinateSystems::findIndex(const wordRes& matcher) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return findIndexImpl(*this, matcher);
|
||||
return PtrListOps::firstMatching(*this, matcher);
|
||||
}
|
||||
|
||||
|
||||
@ -384,17 +294,7 @@ Foam::coordinateSystems::lookup(const word& name) const
|
||||
|
||||
Foam::wordList Foam::coordinateSystems::names() const
|
||||
{
|
||||
const PtrList<coordinateSystem>& list = *this;
|
||||
|
||||
wordList result(list.size());
|
||||
|
||||
forAll(list, i)
|
||||
{
|
||||
result[i] = list[i].name();
|
||||
}
|
||||
|
||||
return result;
|
||||
// return ListOps::create<word>(list, nameOp<coordinateSystem>());
|
||||
return PtrListOps::names(*this, predicates::always{});
|
||||
}
|
||||
|
||||
|
||||
@ -407,27 +307,27 @@ Foam::wordList Foam::coordinateSystems::names(const keyType& key) const
|
||||
else if (key.isPattern())
|
||||
{
|
||||
// Find as regex
|
||||
regExp matcher(key);
|
||||
return namesImpl(*this, matcher, false);
|
||||
const regExp matcher(key);
|
||||
return PtrListOps::names(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find as literal string
|
||||
const word& matcher = key;
|
||||
return namesImpl(*this, matcher, false);
|
||||
return PtrListOps::names(*this, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::coordinateSystems::names(const wordRe& matcher) const
|
||||
{
|
||||
return namesImpl(*this, matcher, false);
|
||||
return PtrListOps::names(*this, matcher);
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::coordinateSystems::names(const wordRes& matcher) const
|
||||
{
|
||||
return namesImpl(*this, matcher, false);
|
||||
return PtrListOps::names(*this, matcher);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user