mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add ZoneMesh::inZone method that returns a PackedBoolList
- useful for generating combined zones. Eg,
cellZone combined
(
"combinedZone",
czm.inZone(key).used(),
ZoneI,
*this
);
This commit is contained in:
@ -1223,7 +1223,7 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
label patchStart = procPatch.start()-mesh.nInternalFaces();
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr <<
|
||||
toNbr <<
|
||||
SubField<T>
|
||||
(
|
||||
faceValues,
|
||||
@ -1423,7 +1423,7 @@ void Foam::syncTools::syncFaceList
|
||||
cop(t, val1);
|
||||
faceValues[meshFace0] = t;
|
||||
|
||||
cop(val1, val0);
|
||||
cop(val1, val0);
|
||||
faceValues[meshFace1] = val1;
|
||||
}
|
||||
}
|
||||
@ -1683,7 +1683,7 @@ void Foam::syncTools::syncEdgeList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
// Receive from neighbour.
|
||||
// Receive from neighbour.
|
||||
List<unsigned int> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
|
||||
@ -302,6 +302,24 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findIndex
|
||||
}
|
||||
|
||||
|
||||
template<class ZoneType, class MeshType>
|
||||
Foam::PackedBoolList Foam::ZoneMesh<ZoneType, MeshType>::inZone
|
||||
(
|
||||
const keyType& key
|
||||
) const
|
||||
{
|
||||
PackedBoolList lst;
|
||||
|
||||
const labelList indices = this->findIndices(key);
|
||||
forAll(indices, i)
|
||||
{
|
||||
lst |= static_cast<const labelList&>(this->operator[](indices[i]));
|
||||
}
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
|
||||
template<class ZoneType, class MeshType>
|
||||
Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findZoneID
|
||||
(
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::ZoneMesh
|
||||
|
||||
Description
|
||||
List of mesh zones
|
||||
A list of mesh zones.
|
||||
|
||||
SourceFiles
|
||||
ZoneMesh.C
|
||||
@ -37,8 +37,9 @@ SourceFiles
|
||||
|
||||
#include "List.H"
|
||||
#include "regIOobject.H"
|
||||
#include "HashSet.H"
|
||||
#include "pointFieldsFwd.H"
|
||||
#include "Map.H"
|
||||
#include "PackedBoolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -140,6 +141,9 @@ public:
|
||||
//- Return zone index for the first match, return -1 if not found
|
||||
label findIndex(const keyType&) const;
|
||||
|
||||
//- Mark all elements that are in the matching zones
|
||||
PackedBoolList inZone(const keyType&) const;
|
||||
|
||||
//- Clear addressing
|
||||
void clearAddressing();
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ const char * const Foam::cellZone::labelsName = "cellLabels";
|
||||
Foam::cellZone::cellZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const cellZoneMesh& zm
|
||||
)
|
||||
@ -86,7 +86,7 @@ Foam::cellZone::cellZone
|
||||
Foam::cellZone::cellZone
|
||||
(
|
||||
const cellZone& cz,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const cellZoneMesh& zm
|
||||
)
|
||||
@ -154,7 +154,14 @@ void Foam::cellZone::operator=(const cellZone& zn)
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellZone::operator=(const labelList& addr)
|
||||
void Foam::cellZone::operator=(const unallocLabelList& addr)
|
||||
{
|
||||
clearAddressing();
|
||||
labelList::operator=(addr);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellZone::operator=(const Xfer<labelList>& addr)
|
||||
{
|
||||
clearAddressing();
|
||||
labelList::operator=(addr);
|
||||
|
||||
@ -113,7 +113,7 @@ public:
|
||||
cellZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
);
|
||||
@ -141,7 +141,7 @@ public:
|
||||
cellZone
|
||||
(
|
||||
const cellZone&,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
);
|
||||
@ -169,7 +169,7 @@ public:
|
||||
// and zone mesh
|
||||
virtual autoPtr<cellZone> clone
|
||||
(
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const cellZoneMesh& zm
|
||||
) const
|
||||
@ -215,11 +215,14 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assign to zone clearing demand-driven data
|
||||
//- Assign to zone, clearing demand-driven data
|
||||
void operator=(const cellZone&);
|
||||
|
||||
//- Assign addressing clearing demand-driven data
|
||||
void operator=(const labelList&);
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const unallocLabelList&);
|
||||
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const Xfer<labelList>&);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
@ -180,7 +180,7 @@ void Foam::faceZone::checkAddressing() const
|
||||
Foam::faceZone::faceZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const boolList& fm,
|
||||
const label index,
|
||||
const faceZoneMesh& zm
|
||||
@ -242,7 +242,7 @@ Foam::faceZone::faceZone
|
||||
Foam::faceZone::faceZone
|
||||
(
|
||||
const faceZone& fz,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const boolList& fm,
|
||||
const label index,
|
||||
const faceZoneMesh& zm
|
||||
@ -392,7 +392,7 @@ void Foam::faceZone::clearAddressing()
|
||||
|
||||
void Foam::faceZone::resetAddressing
|
||||
(
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const boolList& flipMap
|
||||
)
|
||||
{
|
||||
@ -414,7 +414,7 @@ void Foam::faceZone::updateMesh(const mapPolyMesh& mpm)
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
label faceI = operator[](i);
|
||||
const label faceI = operator[](i);
|
||||
|
||||
if (faceMap[faceI] >= 0)
|
||||
{
|
||||
@ -454,7 +454,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
|
||||
boolList neiZoneFlip(mesh.nFaces()-mesh.nInternalFaces(), false);
|
||||
forAll(*this, i)
|
||||
{
|
||||
label faceI = operator[](i);
|
||||
const label faceI = operator[](i);
|
||||
|
||||
if (!mesh.isInternalFace(faceI))
|
||||
{
|
||||
@ -469,13 +469,12 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
label faceI = operator[](i);
|
||||
|
||||
label patchI = bm.whichPatch(faceI);
|
||||
const label faceI = operator[](i);
|
||||
const label patchI = bm.whichPatch(faceI);
|
||||
|
||||
if (patchI != -1 && bm[patchI].coupled())
|
||||
{
|
||||
label bFaceI = faceI-mesh.nInternalFaces();
|
||||
const label bFaceI = faceI-mesh.nInternalFaces();
|
||||
|
||||
// Check face in zone on both sides
|
||||
if (myZoneFace[bFaceI] != neiZoneFace[bFaceI])
|
||||
|
||||
@ -154,7 +154,7 @@ public:
|
||||
faceZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const boolList& fm,
|
||||
const label index,
|
||||
const faceZoneMesh& zm
|
||||
@ -184,7 +184,7 @@ public:
|
||||
faceZone
|
||||
(
|
||||
const faceZone&,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const boolList& fm,
|
||||
const label index,
|
||||
const faceZoneMesh&
|
||||
@ -214,7 +214,7 @@ public:
|
||||
// and zone mesh
|
||||
virtual autoPtr<faceZone> clone
|
||||
(
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const boolList& fm,
|
||||
const label index,
|
||||
const faceZoneMesh& zm
|
||||
@ -279,7 +279,7 @@ public:
|
||||
virtual void clearAddressing();
|
||||
|
||||
//- Reset addressing and flip map (clearing demand-driven data)
|
||||
virtual void resetAddressing(const labelList&, const boolList&);
|
||||
virtual void resetAddressing(const unallocLabelList&, const boolList&);
|
||||
|
||||
//- Check zone definition. Return true if in error.
|
||||
virtual bool checkDefinition(const bool report = false) const;
|
||||
|
||||
@ -46,7 +46,7 @@ const char* const Foam::pointZone::labelsName = "pointLabels";
|
||||
Foam::pointZone::pointZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const pointZoneMesh& zm
|
||||
)
|
||||
@ -85,7 +85,7 @@ Foam::pointZone::pointZone
|
||||
Foam::pointZone::pointZone
|
||||
(
|
||||
const pointZone& pz,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const pointZoneMesh& zm
|
||||
)
|
||||
@ -154,7 +154,14 @@ void Foam::pointZone::operator=(const pointZone& zn)
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointZone::operator=(const labelList& addr)
|
||||
void Foam::pointZone::operator=(const unallocLabelList& addr)
|
||||
{
|
||||
clearAddressing();
|
||||
labelList::operator=(addr);
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointZone::operator=(const Xfer<labelList>& addr)
|
||||
{
|
||||
clearAddressing();
|
||||
labelList::operator=(addr);
|
||||
|
||||
@ -112,7 +112,7 @@ public:
|
||||
pointZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
);
|
||||
@ -140,7 +140,7 @@ public:
|
||||
pointZone
|
||||
(
|
||||
const pointZone&,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
);
|
||||
@ -170,7 +170,7 @@ public:
|
||||
(
|
||||
const pointZoneMesh& zm,
|
||||
const label index,
|
||||
const labelList& addr
|
||||
const unallocLabelList& addr
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointZone>
|
||||
@ -218,11 +218,14 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assign to zone clearing demand-driven data
|
||||
//- Assign to zone, clearing demand-driven data
|
||||
void operator=(const pointZone&);
|
||||
|
||||
//- Assign addressing clearing demand-driven data
|
||||
void operator=(const labelList&);
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const unallocLabelList&);
|
||||
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const Xfer<labelList>&);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
@ -85,7 +85,7 @@ void Foam::zone::calcLookupMap() const
|
||||
Foam::zone::zone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index
|
||||
)
|
||||
:
|
||||
@ -128,7 +128,7 @@ Foam::zone::zone
|
||||
Foam::zone::zone
|
||||
(
|
||||
const zone& z,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index
|
||||
)
|
||||
:
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
zone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index
|
||||
);
|
||||
|
||||
@ -127,7 +127,7 @@ public:
|
||||
zone
|
||||
(
|
||||
const zone&,
|
||||
const labelList& addr,
|
||||
const unallocLabelList& addr,
|
||||
const label index
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user