mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: simpler topoSet handling of zone/set
- support construct faceZoneSet from faceSet (#3126) ENH: support unregistered loading of cell/face/point sets
This commit is contained in:
@ -160,7 +160,7 @@ bool Foam::fvMeshSubsetProxy::correct(bool verbose)
|
|||||||
Info<< "Subsetting mesh based on cellSet " << name_ << endl;
|
Info<< "Subsetting mesh based on cellSet " << name_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
cellSet cset(baseMesh_, name_);
|
cellSet cset(baseMesh_, name_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
selectedCells.resize(nCells);
|
selectedCells.resize(nCells);
|
||||||
for (const label idx : cset)
|
for (const label idx : cset)
|
||||||
|
|||||||
@ -114,7 +114,7 @@ void Foam::cellToCell::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cellSet loadedSet(mesh_, setName);
|
cellSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
set.addSet(loadedSet);
|
set.addSet(loadedSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ void Foam::cellToCell::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cellSet loadedSet(mesh_, setName);
|
cellSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
set.subtractSet(loadedSet);
|
set.subtractSet(loadedSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,8 +146,7 @@ void Foam::faceToCell::combine
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load the set
|
// Load the set
|
||||||
faceSet loadedSet(mesh_, setName);
|
faceSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
const labelHashSet& faceLabels = loadedSet;
|
const labelHashSet& faceLabels = loadedSet;
|
||||||
|
|
||||||
combineImpl(set, add, faceLabels);
|
combineImpl(set, add, faceLabels);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -83,9 +83,11 @@ void Foam::haloToCell::combine(topoSet& set, const bool add) const
|
|||||||
// The starting set of cells
|
// The starting set of cells
|
||||||
bitSet current(cells.size());
|
bitSet current(cells.size());
|
||||||
|
|
||||||
if (isA<topoBitSet>(set))
|
const auto* topoBitsPtr = isA<topoBitSet>(set);
|
||||||
|
|
||||||
|
if (topoBitsPtr)
|
||||||
{
|
{
|
||||||
current |= refCast<const topoBitSet>(set).addressing();
|
current |= topoBitsPtr->addressing();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -126,8 +126,7 @@ void Foam::pointToCell::combine
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load the set
|
// Load the set
|
||||||
pointSet loadedSet(mesh_, setName);
|
pointSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
const labelHashSet& pointLabels = loadedSet;
|
const labelHashSet& pointLabels = loadedSet;
|
||||||
|
|
||||||
combineImpl(set, add, pointLabels);
|
combineImpl(set, add, pointLabels);
|
||||||
|
|||||||
@ -351,8 +351,7 @@ void Foam::regionToCell::combine(topoSet& set, const bool add) const
|
|||||||
if (isZone_)
|
if (isZone_)
|
||||||
{
|
{
|
||||||
Info<< " Using cellZone " << setName_
|
Info<< " Using cellZone " << setName_
|
||||||
<< " to delimit search region."
|
<< " to delimit search region." << nl;
|
||||||
<< endl;
|
|
||||||
|
|
||||||
selectedCell = false;
|
selectedCell = false;
|
||||||
for (const label celli : mesh_.cellZones()[setName_])
|
for (const label celli : mesh_.cellZones()[setName_])
|
||||||
@ -363,10 +362,9 @@ void Foam::regionToCell::combine(topoSet& set, const bool add) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< " Loading cellSet " << setName_
|
Info<< " Loading cellSet " << setName_
|
||||||
<< " to delimit search region."
|
<< " to delimit search region." << nl;
|
||||||
<< endl;
|
|
||||||
|
|
||||||
cellSet subSet(mesh_, setName_);
|
cellSet subSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
selectedCell = false;
|
selectedCell = false;
|
||||||
for (const label celli : subSet)
|
for (const label celli : subSet)
|
||||||
@ -428,14 +426,14 @@ Foam::regionToCell::regionToCell
|
|||||||
),
|
),
|
||||||
nErode_(dict.getCheckOrDefault<label>("nErode", 0, labelMinMax::ge(0)))
|
nErode_(dict.getCheckOrDefault<label>("nErode", 0, labelMinMax::ge(0)))
|
||||||
{
|
{
|
||||||
// A single set or zone only!
|
// A single "set" or "zone" only
|
||||||
if (dict.readIfPresent("set", setName_))
|
if (!dict.readIfPresent("set", setName_))
|
||||||
{
|
{
|
||||||
isZone_ = false;
|
// Optional entry
|
||||||
}
|
if (dict.readIfPresent("zone", setName_))
|
||||||
else if (dict.readIfPresent("zone", setName_))
|
{
|
||||||
{
|
isZone_ = true;
|
||||||
isZone_ = true;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,7 +73,7 @@ Usage
|
|||||||
source | Source name: regionToCell | word | yes | -
|
source | Source name: regionToCell | word | yes | -
|
||||||
insidePoints | Coordinate(s) that is inside connected region <!--
|
insidePoints | Coordinate(s) that is inside connected region <!--
|
||||||
--> | vectorList | yes | -
|
--> | vectorList | yes | -
|
||||||
set | Name of cellSet giving mesh subset | word | no | none
|
set / zone | Name of cellSet / zone giving mesh subset | word | no | -
|
||||||
nErode | Number of cell layers to erode mesh to detect holes <!--
|
nErode | Number of cell layers to erode mesh to detect holes <!--
|
||||||
--> in the mesh - set to 0 if not used | label | no | 0
|
--> in the mesh - set to 0 if not used | label | no | 0
|
||||||
\endtable
|
\endtable
|
||||||
|
|||||||
@ -133,13 +133,13 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
|
|||||||
<< maskSetName_ << endl;
|
<< maskSetName_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
maskSet = false;
|
cellSet subset(mesh_, maskSetName_, IOobject::NO_REGISTER);
|
||||||
cellSet subset(mesh_, maskSetName_);
|
|
||||||
|
|
||||||
const labelHashSet& cellLabels = subset;
|
const labelHashSet& cellLabels = subset;
|
||||||
|
|
||||||
|
maskSet = false;
|
||||||
maskSet.setMany(cellLabels.begin(), cellLabels.end());
|
maskSet.setMany(cellLabels.begin(), cellLabels.end());
|
||||||
|
|
||||||
nTotCells = returnReduce(subset.size(), sumOp<label>());
|
nTotCells = returnReduce(cellLabels.size(), sumOp<label>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -114,12 +114,12 @@ void Foam::setToCellZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the sets
|
// Load the sets
|
||||||
cellSet fSet(mesh_, setName_);
|
cellSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
// Start off from copy
|
// Start off from copy
|
||||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||||
|
|
||||||
for (const label celli : fSet)
|
for (const label celli : loadedSet)
|
||||||
{
|
{
|
||||||
if (!zoneSet.found(celli))
|
if (!zoneSet.found(celli))
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ void Foam::setToCellZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the set
|
// Load the set
|
||||||
cellSet loadedSet(mesh_, setName_);
|
cellSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
// Start off empty
|
// Start off empty
|
||||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||||
|
|||||||
@ -221,11 +221,11 @@ void Foam::cellToFace::combine
|
|||||||
// Load the set
|
// Load the set
|
||||||
if (!exists(mesh_.time().path()/topoSet::localPath(mesh_, setName)))
|
if (!exists(mesh_.time().path()/topoSet::localPath(mesh_, setName)))
|
||||||
{
|
{
|
||||||
SeriousError<< "Cannot load set "
|
SeriousError
|
||||||
<< setName << endl;
|
<< "Cannot load set " << setName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
cellSet loadedSet(mesh_, setName);
|
cellSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
const labelHashSet& cellLabels = loadedSet;
|
const labelHashSet& cellLabels = loadedSet;
|
||||||
|
|
||||||
combineImpl(set, add, cellLabels);
|
combineImpl(set, add, cellLabels);
|
||||||
|
|||||||
@ -114,7 +114,7 @@ void Foam::faceToFace::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
faceSet loadedSet(mesh_, setName);
|
faceSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
set.addSet(loadedSet);
|
set.addSet(loadedSet);
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ void Foam::faceToFace::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
faceSet loadedSet(mesh_, setName);
|
faceSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
set.subtractSet(loadedSet);
|
set.subtractSet(loadedSet);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1148,7 +1148,7 @@ void Foam::holeToFace::applyToSet
|
|||||||
bitSet isBlockedFace(mesh_.nFaces());
|
bitSet isBlockedFace(mesh_.nFaces());
|
||||||
for (const word& setName : blockedFaceNames_)
|
for (const word& setName : blockedFaceNames_)
|
||||||
{
|
{
|
||||||
const faceSet loadedSet(mesh_, setName);
|
faceSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
isBlockedFace.setMany(loadedSet.begin(), loadedSet.end());
|
isBlockedFace.setMany(loadedSet.begin(), loadedSet.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1158,7 +1158,7 @@ void Foam::holeToFace::applyToSet
|
|||||||
{
|
{
|
||||||
for (const word& setName : blockedCellNames_)
|
for (const word& setName : blockedCellNames_)
|
||||||
{
|
{
|
||||||
const cellSet loadedSet(mesh_, setName);
|
cellSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
isCandidateCell.setMany(loadedSet.begin(), loadedSet.end());
|
isCandidateCell.setMany(loadedSet.begin(), loadedSet.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,8 +172,7 @@ void Foam::pointToFace::combine
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load the set
|
// Load the set
|
||||||
pointSet loadedSet(mesh_, setName);
|
pointSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
const labelHashSet& pointLabels = loadedSet;
|
const labelHashSet& pointLabels = loadedSet;
|
||||||
|
|
||||||
combineImpl(set, add, pointLabels);
|
combineImpl(set, add, pointLabels);
|
||||||
|
|||||||
@ -146,7 +146,7 @@ void Foam::regionToFace::combine
|
|||||||
if (verbose_)
|
if (verbose_)
|
||||||
{
|
{
|
||||||
Info<< " Loading subset " << setName_
|
Info<< " Loading subset " << setName_
|
||||||
<< " to delimit search region." << endl;
|
<< " to delimit search region." << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
indirectPrimitivePatch patch
|
indirectPrimitivePatch patch
|
||||||
@ -236,12 +236,10 @@ Foam::regionToFace::regionToFace
|
|||||||
isZone_(false),
|
isZone_(false),
|
||||||
nearPoint_(dict.get<point>("nearPoint"))
|
nearPoint_(dict.get<point>("nearPoint"))
|
||||||
{
|
{
|
||||||
if (dict.readIfPresent("set", setName_))
|
// A single "set" or "zone" only
|
||||||
{
|
if (!dict.readIfPresent("set", setName_))
|
||||||
isZone_ = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
// Mandatory entry
|
||||||
dict.readEntry("zone", setName_);
|
dict.readEntry("zone", setName_);
|
||||||
isZone_ = true;
|
isZone_ = true;
|
||||||
}
|
}
|
||||||
@ -285,7 +283,7 @@ void Foam::regionToFace::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
faceSet subSet(mesh_, setName_);
|
faceSet subSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
combine(set, true, subSet.sortedToc());
|
combine(set, true, subSet.sortedToc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -305,7 +303,7 @@ void Foam::regionToFace::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
faceSet subSet(mesh_, setName_);
|
faceSet subSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
combine(set, false, subSet.sortedToc());
|
combine(set, false, subSet.sortedToc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ Usage
|
|||||||
type | Type name: faceSet | word | yes | -
|
type | Type name: faceSet | word | yes | -
|
||||||
action | Action applied on faces - see below | word | yes | -
|
action | Action applied on faces - see below | word | yes | -
|
||||||
source | Source name: regionToFace | word | yes | -
|
source | Source name: regionToFace | word | yes | -
|
||||||
set | Name of faceSet restricting search | word | yes | -
|
set / zone | Name of faceSet / zone restricting search | word | yes | -
|
||||||
nearPoint | The point on/near to the region | vector | yes | -
|
nearPoint | The point on/near to the region | vector | yes | -
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
@ -81,8 +81,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef regionToFace_H
|
#ifndef Foam_regionToFace_H
|
||||||
#define regionToFace_H
|
#define Foam_regionToFace_H
|
||||||
|
|
||||||
#include "topoSetFaceSource.H"
|
#include "topoSetFaceSource.H"
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
|
|||||||
@ -230,7 +230,7 @@ void Foam::cellToFaceZone::applyToSet
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load the sets
|
// Load the sets
|
||||||
const cellSet loadedSet(mesh_, setName);
|
cellSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
whichCells.setMany(loadedSet.begin(), loadedSet.end());
|
whichCells.setMany(loadedSet.begin(), loadedSet.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ void Foam::cellToFaceZone::applyToSet
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load the sets
|
// Load the sets
|
||||||
const cellSet loadedSet(mesh_, setName);
|
cellSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
whichCells.setMany(loadedSet.begin(), loadedSet.end());
|
whichCells.setMany(loadedSet.begin(), loadedSet.end());
|
||||||
}
|
}
|
||||||
// Select outside faces
|
// Select outside faces
|
||||||
|
|||||||
@ -128,8 +128,8 @@ void Foam::setAndNormalToFaceZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the sets
|
// Load the sets
|
||||||
faceSet loadedSet(mesh_, setName_);
|
faceSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
labelHashSet& faceIds = loadedSet;
|
const labelHashSet& faceLabels = loadedSet;
|
||||||
|
|
||||||
// Start off from copy
|
// Start off from copy
|
||||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||||
@ -138,7 +138,7 @@ void Foam::setAndNormalToFaceZone::applyToSet
|
|||||||
const faceList& faces = mesh_.faces();
|
const faceList& faces = mesh_.faces();
|
||||||
const pointField& points = mesh_.points();
|
const pointField& points = mesh_.points();
|
||||||
|
|
||||||
for (const label facei : faceIds)
|
for (const label facei : faceLabels)
|
||||||
{
|
{
|
||||||
if (!zoneSet.found(facei))
|
if (!zoneSet.found(facei))
|
||||||
{
|
{
|
||||||
@ -169,7 +169,7 @@ void Foam::setAndNormalToFaceZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the set
|
// Load the set
|
||||||
faceSet loadedSet(mesh_, setName_);
|
faceSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
// Start off empty
|
// Start off empty
|
||||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||||
|
|||||||
@ -122,7 +122,7 @@ void Foam::setToFaceZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the sets
|
// Load the sets
|
||||||
faceSet loadedSet(mesh_, setName_);
|
faceSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
const labelHashSet& faceLabels = loadedSet;
|
const labelHashSet& faceLabels = loadedSet;
|
||||||
|
|
||||||
// Start off from copy
|
// Start off from copy
|
||||||
@ -151,7 +151,7 @@ void Foam::setToFaceZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the set
|
// Load the set
|
||||||
faceSet loadedSet(mesh_, setName_);
|
faceSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
// Start off empty
|
// Start off empty
|
||||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||||
|
|||||||
@ -135,8 +135,8 @@ void Foam::setsToFaceZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the sets
|
// Load the sets
|
||||||
faceSet fSet(mesh_, faceSetName_);
|
faceSet fSet(mesh_, faceSetName_, IOobject::NO_REGISTER);
|
||||||
cellSet cSet(mesh_, cellSetName_);
|
cellSet cSet(mesh_, cellSetName_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
// Start off from copy
|
// Start off from copy
|
||||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||||
|
|||||||
@ -70,7 +70,7 @@ void Foam::cellToPoint::combineImpl
|
|||||||
const Selector& cellLabels
|
const Selector& cellLabels
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Add all point from cells in loadedSet
|
// Add all points from given cells
|
||||||
for (const label celli : cellLabels)
|
for (const label celli : cellLabels)
|
||||||
{
|
{
|
||||||
const labelList& cFaces = mesh_.cells()[celli];
|
const labelList& cFaces = mesh_.cells()[celli];
|
||||||
@ -101,8 +101,7 @@ void Foam::cellToPoint::combine
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load the set
|
// Load the set
|
||||||
cellSet loadedSet(mesh_, setName);
|
cellSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
const labelHashSet& cellLabels = loadedSet;
|
const labelHashSet& cellLabels = loadedSet;
|
||||||
|
|
||||||
combineImpl(set, add, cellLabels);
|
combineImpl(set, add, cellLabels);
|
||||||
|
|||||||
@ -72,7 +72,7 @@ void Foam::faceToPoint::combine
|
|||||||
{
|
{
|
||||||
const auto& faceLabels = mesh_.faceZones()[setName].addressing();
|
const auto& faceLabels = mesh_.faceZones()[setName].addressing();
|
||||||
|
|
||||||
// Add all points from faces in loadedSet
|
// Add all points from given faces
|
||||||
for (const label facei : faceLabels)
|
for (const label facei : faceLabels)
|
||||||
{
|
{
|
||||||
const face& f = mesh_.faces()[facei];
|
const face& f = mesh_.faces()[facei];
|
||||||
@ -83,10 +83,10 @@ void Foam::faceToPoint::combine
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load the set
|
// Load the set
|
||||||
faceSet loadedSet(mesh_, setName);
|
faceSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
const labelHashSet& faceLabels = loadedSet;
|
const labelHashSet& faceLabels = loadedSet;
|
||||||
|
|
||||||
// Add all points from faces in loadedSet
|
// Add all points from given faces
|
||||||
for (const label facei : faceLabels)
|
for (const label facei : faceLabels)
|
||||||
{
|
{
|
||||||
const face& f = mesh_.faces()[facei];
|
const face& f = mesh_.faces()[facei];
|
||||||
|
|||||||
@ -114,7 +114,7 @@ void Foam::pointToPoint::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pointSet loadedSet(mesh_, setName);
|
pointSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
set.addSet(loadedSet);
|
set.addSet(loadedSet);
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ void Foam::pointToPoint::applyToSet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pointSet loadedSet(mesh_, setName);
|
pointSet loadedSet(mesh_, setName, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
set.subtractSet(loadedSet);
|
set.subtractSet(loadedSet);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ void Foam::setToPointZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the set
|
// Load the set
|
||||||
pointSet loadedSet(mesh_, setName_);
|
pointSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
const labelHashSet& pointLabels = loadedSet;
|
const labelHashSet& pointLabels = loadedSet;
|
||||||
|
|
||||||
// Start off from copy
|
// Start off from copy
|
||||||
@ -140,7 +140,7 @@ void Foam::setToPointZone::applyToSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the set
|
// Load the set
|
||||||
pointSet loadedSet(mesh_, setName_);
|
pointSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
|
|
||||||
// Start off empty
|
// Start off empty
|
||||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,18 +34,12 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(cellBitSet, 0);
|
defineTypeName(cellBitSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::cellBitSet::cellBitSet(const polyMesh& mesh)
|
|
||||||
:
|
|
||||||
cellBitSet(mesh, false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::cellBitSet::cellBitSet(const polyMesh& mesh, const bool val)
|
Foam::cellBitSet::cellBitSet(const polyMesh& mesh, const bool val)
|
||||||
:
|
:
|
||||||
topoBitSet(mesh, "cellBitSet", mesh.nCells(), val)
|
topoBitSet(mesh, "cellBitSet", mesh.nCells(), val)
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -96,16 +96,14 @@ class cellBitSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("cellBitSet");
|
TypeNameNoDebug("cellBitSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct with nCells elements, all elements unset
|
//- Construct with nCells elements,
|
||||||
explicit cellBitSet(const polyMesh& mesh);
|
//- all elements unset or initial value
|
||||||
|
explicit cellBitSet(const polyMesh& mesh, const bool val = false);
|
||||||
//- Construct with nCells elements, using initial val
|
|
||||||
cellBitSet(const polyMesh& mesh, const bool val);
|
|
||||||
|
|
||||||
//- Copy construct from bitset, resizing to nCells elements as required
|
//- Copy construct from bitset, resizing to nCells elements as required
|
||||||
cellBitSet(const polyMesh& mesh, const bitSet& bits);
|
cellBitSet(const polyMesh& mesh, const bitSet& bits);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,11 +37,10 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(cellSet, 0);
|
defineTypeName(cellSet);
|
||||||
|
addToRunTimeSelectionTable(topoSet, cellSet, word);
|
||||||
addToRunTimeSelectionTable(topoSet, cellSet, word);
|
addToRunTimeSelectionTable(topoSet, cellSet, size);
|
||||||
addToRunTimeSelectionTable(topoSet, cellSet, size);
|
addToRunTimeSelectionTable(topoSet, cellSet, set);
|
||||||
addToRunTimeSelectionTable(topoSet, cellSet, set);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,18 +52,24 @@ Foam::cellSet::cellSet(const IOobject& io)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::cellSet::cellSet(const IOobject& io, const Foam::zero)
|
||||||
|
:
|
||||||
|
topoSet(io, Foam::zero{})
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::cellSet::cellSet
|
Foam::cellSet::cellSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSet(mesh, typeName, name, rOpt, wOpt)
|
topoSet(mesh, typeName, name, rOpt, wOpt, reg)
|
||||||
{
|
{
|
||||||
// Make sure set within valid range
|
check(mesh.nCells()); // Valid range?
|
||||||
check(mesh.nCells());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,11 +77,11 @@ Foam::cellSet::cellSet
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSet(mesh, name, size, wOpt)
|
topoSet(mesh, name, initialCapacity, wOpt)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -149,14 +154,14 @@ Foam::cellSet::cellSet
|
|||||||
(
|
(
|
||||||
const Time& runTime,
|
const Time& runTime,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSet
|
topoSet
|
||||||
(
|
(
|
||||||
findIOobject(runTime, name, IOobject::NO_READ, wOpt),
|
findIOobject(runTime, name, IOobject::NO_READ, wOpt),
|
||||||
size
|
initialCapacity
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -177,6 +182,28 @@ Foam::cellSet::cellSet
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::labelHashSet Foam::cellSet::readContents
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
cellSet reader
|
||||||
|
(
|
||||||
|
topoSet::findIOobject(mesh, name, IOobjectOption::NO_REGISTER),
|
||||||
|
Foam::zero{}
|
||||||
|
);
|
||||||
|
|
||||||
|
labelHashSet labels;
|
||||||
|
reader.readIOcontents(typeName, labels);
|
||||||
|
reader.checkLabels(labels, mesh.nCells()); // Valid range?
|
||||||
|
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::label Foam::cellSet::maxSize(const polyMesh& mesh) const
|
Foam::label Foam::cellSet::maxSize(const polyMesh& mesh) const
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,7 +62,7 @@ class cellSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("cellSet");
|
TypeNameNoDebug("cellSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -70,25 +70,43 @@ public:
|
|||||||
//- Construct from IOobject. No checking.
|
//- Construct from IOobject. No checking.
|
||||||
explicit cellSet(const IOobject& io);
|
explicit cellSet(const IOobject& io);
|
||||||
|
|
||||||
//- Construct from polyMesh and name. Checks for valid cell ids.
|
//- Construct empty (no-read) with IOobject information
|
||||||
|
cellSet(const IOobject& io, const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct from polyMesh (registry) and name.
|
||||||
|
//- Checks for valid cell ids.
|
||||||
cellSet
|
cellSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct empty with initial size for labelHashSet
|
//- Construct from polyMesh (registry), name and registration option
|
||||||
cellSet
|
cellSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
IOobjectOption::registerOption reg,
|
||||||
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cellSet(mesh, name, rOpt, wOpt, reg)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Construct empty (no-read) with initial labelHashSet capacity
|
||||||
|
cellSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from existing set
|
//- Copy construct (no-read) from existing set
|
||||||
cellSet
|
cellSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -97,7 +115,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy of labelHashSet
|
//- Copy construct (no-read) from labelHashSet,
|
||||||
|
//- with search for IOobject instance.
|
||||||
cellSet
|
cellSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -106,7 +125,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with moving labelHashSet
|
//- Move construct (no-read) from labelHashSet,
|
||||||
|
//- with search for IOobject instance.
|
||||||
cellSet
|
cellSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -115,7 +135,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy labels
|
//- Copy construct (no-read) from labels,
|
||||||
|
//- with search for IOobject instance.
|
||||||
cellSet
|
cellSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -125,34 +146,46 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Used for tetMesh cellSet only.
|
//- Construct from objectRegistry and name.
|
||||||
|
//- Used for tetMesh cellSet only.
|
||||||
|
cellSet
|
||||||
|
(
|
||||||
|
const Time&,
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from objectRegistry and name.
|
//- Construct empty (no-read) with initial labelHashSet capacity
|
||||||
cellSet
|
//- from objectRegistry.
|
||||||
(
|
//- Used for tetMesh cellSet only.
|
||||||
const Time&,
|
cellSet
|
||||||
const word& name,
|
(
|
||||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
const Time&,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
const word& name,
|
||||||
);
|
const label initialCapacity,
|
||||||
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct empty from objectRegistry.
|
//- Copy construct (no-read) from labelHashSet.
|
||||||
cellSet
|
//- Used for tetMesh cellSet only.
|
||||||
(
|
cellSet
|
||||||
const Time&,
|
(
|
||||||
const word& name,
|
const Time&,
|
||||||
const label size,
|
const word& name,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
const labelHashSet& labels,
|
||||||
);
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from labelHashSet
|
|
||||||
cellSet
|
// Factory Methods
|
||||||
(
|
|
||||||
const Time&,
|
//- Read and return contents. Intermediate IOobject is not registered
|
||||||
const word& name,
|
static labelHashSet readContents
|
||||||
const labelHashSet& labels,
|
(
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
const polyMesh& mesh,
|
||||||
);
|
const word& name
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022,2024 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,18 +36,18 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(cellZoneSet, 0);
|
defineTypeName(cellZoneSet);
|
||||||
addToRunTimeSelectionTable(topoSet, cellZoneSet, word);
|
addToRunTimeSelectionTable(topoSet, cellZoneSet, word);
|
||||||
addToRunTimeSelectionTable(topoSet, cellZoneSet, size);
|
addToRunTimeSelectionTable(topoSet, cellZoneSet, size);
|
||||||
addToRunTimeSelectionTable(topoSet, cellZoneSet, set);
|
addToRunTimeSelectionTable(topoSet, cellZoneSet, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::cellZoneSet::updateSet()
|
void Foam::cellZoneSet::updateSet()
|
||||||
{
|
{
|
||||||
labelList order(sortedOrder(addressing_));
|
Foam::sort(addressing_);
|
||||||
inplaceReorder(order, addressing_);
|
|
||||||
|
|
||||||
cellSet::clearStorage();
|
cellSet::clearStorage();
|
||||||
cellSet::reserve(addressing_.size());
|
cellSet::reserve(addressing_.size());
|
||||||
@ -61,46 +61,46 @@ Foam::cellZoneSet::cellZoneSet
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSet(mesh, name, 1024), // do not read cellSet
|
cellSet(mesh, name, initialCapacity, wOpt), // Construct no-read
|
||||||
mesh_(mesh),
|
mesh_(mesh)
|
||||||
addressing_()
|
{}
|
||||||
{
|
|
||||||
const cellZoneMesh& cellZones = mesh.cellZones();
|
|
||||||
label zoneID = cellZones.findZoneID(name);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
IOobjectOption::isReadRequired(rOpt)
|
|
||||||
|| (IOobjectOption::isReadOptional(rOpt) && zoneID != -1)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const cellZone& fz = cellZones[zoneID];
|
|
||||||
addressing_ = fz;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSet();
|
|
||||||
|
|
||||||
check(mesh.nCells());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::cellZoneSet::cellZoneSet
|
Foam::cellZoneSet::cellZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSet(mesh, name, size, wOpt),
|
cellZoneSet(mesh, name, label(0), wOpt) // Construct no-read
|
||||||
mesh_(mesh),
|
|
||||||
addressing_()
|
|
||||||
{
|
{
|
||||||
|
const auto& zones = mesh.cellZones();
|
||||||
|
const auto* zonePtr = zones.cfindZone(name);
|
||||||
|
|
||||||
|
if (!zonePtr)
|
||||||
|
{
|
||||||
|
if (IOobjectOption::isReadRequired(rOpt))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Zone named " << name << " not found. "
|
||||||
|
<< "List of available zone names: " << zones.names() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (IOobjectOption::isAnyRead(rOpt))
|
||||||
|
{
|
||||||
|
const auto& zn = *zonePtr;
|
||||||
|
addressing_ = zn;
|
||||||
|
}
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
|
check(mesh.nCells());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,15 +112,19 @@ Foam::cellZoneSet::cellZoneSet
|
|||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSet(mesh, name, set.size(), wOpt),
|
cellZoneSet(mesh, name, label(0), wOpt) // Construct no-read
|
||||||
mesh_(mesh),
|
|
||||||
addressing_
|
|
||||||
(
|
|
||||||
isA<const cellZoneSet>(set)
|
|
||||||
? refCast<const cellZoneSet>(set).addressing()
|
|
||||||
: set.sortedToc()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
const auto* zonePtr = isA<cellZoneSet>(set);
|
||||||
|
|
||||||
|
if (zonePtr)
|
||||||
|
{
|
||||||
|
addressing_ = zonePtr->addressing();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addressing_ = set.sortedToc();
|
||||||
|
}
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +145,7 @@ void Foam::cellZoneSet::invert(const label maxLen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
addressing_.setSize(n);
|
addressing_.resize_nocopy(n);
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
for (label celli = 0; celli < maxLen; ++celli)
|
for (label celli = 0; celli < maxLen; ++celli)
|
||||||
@ -157,31 +161,15 @@ void Foam::cellZoneSet::invert(const label maxLen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::cellZoneSet::subset(const topoSet& set)
|
void Foam::cellZoneSet::subset(const labelUList& elems)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
|
|
||||||
const auto* setPtr = dynamic_cast<const cellZoneSet*>(&set);
|
for (const label id : elems)
|
||||||
|
|
||||||
if (setPtr)
|
|
||||||
{
|
{
|
||||||
for (const label celli : setPtr->addressing())
|
if (found(id))
|
||||||
{
|
{
|
||||||
if (found(celli))
|
newAddressing.push_back(id);
|
||||||
{
|
|
||||||
newAddressing.append(celli);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Assume a cellSet
|
|
||||||
for (const label celli : refCast<const cellSet>(set).sortedToc())
|
|
||||||
{
|
|
||||||
if (found(celli))
|
|
||||||
{
|
|
||||||
newAddressing.append(celli);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,15 +178,32 @@ void Foam::cellZoneSet::subset(const topoSet& set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::cellZoneSet::subset(const labelUList& set)
|
void Foam::cellZoneSet::subset(const topoSet& set)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
const auto* zonePtr = isA<cellZoneSet>(set);
|
||||||
|
|
||||||
for (const label celli : set)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
if (found(celli))
|
// Is a cellZoneSet
|
||||||
|
this->subset(zonePtr->addressing());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Assume a cellSet
|
||||||
|
this->subset(refCast<const cellSet>(set).sortedToc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cellZoneSet::addSet(const labelUList& elems)
|
||||||
|
{
|
||||||
|
DynamicList<label> newAddressing(addressing_);
|
||||||
|
|
||||||
|
for (const label id : elems)
|
||||||
|
{
|
||||||
|
if (!found(id))
|
||||||
{
|
{
|
||||||
newAddressing.append(celli);
|
newAddressing.push_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,46 +214,33 @@ void Foam::cellZoneSet::subset(const labelUList& set)
|
|||||||
|
|
||||||
void Foam::cellZoneSet::addSet(const topoSet& set)
|
void Foam::cellZoneSet::addSet(const topoSet& set)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_);
|
const auto* zonePtr = isA<cellZoneSet>(set);
|
||||||
|
|
||||||
const auto* setPtr = dynamic_cast<const cellZoneSet*>(&set);
|
if (zonePtr)
|
||||||
|
|
||||||
if (setPtr)
|
|
||||||
{
|
{
|
||||||
for (const label celli : setPtr->addressing())
|
// Is a cellZoneSet
|
||||||
{
|
this->addSet(zonePtr->addressing());
|
||||||
if (!found(celli))
|
|
||||||
{
|
|
||||||
newAddressing.append(celli);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Assume a cellSet
|
// Assume a cellSet
|
||||||
for (const label celli : refCast<const cellSet>(set).sortedToc())
|
this->addSet(refCast<const cellSet>(set).sortedToc());
|
||||||
{
|
|
||||||
if (!found(celli))
|
|
||||||
{
|
|
||||||
newAddressing.append(celli);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addressing_.transfer(newAddressing);
|
|
||||||
updateSet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::cellZoneSet::addSet(const labelUList& set)
|
void Foam::cellZoneSet::subtractSet(const labelUList& elems)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_);
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
|
|
||||||
for (const label celli : set)
|
const labelHashSet set(elems);
|
||||||
|
|
||||||
|
for (const label id : addressing_)
|
||||||
{
|
{
|
||||||
if (!found(celli))
|
if (!set.found(id))
|
||||||
{
|
{
|
||||||
newAddressing.append(celli);
|
// Retain if not in the topoSet (parameter)
|
||||||
|
newAddressing.push_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,32 +253,12 @@ void Foam::cellZoneSet::subtractSet(const topoSet& set)
|
|||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
|
|
||||||
for (const label celli : addressing_)
|
for (const label id : addressing_)
|
||||||
{
|
{
|
||||||
if (!set.found(celli))
|
if (!set.found(id))
|
||||||
{
|
{
|
||||||
// Not found in zoneSet so add
|
// Not found in zoneSet so add
|
||||||
newAddressing.append(celli);
|
newAddressing.push_back(id);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addressing_.transfer(newAddressing);
|
|
||||||
updateSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::cellZoneSet::subtractSet(const labelUList& elems)
|
|
||||||
{
|
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
|
||||||
|
|
||||||
const labelHashSet zoneSet(elems);
|
|
||||||
|
|
||||||
for (const label celli : addressing_)
|
|
||||||
{
|
|
||||||
if (!zoneSet.found(celli))
|
|
||||||
{
|
|
||||||
// Not found in zoneSet so add
|
|
||||||
newAddressing.append(celli);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,56 +290,49 @@ bool Foam::cellZoneSet::writeObject
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Write shadow cellSet
|
// Write shadow cellSet
|
||||||
word oldTypeName = typeName;
|
const word oldTypeName = typeName;
|
||||||
const_cast<word&>(type()) = cellSet::typeName;
|
const_cast<word&>(type()) = cellSet::typeName;
|
||||||
bool ok = cellSet::writeObject(streamOpt, writeOnProc);
|
bool ok = cellSet::writeObject(streamOpt, writeOnProc);
|
||||||
const_cast<word&>(type()) = oldTypeName;
|
const_cast<word&>(type()) = oldTypeName;
|
||||||
|
|
||||||
// Modify cellZone
|
// Modify cellZone
|
||||||
cellZoneMesh& cellZones = const_cast<polyMesh&>(mesh_).cellZones();
|
auto& zones = const_cast<polyMesh&>(mesh_).cellZones();
|
||||||
label zoneID = cellZones.findZoneID(name());
|
auto* zonePtr = zones.findZone(name());
|
||||||
|
|
||||||
if (zoneID == -1)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
zoneID = cellZones.size();
|
zonePtr->resetAddressing(addressing_);
|
||||||
|
|
||||||
cellZones.emplace_back
|
|
||||||
(
|
|
||||||
name(),
|
|
||||||
addressing_,
|
|
||||||
zoneID,
|
|
||||||
cellZones
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cellZones[zoneID] = addressing_;
|
zones.emplace_back
|
||||||
|
(
|
||||||
|
name(),
|
||||||
|
addressing_,
|
||||||
|
zones.size(), // zoneID
|
||||||
|
zones
|
||||||
|
);
|
||||||
}
|
}
|
||||||
cellZones.clearAddressing();
|
zones.clearAddressing();
|
||||||
|
|
||||||
return ok && cellZones.write(writeOnProc);
|
return ok && zones.write(writeOnProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::cellZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
void Foam::cellZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
||||||
{
|
{
|
||||||
// cellZone
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
labelList newAddressing(addressing_.size());
|
|
||||||
|
|
||||||
label n = 0;
|
|
||||||
for (const label celli : addressing_)
|
for (const label celli : addressing_)
|
||||||
{
|
{
|
||||||
label newCelli = morphMap.reverseCellMap()[celli];
|
label newCelli = morphMap.reverseCellMap()[celli];
|
||||||
if (newCelli >= 0)
|
if (newCelli >= 0)
|
||||||
{
|
{
|
||||||
newAddressing[n] = newCelli;
|
newAddressing.push_back(newCelli);
|
||||||
++n;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAddressing.resize(n);
|
|
||||||
|
|
||||||
addressing_.transfer(newAddressing);
|
addressing_.transfer(newAddressing);
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,7 +62,7 @@ class cellZoneSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("cellZoneSet");
|
TypeNameNoDebug("cellZoneSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -76,16 +76,16 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from initial size for labelHashSet
|
//- Construct empty (no-read) with initial labelHashSet capacity.
|
||||||
cellZoneSet
|
cellZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct from existing set
|
//- Copy construct (no-read) from existing set
|
||||||
cellZoneSet
|
cellZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -102,16 +102,17 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
const labelList& addressing() const
|
const labelList& addressing() const noexcept
|
||||||
{
|
{
|
||||||
return addressing_;
|
return addressing_;
|
||||||
}
|
}
|
||||||
|
|
||||||
labelList& addressing()
|
labelList& addressing() noexcept
|
||||||
{
|
{
|
||||||
return addressing_;
|
return addressing_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Sort addressing and make cellSet part consistent with addressing
|
//- Sort addressing and make cellSet part consistent with addressing
|
||||||
void updateSet();
|
void updateSet();
|
||||||
|
|
||||||
@ -119,26 +120,24 @@ public:
|
|||||||
// Insert all members [0,maxLen) which were not in set
|
// Insert all members [0,maxLen) which were not in set
|
||||||
virtual void invert(const label maxLen);
|
virtual void invert(const label maxLen);
|
||||||
|
|
||||||
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
|
virtual void subset(const labelUList& elems);
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
virtual void subset(const topoSet& set);
|
virtual void subset(const topoSet& set);
|
||||||
|
|
||||||
//- Add elements present in set.
|
//- Add given elements to the set
|
||||||
|
virtual void addSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Add given elements to the set
|
||||||
virtual void addSet(const topoSet& set);
|
virtual void addSet(const topoSet& set);
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
//- Subtract given elements from the set
|
||||||
|
virtual void subtractSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Subtract given elements from the set
|
||||||
virtual void subtractSet(const topoSet& set);
|
virtual void subtractSet(const topoSet& set);
|
||||||
|
|
||||||
// Variants taking labelUList&
|
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
|
||||||
virtual void subset(const labelUList& set);
|
|
||||||
|
|
||||||
//- Add elements present in set.
|
|
||||||
virtual void addSet(const labelUList& set);
|
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
|
||||||
virtual void subtractSet(const labelUList& set);
|
|
||||||
|
|
||||||
//- Sync cellSet across coupled patches; update cellZone from cellSet
|
//- Sync cellSet across coupled patches; update cellZone from cellSet
|
||||||
virtual void sync(const polyMesh& mesh);
|
virtual void sync(const polyMesh& mesh);
|
||||||
|
|
||||||
|
|||||||
@ -35,18 +35,12 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(faceBitSet, 0);
|
defineTypeName(faceBitSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::faceBitSet::faceBitSet(const polyMesh& mesh)
|
|
||||||
:
|
|
||||||
faceBitSet(mesh, false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::faceBitSet::faceBitSet(const polyMesh& mesh, const bool val)
|
Foam::faceBitSet::faceBitSet(const polyMesh& mesh, const bool val)
|
||||||
:
|
:
|
||||||
topoBitSet(mesh, "faceBitSet", mesh.nFaces(), val)
|
topoBitSet(mesh, "faceBitSet", mesh.nFaces(), val)
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,16 +56,14 @@ class faceBitSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("faceBitSet");
|
TypeNameNoDebug("faceBitSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct with nFaces elements, all elements unset
|
//- Construct with nFaces elements,
|
||||||
explicit faceBitSet(const polyMesh& mesh);
|
//- all elements unset or initial value
|
||||||
|
explicit faceBitSet(const polyMesh& mesh, const bool val = false);
|
||||||
//- Construct with nFaces elements, using initial val
|
|
||||||
faceBitSet(const polyMesh& mesh, const bool val);
|
|
||||||
|
|
||||||
//- Copy construct from bitset, resizing to nFaces elements as required
|
//- Copy construct from bitset, resizing to nFaces elements as required
|
||||||
faceBitSet(const polyMesh& mesh, const bitSet& bits);
|
faceBitSet(const polyMesh& mesh, const bitSet& bits);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(faceBoolSet, 0);
|
defineTypeName(faceBoolSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class faceBoolSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("faceBoolSet");
|
TypeNameNoDebug("faceBoolSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,7 +37,7 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(faceSet, 0);
|
defineTypeName(faceSet);
|
||||||
addToRunTimeSelectionTable(topoSet, faceSet, word);
|
addToRunTimeSelectionTable(topoSet, faceSet, word);
|
||||||
addToRunTimeSelectionTable(topoSet, faceSet, size);
|
addToRunTimeSelectionTable(topoSet, faceSet, size);
|
||||||
addToRunTimeSelectionTable(topoSet, faceSet, set);
|
addToRunTimeSelectionTable(topoSet, faceSet, set);
|
||||||
@ -51,17 +51,24 @@ Foam::faceSet::faceSet(const IOobject& io)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faceSet::faceSet(const IOobject& io, const Foam::zero)
|
||||||
|
:
|
||||||
|
topoSet(io, Foam::zero{})
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::faceSet::faceSet
|
Foam::faceSet::faceSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSet(mesh, typeName, name, rOpt, wOpt)
|
topoSet(mesh, typeName, name, rOpt, wOpt, reg)
|
||||||
{
|
{
|
||||||
check(mesh.nFaces());
|
check(mesh.nFaces()); // Valid range?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,11 +76,11 @@ Foam::faceSet::faceSet
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSet(mesh, name, size, wOpt)
|
topoSet(mesh, name, initialCapacity, wOpt)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +132,28 @@ Foam::faceSet::faceSet
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::labelHashSet Foam::faceSet::readContents
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
faceSet reader
|
||||||
|
(
|
||||||
|
topoSet::findIOobject(mesh, name, IOobjectOption::NO_REGISTER),
|
||||||
|
Foam::zero{}
|
||||||
|
);
|
||||||
|
|
||||||
|
labelHashSet labels;
|
||||||
|
reader.readIOcontents(typeName, labels);
|
||||||
|
reader.checkLabels(labels, mesh.nFaces()); // Valid range?
|
||||||
|
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::faceSet::sync(const polyMesh& mesh)
|
void Foam::faceSet::sync(const polyMesh& mesh)
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,33 +56,50 @@ class faceSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("faceSet");
|
TypeNameNoDebug("faceSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from IOobject
|
//- Construct from IOobject. No checking.
|
||||||
explicit faceSet(const IOobject& io);
|
explicit faceSet(const IOobject& io);
|
||||||
|
|
||||||
//- Construct from objectRegistry and name
|
//- Construct empty (no-read) with IOobject information
|
||||||
|
faceSet(const IOobject& io, const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct from polyMesh (registry) and name
|
||||||
faceSet
|
faceSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct empty with initial size for labelHashSet
|
//- Construct from polyMesh (registry), name and registration option
|
||||||
faceSet
|
faceSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
IOobjectOption::registerOption reg,
|
||||||
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faceSet(mesh, name, rOpt, wOpt, reg)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Construct empty (no-read) with initial labelHashSet capacity.
|
||||||
|
faceSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from existing set
|
//- Copy construct (no-read) from existing set
|
||||||
faceSet
|
faceSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -91,7 +108,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy of labelHashSet
|
//- Copy construct (no-read) from labelHashSet,
|
||||||
|
//- with search for IOobject instance.
|
||||||
faceSet
|
faceSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -100,7 +118,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with moving labelHashSet
|
//- Move construct (no-read) from labelHashSet,
|
||||||
|
//- with search for IOobject instance.
|
||||||
faceSet
|
faceSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -109,7 +128,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy of labels
|
//- Copy construct (no-read) from labels,
|
||||||
|
//- with search for IOobject instance.
|
||||||
faceSet
|
faceSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -119,6 +139,16 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Factory Methods
|
||||||
|
|
||||||
|
//- Read and return contents. Intermediate IOobject is not registered
|
||||||
|
static labelHashSet readContents
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~faceSet() = default;
|
virtual ~faceSet() = default;
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(faceZoneSet, 0);
|
defineTypeName(faceZoneSet);
|
||||||
addToRunTimeSelectionTable(topoSet, faceZoneSet, word);
|
addToRunTimeSelectionTable(topoSet, faceZoneSet, word);
|
||||||
addToRunTimeSelectionTable(topoSet, faceZoneSet, size);
|
addToRunTimeSelectionTable(topoSet, faceZoneSet, size);
|
||||||
addToRunTimeSelectionTable(topoSet, faceZoneSet, set);
|
addToRunTimeSelectionTable(topoSet, faceZoneSet, set);
|
||||||
@ -51,9 +51,18 @@ namespace Foam
|
|||||||
|
|
||||||
void Foam::faceZoneSet::updateSet()
|
void Foam::faceZoneSet::updateSet()
|
||||||
{
|
{
|
||||||
labelList order(sortedOrder(addressing_));
|
if (flipMap_.size() == addressing_.size())
|
||||||
addressing_ = labelUIndList(addressing_, order)();
|
{
|
||||||
flipMap_ = boolUIndList(flipMap_, order)();
|
labelList order(Foam::sortedOrder(addressing_));
|
||||||
|
addressing_ = labelUIndList(addressing_, order)();
|
||||||
|
flipMap_ = boolUIndList(flipMap_, order)();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Foam::sort(addressing_);
|
||||||
|
flipMap_.resize_nocopy(addressing_.size());
|
||||||
|
flipMap_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
faceSet::clearStorage();
|
faceSet::clearStorage();
|
||||||
faceSet::reserve(addressing_.size());
|
faceSet::reserve(addressing_.size());
|
||||||
@ -67,57 +76,47 @@ Foam::faceZoneSet::faceZoneSet
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faceSet(mesh, name, 1024), // do not read faceSet
|
faceSet(mesh, name, initialCapacity, wOpt), // Construct no-read
|
||||||
mesh_(mesh),
|
mesh_(mesh)
|
||||||
addressing_(),
|
{}
|
||||||
flipMap_()
|
|
||||||
{
|
|
||||||
const faceZoneMesh& faceZones = mesh.faceZones();
|
|
||||||
label zoneID = faceZones.findZoneID(name);
|
|
||||||
|
|
||||||
if (IOobjectOption::isReadRequired(rOpt) && zoneID == -1)
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Zone named " << name << " not found. "
|
|
||||||
<< "List of available zone names: " << faceZones.names()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
IOobjectOption::isReadRequired(rOpt)
|
|
||||||
|| (IOobjectOption::isReadOptional(rOpt) && zoneID != -1)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const faceZone& fz = faceZones[zoneID];
|
|
||||||
addressing_ = fz.addressing();
|
|
||||||
flipMap_ = fz.flipMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSet();
|
|
||||||
|
|
||||||
check(mesh.nFaces());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::faceZoneSet::faceZoneSet
|
Foam::faceZoneSet::faceZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faceSet(mesh, name, size, wOpt),
|
faceZoneSet(mesh, name, label(0), wOpt) // Construct no-read
|
||||||
mesh_(mesh),
|
|
||||||
addressing_(),
|
|
||||||
flipMap_()
|
|
||||||
{
|
{
|
||||||
|
const auto& zones = mesh.faceZones();
|
||||||
|
const auto* zonePtr = zones.cfindZone(name);
|
||||||
|
|
||||||
|
if (!zonePtr)
|
||||||
|
{
|
||||||
|
if (IOobjectOption::isReadRequired(rOpt))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Zone named " << name << " not found. "
|
||||||
|
<< "List of available zone names: " << zones.names() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (IOobjectOption::isAnyRead(rOpt))
|
||||||
|
{
|
||||||
|
const auto& zn = *zonePtr;
|
||||||
|
addressing_ = zn.addressing();
|
||||||
|
flipMap_ = zn.flipMap();
|
||||||
|
}
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
|
check(mesh.nFaces());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,11 +128,21 @@ Foam::faceZoneSet::faceZoneSet
|
|||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faceSet(mesh, name, set.size(), wOpt),
|
faceZoneSet(mesh, name, label(0), wOpt) // Construct no-read
|
||||||
mesh_(mesh),
|
|
||||||
addressing_(refCast<const faceZoneSet>(set).addressing()),
|
|
||||||
flipMap_(refCast<const faceZoneSet>(set).flipMap())
|
|
||||||
{
|
{
|
||||||
|
const auto* zonePtr = isA<faceZoneSet>(set);
|
||||||
|
|
||||||
|
if (zonePtr)
|
||||||
|
{
|
||||||
|
addressing_ = zonePtr->addressing();
|
||||||
|
flipMap_ = zonePtr->flipMap();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No flipMap for faceSet - handled in updateSet()
|
||||||
|
addressing_ = set.sortedToc();
|
||||||
|
}
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,24 +154,24 @@ void Foam::faceZoneSet::invert(const label maxLen)
|
|||||||
// Count
|
// Count
|
||||||
label n = 0;
|
label n = 0;
|
||||||
|
|
||||||
for (label facei = 0; facei < maxLen; ++facei)
|
for (label id = 0; id < maxLen; ++id)
|
||||||
{
|
{
|
||||||
if (!found(facei))
|
if (!topoSet::contains(id))
|
||||||
{
|
{
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
addressing_.setSize(n);
|
addressing_.resize_nocopy(n);
|
||||||
flipMap_.setSize(n);
|
flipMap_.resize_nocopy(n);
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
for (label facei = 0; facei < maxLen; ++facei)
|
for (label id = 0; id < maxLen; ++id)
|
||||||
{
|
{
|
||||||
if (!found(facei))
|
if (!topoSet::contains(id))
|
||||||
{
|
{
|
||||||
addressing_[n] = facei;
|
addressing_[n] = id;
|
||||||
flipMap_[n] = false; //? or true?
|
flipMap_[n] = false; //? or true?
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
@ -204,7 +213,7 @@ void Foam::faceZoneSet::subset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nConflict > 0)
|
if (nConflict)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "subset : there are " << nConflict
|
<< "subset : there are " << nConflict
|
||||||
@ -220,24 +229,28 @@ void Foam::faceZoneSet::subset
|
|||||||
|
|
||||||
void Foam::faceZoneSet::subset(const topoSet& set)
|
void Foam::faceZoneSet::subset(const topoSet& set)
|
||||||
{
|
{
|
||||||
const auto* setPtr = dynamic_cast<const faceZoneSet*>(&set);
|
const auto* zonePtr = isA<faceZoneSet>(set);
|
||||||
|
|
||||||
if (setPtr)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
subset(setPtr->name(), setPtr->addressing(), setPtr->flipMap());
|
subset(zonePtr->name(), zonePtr->addressing(), zonePtr->flipMap());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Assume a faceSet. Ignore flipMap
|
// Assume a faceSet. Ignore flipMap
|
||||||
const auto& fSet = refCast<const faceSet>(set);
|
subset
|
||||||
subset(fSet.name(), fSet.sortedToc(), boolList::null());
|
(
|
||||||
|
set.name(),
|
||||||
|
refCast<const faceSet>(set).sortedToc(),
|
||||||
|
boolList::null()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::faceZoneSet::subset(const labelUList& set)
|
void Foam::faceZoneSet::subset(const labelUList& elems)
|
||||||
{
|
{
|
||||||
subset(word::null, set, boolList::null());
|
subset(word::null, elems, boolList::null());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -292,24 +305,28 @@ void Foam::faceZoneSet::addSet
|
|||||||
|
|
||||||
void Foam::faceZoneSet::addSet(const topoSet& set)
|
void Foam::faceZoneSet::addSet(const topoSet& set)
|
||||||
{
|
{
|
||||||
const auto* setPtr = dynamic_cast<const faceZoneSet*>(&set);
|
const auto* zonePtr = isA<faceZoneSet>(set);
|
||||||
|
|
||||||
if (setPtr)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
addSet(setPtr->name(), setPtr->addressing(), setPtr->flipMap());
|
addSet(zonePtr->name(), zonePtr->addressing(), zonePtr->flipMap());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Assume a faceSet. Ignore flipMap
|
// Assume a faceSet. Ignore flipMap
|
||||||
const auto& fSet = refCast<const faceSet>(set);
|
addSet
|
||||||
addSet(fSet.name(), fSet.sortedToc(), boolList::null());
|
(
|
||||||
|
set.name(),
|
||||||
|
refCast<const faceSet>(set).sortedToc(),
|
||||||
|
boolList::null()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::faceZoneSet::addSet(const labelUList& set)
|
void Foam::faceZoneSet::addSet(const labelUList& elems)
|
||||||
{
|
{
|
||||||
addSet(word::null, set, boolList::null());
|
addSet(word::null, elems, boolList::null());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -366,24 +383,28 @@ void Foam::faceZoneSet::subtractSet
|
|||||||
|
|
||||||
void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
||||||
{
|
{
|
||||||
const auto* setPtr = dynamic_cast<const faceZoneSet*>(&set);
|
const auto* zonePtr = isA<faceZoneSet>(set);
|
||||||
|
|
||||||
if (setPtr)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
subtractSet(setPtr->name(), setPtr->addressing(), setPtr->flipMap());
|
subtractSet(zonePtr->name(), zonePtr->addressing(), zonePtr->flipMap());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Assume a faceSet. Ignore flipMap
|
// Assume a faceSet. Ignore flipMap
|
||||||
const auto& fSet = refCast<const faceSet>(set);
|
subtractSet
|
||||||
subtractSet(fSet.name(), fSet.sortedToc(), boolList::null());
|
(
|
||||||
|
set.name(),
|
||||||
|
refCast<const faceSet>(set).sortedToc(),
|
||||||
|
boolList::null()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::faceZoneSet::subtractSet(const labelUList& set)
|
void Foam::faceZoneSet::subtractSet(const labelUList& elems)
|
||||||
{
|
{
|
||||||
subtractSet(word::null, set, boolList::null());
|
subtractSet(word::null, elems, boolList::null());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -517,58 +538,51 @@ bool Foam::faceZoneSet::writeObject
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Write shadow faceSet
|
// Write shadow faceSet
|
||||||
word oldTypeName = typeName;
|
const word oldTypeName = typeName;
|
||||||
const_cast<word&>(type()) = faceSet::typeName;
|
const_cast<word&>(type()) = faceSet::typeName;
|
||||||
bool ok = faceSet::writeObject(streamOpt, writeOnProc);
|
bool ok = faceSet::writeObject(streamOpt, writeOnProc);
|
||||||
const_cast<word&>(type()) = oldTypeName;
|
const_cast<word&>(type()) = oldTypeName;
|
||||||
|
|
||||||
// Modify faceZone
|
// Modify faceZone
|
||||||
faceZoneMesh& faceZones = const_cast<polyMesh&>(mesh_).faceZones();
|
auto& zones = const_cast<polyMesh&>(mesh_).faceZones();
|
||||||
label zoneID = faceZones.findZoneID(name());
|
auto* zonePtr = zones.findZone(name());
|
||||||
|
|
||||||
if (zoneID == -1)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
zoneID = faceZones.size();
|
zonePtr->resetAddressing(addressing_, flipMap_);
|
||||||
|
}
|
||||||
faceZones.emplace_back
|
else
|
||||||
|
{
|
||||||
|
zones.emplace_back
|
||||||
(
|
(
|
||||||
name(),
|
name(),
|
||||||
addressing_,
|
addressing_,
|
||||||
flipMap_,
|
flipMap_,
|
||||||
zoneID,
|
zones.size(), // zoneID
|
||||||
faceZones
|
zones
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
zones.clearAddressing();
|
||||||
{
|
|
||||||
faceZones[zoneID].resetAddressing(addressing_, flipMap_);
|
|
||||||
}
|
|
||||||
faceZones.clearAddressing();
|
|
||||||
|
|
||||||
return ok && faceZones.write(writeOnProc);
|
return ok && zones.write(writeOnProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::faceZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
void Foam::faceZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
||||||
{
|
{
|
||||||
// faceZone
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
labelList newAddressing(addressing_.size());
|
DynamicList<bool> newFlipMap(flipMap_.size());
|
||||||
boolList newFlipMap(flipMap_.size(), false);
|
|
||||||
|
|
||||||
label n = 0;
|
|
||||||
forAll(addressing_, i)
|
forAll(addressing_, i)
|
||||||
{
|
{
|
||||||
label facei = addressing_[i];
|
label facei = addressing_[i];
|
||||||
label newFacei = morphMap.reverseFaceMap()[facei];
|
label newFacei = morphMap.reverseFaceMap()[facei];
|
||||||
if (newFacei >= 0)
|
if (newFacei >= 0)
|
||||||
{
|
{
|
||||||
newAddressing[n] = newFacei;
|
newAddressing.push_back(newFacei);
|
||||||
newFlipMap[n] = flipMap_[i];
|
newFlipMap.push_back(flipMap_[i]);
|
||||||
n++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAddressing.setSize(n);
|
|
||||||
newFlipMap.setSize(n);
|
|
||||||
|
|
||||||
addressing_.transfer(newAddressing);
|
addressing_.transfer(newAddressing);
|
||||||
flipMap_.transfer(newFlipMap);
|
flipMap_.transfer(newFlipMap);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -89,7 +89,7 @@ class faceZoneSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("faceZoneSet");
|
TypeNameNoDebug("faceZoneSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -103,16 +103,16 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct with initial size for labelHashSet
|
//- Construct empty (no-read) with initial labelHashSet capacity.
|
||||||
faceZoneSet
|
faceZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct from existing set
|
//- Copy construct (no-read) from existing set
|
||||||
faceZoneSet
|
faceZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -157,27 +157,24 @@ public:
|
|||||||
// Insert all members [0,maxLen) which were not in set.
|
// Insert all members [0,maxLen) which were not in set.
|
||||||
virtual void invert(const label maxLen);
|
virtual void invert(const label maxLen);
|
||||||
|
|
||||||
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
|
virtual void subset(const labelUList& elems);
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
virtual void subset(const topoSet& set);
|
virtual void subset(const topoSet& set);
|
||||||
|
|
||||||
//- Add elements present in set.
|
//- Add given elements to the set
|
||||||
|
virtual void addSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Add given elements to the set
|
||||||
virtual void addSet(const topoSet& set);
|
virtual void addSet(const topoSet& set);
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
//- Subtract given elements from the set
|
||||||
|
virtual void subtractSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Subtract given elements from the set
|
||||||
virtual void subtractSet(const topoSet& set);
|
virtual void subtractSet(const topoSet& set);
|
||||||
|
|
||||||
// Variants taking labelUList&
|
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
|
||||||
virtual void subset(const labelUList& set);
|
|
||||||
|
|
||||||
//- Add elements present in set.
|
|
||||||
virtual void addSet(const labelUList& set);
|
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
|
||||||
virtual void subtractSet(const labelUList& set);
|
|
||||||
|
|
||||||
|
|
||||||
//- Sync faceZoneSet across coupled patches.
|
//- Sync faceZoneSet across coupled patches.
|
||||||
virtual void sync(const polyMesh& mesh);
|
virtual void sync(const polyMesh& mesh);
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,18 +35,12 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(pointBitSet, 0);
|
defineTypeName(pointBitSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::pointBitSet::pointBitSet(const polyMesh& mesh)
|
|
||||||
:
|
|
||||||
pointBitSet(mesh, false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::pointBitSet::pointBitSet(const polyMesh& mesh, const bool val)
|
Foam::pointBitSet::pointBitSet(const polyMesh& mesh, const bool val)
|
||||||
:
|
:
|
||||||
topoBitSet(mesh, "pointBitSet", mesh.nPoints(), val)
|
topoBitSet(mesh, "pointBitSet", mesh.nPoints(), val)
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,16 +56,14 @@ class pointBitSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("pointBitSet");
|
TypeNameNoDebug("pointBitSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct with nPoints elements, all elements unset
|
//- Construct with nPoints elements,
|
||||||
explicit pointBitSet(const polyMesh& mesh);
|
//- all elements unset or initial value
|
||||||
|
explicit pointBitSet(const polyMesh& mesh, const bool val);
|
||||||
//- Construct with nPoints elements, using initial val
|
|
||||||
pointBitSet(const polyMesh& mesh, const bool val);
|
|
||||||
|
|
||||||
//- Copy construct from bitset, resizing to nPoints elements as required
|
//- Copy construct from bitset, resizing to nPoints elements as required
|
||||||
pointBitSet(const polyMesh& mesh, const bitSet& bits);
|
pointBitSet(const polyMesh& mesh, const bitSet& bits);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,13 +37,14 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(pointSet, 0);
|
defineTypeName(pointSet);
|
||||||
addToRunTimeSelectionTable(topoSet, pointSet, word);
|
addToRunTimeSelectionTable(topoSet, pointSet, word);
|
||||||
addToRunTimeSelectionTable(topoSet, pointSet, size);
|
addToRunTimeSelectionTable(topoSet, pointSet, size);
|
||||||
addToRunTimeSelectionTable(topoSet, pointSet, set);
|
addToRunTimeSelectionTable(topoSet, pointSet, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::pointSet::pointSet(const IOobject& io)
|
Foam::pointSet::pointSet(const IOobject& io)
|
||||||
:
|
:
|
||||||
@ -51,17 +52,24 @@ Foam::pointSet::pointSet(const IOobject& io)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::pointSet::pointSet(const IOobject& io, const Foam::zero)
|
||||||
|
:
|
||||||
|
topoSet(io, Foam::zero{})
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::pointSet::pointSet
|
Foam::pointSet::pointSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSet(mesh, typeName, name, rOpt, wOpt)
|
topoSet(mesh, typeName, name, rOpt, wOpt, reg)
|
||||||
{
|
{
|
||||||
check(mesh.nPoints());
|
check(mesh.nPoints()); // Valid range?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,11 +77,11 @@ Foam::pointSet::pointSet
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSet(mesh, name, size, wOpt)
|
topoSet(mesh, name, initialCapacity, wOpt)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +133,28 @@ Foam::pointSet::pointSet
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::labelHashSet Foam::pointSet::readContents
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pointSet reader
|
||||||
|
(
|
||||||
|
topoSet::findIOobject(mesh, name, IOobjectOption::NO_REGISTER),
|
||||||
|
Foam::zero{}
|
||||||
|
);
|
||||||
|
|
||||||
|
labelHashSet labels;
|
||||||
|
reader.readIOcontents(typeName, labels);
|
||||||
|
reader.checkLabels(labels, mesh.nPoints()); // Valid range?
|
||||||
|
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::pointSet::sync(const polyMesh& mesh)
|
void Foam::pointSet::sync(const polyMesh& mesh)
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,7 +56,7 @@ class pointSet
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("pointSet");
|
TypeNameNoDebug("pointSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -64,25 +64,42 @@ public:
|
|||||||
//- Construct from IOobject
|
//- Construct from IOobject
|
||||||
explicit pointSet(const IOobject& io);
|
explicit pointSet(const IOobject& io);
|
||||||
|
|
||||||
//- Construct from objectRegistry and name
|
//- Construct empty (no-read) with IOobject information
|
||||||
|
pointSet(const IOobject& io, const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct from polyMesh (registry) and name
|
||||||
pointSet
|
pointSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct empty with initial size for labelHashSet
|
//- Construct from polyMesh (registry), name and registration option
|
||||||
pointSet
|
pointSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
IOobjectOption::registerOption reg,
|
||||||
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointSet(mesh, name, rOpt, wOpt, reg)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Construct empty (no-read) with initial labelHashSet capacity.
|
||||||
|
pointSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from existing set
|
//- Copy construct (no-read) from existing set
|
||||||
pointSet
|
pointSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -91,7 +108,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy of labelHashSet
|
//- Copy construct (no-read) from labelHashSet,
|
||||||
|
//- with search for IOobject instance.
|
||||||
pointSet
|
pointSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -100,7 +118,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with moving labelHashSet
|
//- Move construct (no-read) from labelHashSet,
|
||||||
|
//- with search for IOobject instance.
|
||||||
pointSet
|
pointSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -109,7 +128,8 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy of labels
|
//- Copy construct (no-read) from labels,
|
||||||
|
//- with search for IOobject instance.
|
||||||
pointSet
|
pointSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -119,11 +139,21 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Factory Methods
|
||||||
|
|
||||||
|
//- Read and return contents. Intermediate IOobject is not registered
|
||||||
|
static labelHashSet readContents
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~pointSet() = default;
|
virtual ~pointSet() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
//- Sync set across coupled patches. Adds coupled points to set.
|
//- Sync set across coupled patches. Adds coupled points to set.
|
||||||
virtual void sync(const polyMesh& mesh);
|
virtual void sync(const polyMesh& mesh);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022,2024 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,18 +37,18 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(pointZoneSet, 0);
|
defineTypeName(pointZoneSet);
|
||||||
addToRunTimeSelectionTable(topoSet, pointZoneSet, word);
|
addToRunTimeSelectionTable(topoSet, pointZoneSet, word);
|
||||||
addToRunTimeSelectionTable(topoSet, pointZoneSet, size);
|
addToRunTimeSelectionTable(topoSet, pointZoneSet, size);
|
||||||
addToRunTimeSelectionTable(topoSet, pointZoneSet, set);
|
addToRunTimeSelectionTable(topoSet, pointZoneSet, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::pointZoneSet::updateSet()
|
void Foam::pointZoneSet::updateSet()
|
||||||
{
|
{
|
||||||
labelList order(sortedOrder(addressing_));
|
Foam::sort(addressing_);
|
||||||
inplaceReorder(order, addressing_);
|
|
||||||
|
|
||||||
pointSet::clearStorage();
|
pointSet::clearStorage();
|
||||||
pointSet::reserve(addressing_.size());
|
pointSet::reserve(addressing_.size());
|
||||||
@ -62,46 +62,46 @@ Foam::pointZoneSet::pointZoneSet
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
pointSet(mesh, name, 1024), // do not read pointSet
|
pointSet(mesh, name, initialCapacity, wOpt), // Construct no-read
|
||||||
mesh_(mesh),
|
mesh_(mesh)
|
||||||
addressing_()
|
{}
|
||||||
{
|
|
||||||
const pointZoneMesh& pointZones = mesh.pointZones();
|
|
||||||
label zoneID = pointZones.findZoneID(name);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
IOobjectOption::isReadRequired(rOpt)
|
|
||||||
|| (IOobjectOption::isReadOptional(rOpt) && zoneID != -1)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const pointZone& fz = pointZones[zoneID];
|
|
||||||
addressing_ = fz;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSet();
|
|
||||||
|
|
||||||
check(mesh.nPoints());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::pointZoneSet::pointZoneSet
|
Foam::pointZoneSet::pointZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
pointSet(mesh, name, size, wOpt),
|
pointZoneSet(mesh, name, label(0), wOpt) // Construct no-read
|
||||||
mesh_(mesh),
|
|
||||||
addressing_()
|
|
||||||
{
|
{
|
||||||
|
const auto& zones = mesh.pointZones();
|
||||||
|
const auto* zonePtr = zones.cfindZone(name);
|
||||||
|
|
||||||
|
if (!zonePtr)
|
||||||
|
{
|
||||||
|
if (IOobjectOption::isReadRequired(rOpt))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Zone named " << name << " not found. "
|
||||||
|
<< "List of available zone names: " << zones.names() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (IOobjectOption::isAnyRead(rOpt))
|
||||||
|
{
|
||||||
|
const auto& zn = *zonePtr;
|
||||||
|
addressing_ = zn;
|
||||||
|
}
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
|
check(mesh.nPoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,15 +113,19 @@ Foam::pointZoneSet::pointZoneSet
|
|||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
pointSet(mesh, name, set.size(), wOpt),
|
pointZoneSet(mesh, name, label(0), wOpt) // Construct no-read
|
||||||
mesh_(mesh),
|
|
||||||
addressing_
|
|
||||||
(
|
|
||||||
isA<const pointZoneSet>(set)
|
|
||||||
? refCast<const pointZoneSet>(set).addressing()
|
|
||||||
: set.sortedToc()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
const auto* zonePtr = isA<pointZoneSet>(set);
|
||||||
|
|
||||||
|
if (zonePtr)
|
||||||
|
{
|
||||||
|
addressing_ = zonePtr->addressing();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addressing_ = set.sortedToc();
|
||||||
|
}
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,23 +137,23 @@ void Foam::pointZoneSet::invert(const label maxLen)
|
|||||||
// Count
|
// Count
|
||||||
label n = 0;
|
label n = 0;
|
||||||
|
|
||||||
for (label pointi = 0; pointi < maxLen; ++pointi)
|
for (label id = 0; id < maxLen; ++id)
|
||||||
{
|
{
|
||||||
if (!found(pointi))
|
if (!found(id))
|
||||||
{
|
{
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
addressing_.setSize(n);
|
addressing_.resize_nocopy(n);
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
for (label pointi = 0; pointi < maxLen; ++pointi)
|
for (label id = 0; id < maxLen; ++id)
|
||||||
{
|
{
|
||||||
if (!found(pointi))
|
if (!found(id))
|
||||||
{
|
{
|
||||||
addressing_[n] = pointi;
|
addressing_[n] = id;
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,31 +161,15 @@ void Foam::pointZoneSet::invert(const label maxLen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::pointZoneSet::subset(const topoSet& set)
|
void Foam::pointZoneSet::subset(const labelUList& elems)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
|
|
||||||
const auto* setPtr = dynamic_cast<const pointZoneSet*>(&set);
|
for (const label id : elems)
|
||||||
|
|
||||||
if (setPtr)
|
|
||||||
{
|
{
|
||||||
for (const label pointi : setPtr->addressing())
|
if (found(id))
|
||||||
{
|
{
|
||||||
if (found(pointi))
|
newAddressing.push_back(id);
|
||||||
{
|
|
||||||
newAddressing.append(pointi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Assume a pointSet
|
|
||||||
for (const label pointi : refCast<const pointSet>(set).sortedToc())
|
|
||||||
{
|
|
||||||
if (found(pointi))
|
|
||||||
{
|
|
||||||
newAddressing.append(pointi);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,15 +178,32 @@ void Foam::pointZoneSet::subset(const topoSet& set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::pointZoneSet::subset(const labelUList& set)
|
void Foam::pointZoneSet::subset(const topoSet& set)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
const auto* zonePtr = isA<pointZoneSet>(set);
|
||||||
|
|
||||||
for (const label pointi : set)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
if (found(pointi))
|
// Is a pointZoneSet
|
||||||
|
this->subset(zonePtr->addressing());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Assume a pointSet
|
||||||
|
this->subset(refCast<const pointSet>(set).sortedToc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::pointZoneSet::addSet(const labelUList& elems)
|
||||||
|
{
|
||||||
|
DynamicList<label> newAddressing(addressing_);
|
||||||
|
|
||||||
|
for (const label id : elems)
|
||||||
|
{
|
||||||
|
if (!found(id))
|
||||||
{
|
{
|
||||||
newAddressing.append(pointi);
|
newAddressing.push_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,46 +214,33 @@ void Foam::pointZoneSet::subset(const labelUList& set)
|
|||||||
|
|
||||||
void Foam::pointZoneSet::addSet(const topoSet& set)
|
void Foam::pointZoneSet::addSet(const topoSet& set)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_);
|
const auto* zonePtr = isA<pointZoneSet>(set);
|
||||||
|
|
||||||
const auto* setPtr = dynamic_cast<const pointZoneSet*>(&set);
|
if (zonePtr)
|
||||||
|
|
||||||
if (setPtr)
|
|
||||||
{
|
{
|
||||||
for (const label pointi : setPtr->addressing())
|
// Is a pointZoneSet
|
||||||
{
|
this->addSet(zonePtr->addressing());
|
||||||
if (!found(pointi))
|
|
||||||
{
|
|
||||||
newAddressing.append(pointi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Assume a pointSet
|
// Assume a pointSet
|
||||||
for (const label pointi : refCast<const pointSet>(set).sortedToc())
|
this->addSet(refCast<const pointSet>(set).sortedToc());
|
||||||
{
|
|
||||||
if (!found(pointi))
|
|
||||||
{
|
|
||||||
newAddressing.append(pointi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addressing_.transfer(newAddressing);
|
|
||||||
updateSet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::pointZoneSet::addSet(const labelUList& set)
|
void Foam::pointZoneSet::subtractSet(const labelUList& elems)
|
||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_);
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
|
|
||||||
for (const label pointi : set)
|
const labelHashSet set(elems);
|
||||||
|
|
||||||
|
for (const label id : addressing_)
|
||||||
{
|
{
|
||||||
if (!found(pointi))
|
if (!set.found(id))
|
||||||
{
|
{
|
||||||
newAddressing.append(pointi);
|
// Retain if not in the topoSet (parameter)
|
||||||
|
newAddressing.push_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,32 +253,12 @@ void Foam::pointZoneSet::subtractSet(const topoSet& set)
|
|||||||
{
|
{
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
|
|
||||||
for (label pointi : addressing_)
|
for (const label id : addressing_)
|
||||||
{
|
{
|
||||||
if (!set.found(pointi))
|
if (!set.found(id))
|
||||||
{
|
{
|
||||||
// Not found in zoneSet so add
|
// Retain if not in the topoSet (parameter)
|
||||||
newAddressing.append(pointi);
|
newAddressing.push_back(id);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addressing_.transfer(newAddressing);
|
|
||||||
updateSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::pointZoneSet::subtractSet(const labelUList& elems)
|
|
||||||
{
|
|
||||||
DynamicList<label> newAddressing(addressing_.size());
|
|
||||||
|
|
||||||
const labelHashSet zoneSet(elems);
|
|
||||||
|
|
||||||
for (const label pointi : addressing_)
|
|
||||||
{
|
|
||||||
if (!zoneSet.found(pointi))
|
|
||||||
{
|
|
||||||
// Not found in zoneSet so add
|
|
||||||
newAddressing.append(pointi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,56 +290,49 @@ bool Foam::pointZoneSet::writeObject
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Write shadow pointSet
|
// Write shadow pointSet
|
||||||
word oldTypeName = typeName;
|
const word oldTypeName = typeName;
|
||||||
const_cast<word&>(type()) = pointSet::typeName;
|
const_cast<word&>(type()) = pointSet::typeName;
|
||||||
bool ok = pointSet::writeObject(streamOpt, writeOnProc);
|
bool ok = pointSet::writeObject(streamOpt, writeOnProc);
|
||||||
const_cast<word&>(type()) = oldTypeName;
|
const_cast<word&>(type()) = oldTypeName;
|
||||||
|
|
||||||
// Modify pointZone
|
// Modify pointZone
|
||||||
pointZoneMesh& pointZones = const_cast<polyMesh&>(mesh_).pointZones();
|
auto& zones = const_cast<polyMesh&>(mesh_).pointZones();
|
||||||
label zoneID = pointZones.findZoneID(name());
|
auto* zonePtr = zones.findZone(name());
|
||||||
|
|
||||||
if (zoneID == -1)
|
if (zonePtr)
|
||||||
{
|
{
|
||||||
zoneID = pointZones.size();
|
zonePtr->resetAddressing(addressing_);
|
||||||
|
|
||||||
pointZones.emplace_back
|
|
||||||
(
|
|
||||||
name(),
|
|
||||||
addressing_,
|
|
||||||
zoneID,
|
|
||||||
pointZones
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pointZones[zoneID] = addressing_;
|
zones.emplace_back
|
||||||
|
(
|
||||||
|
name(),
|
||||||
|
addressing_,
|
||||||
|
zones.size(), // zoneID
|
||||||
|
zones
|
||||||
|
);
|
||||||
}
|
}
|
||||||
pointZones.clearAddressing();
|
zones.clearAddressing();
|
||||||
|
|
||||||
return ok && pointZones.write(writeOnProc);
|
return ok && zones.write(writeOnProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::pointZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
void Foam::pointZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
||||||
{
|
{
|
||||||
// pointZone
|
DynamicList<label> newAddressing(addressing_.size());
|
||||||
labelList newAddressing(addressing_.size());
|
|
||||||
|
|
||||||
label n = 0;
|
|
||||||
for (const label pointi : addressing_)
|
for (const label pointi : addressing_)
|
||||||
{
|
{
|
||||||
const label newPointi = morphMap.reversePointMap()[pointi];
|
const label newPointi = morphMap.reversePointMap()[pointi];
|
||||||
if (newPointi >= 0)
|
if (newPointi >= 0)
|
||||||
{
|
{
|
||||||
newAddressing[n] = newPointi;
|
newAddressing.push_back(newPointi);
|
||||||
++n;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAddressing.resize(n);
|
|
||||||
|
|
||||||
addressing_.transfer(newAddressing);
|
addressing_.transfer(newAddressing);
|
||||||
|
|
||||||
updateSet();
|
updateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -60,11 +60,10 @@ class pointZoneSet
|
|||||||
|
|
||||||
labelList addressing_;
|
labelList addressing_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("pointZoneSet");
|
TypeNameNoDebug("pointZoneSet");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -78,16 +77,16 @@ public:
|
|||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct empty with initial size for labelHashSet
|
//- Construct empty (no-read) with initial labelHashSet capacity.
|
||||||
pointZoneSet
|
pointZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct from existing set
|
//- Copy construct (no-read) from existing set
|
||||||
pointZoneSet
|
pointZoneSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -101,18 +100,19 @@ public:
|
|||||||
virtual ~pointZoneSet() = default;
|
virtual ~pointZoneSet() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
const labelList& addressing() const
|
const labelList& addressing() const noexcept
|
||||||
{
|
{
|
||||||
return addressing_;
|
return addressing_;
|
||||||
}
|
}
|
||||||
|
|
||||||
labelList& addressing()
|
labelList& addressing() noexcept
|
||||||
{
|
{
|
||||||
return addressing_;
|
return addressing_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Sort addressing and make pointSet part consistent with addressing
|
//- Sort addressing and make pointSet part consistent with addressing
|
||||||
void updateSet();
|
void updateSet();
|
||||||
|
|
||||||
@ -120,26 +120,24 @@ public:
|
|||||||
// Insert all members [0,maxLen) which were not in set
|
// Insert all members [0,maxLen) which were not in set
|
||||||
virtual void invert(const label maxLen);
|
virtual void invert(const label maxLen);
|
||||||
|
|
||||||
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
|
virtual void subset(const labelUList& elems);
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
virtual void subset(const topoSet& set);
|
virtual void subset(const topoSet& set);
|
||||||
|
|
||||||
//- Add elements present in set.
|
//- Add given elements to the set
|
||||||
|
virtual void addSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Add given elements to the set
|
||||||
virtual void addSet(const topoSet& set);
|
virtual void addSet(const topoSet& set);
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
//- Subtract given elements from the set
|
||||||
|
virtual void subtractSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Subtract given elements from the set
|
||||||
virtual void subtractSet(const topoSet& set);
|
virtual void subtractSet(const topoSet& set);
|
||||||
|
|
||||||
// Variants taking labelUList&
|
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
|
||||||
virtual void subset(const labelUList& set);
|
|
||||||
|
|
||||||
//- Add elements present in set.
|
|
||||||
virtual void addSet(const labelUList& set);
|
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
|
||||||
virtual void subtractSet(const labelUList& set);
|
|
||||||
|
|
||||||
|
|
||||||
//- Sync pointZoneSet across coupled patches.
|
//- Sync pointZoneSet across coupled patches.
|
||||||
virtual void sync(const polyMesh& mesh);
|
virtual void sync(const polyMesh& mesh);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -126,9 +126,8 @@ Foam::topoBitSet::topoBitSet
|
|||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
IOobject::NO_REGISTER
|
IOobject::NO_REGISTER
|
||||||
),
|
),
|
||||||
label(0) // zero-sized (unallocated) labelHashSet
|
Foam::zero{} // Empty labelHashSet (initialCapacity = 0)
|
||||||
),
|
)
|
||||||
selected_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -178,6 +177,12 @@ Foam::topoBitSet::topoBitSet
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::topoBitSet::contains(const label id) const
|
||||||
|
{
|
||||||
|
return selected_.test(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::topoBitSet::found(const label id) const
|
bool Foam::topoBitSet::found(const label id) const
|
||||||
{
|
{
|
||||||
return selected_.test(id);
|
return selected_.test(id);
|
||||||
@ -218,9 +223,12 @@ void Foam::topoBitSet::invert(const label maxLen)
|
|||||||
void Foam::topoBitSet::subset(const topoSet& set)
|
void Foam::topoBitSet::subset(const topoSet& set)
|
||||||
{
|
{
|
||||||
// Only retain entries found in both sets
|
// Only retain entries found in both sets
|
||||||
if (isA<topoBitSet>(set))
|
|
||||||
|
const auto* topoBitsPtr = isA<topoBitSet>(set);
|
||||||
|
|
||||||
|
if (topoBitsPtr)
|
||||||
{
|
{
|
||||||
selected_ &= refCast<const topoBitSet>(set).selected_;
|
selected_ &= topoBitsPtr->selected_;
|
||||||
}
|
}
|
||||||
else if (set.empty())
|
else if (set.empty())
|
||||||
{
|
{
|
||||||
@ -242,25 +250,27 @@ void Foam::topoBitSet::subset(const topoSet& set)
|
|||||||
void Foam::topoBitSet::subset(const labelUList& elems)
|
void Foam::topoBitSet::subset(const labelUList& elems)
|
||||||
{
|
{
|
||||||
// Only retain entries found in both sets
|
// Only retain entries found in both sets
|
||||||
bitSet newSelected(selected_.size());
|
bitSet newLabels(selected_.size());
|
||||||
|
|
||||||
for (const label id : elems)
|
for (const label id : elems)
|
||||||
{
|
{
|
||||||
if (selected_[id])
|
if (selected_.test(id))
|
||||||
{
|
{
|
||||||
newSelected.set(id);
|
newLabels.set(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selected_ = newSelected;
|
selected_.transfer(newLabels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::topoBitSet::addSet(const topoSet& set)
|
void Foam::topoBitSet::addSet(const topoSet& set)
|
||||||
{
|
{
|
||||||
// Add entries to the set
|
// Add entries to the set
|
||||||
if (isA<topoBitSet>(set))
|
const auto* topoBitsPtr = isA<topoBitSet>(set);
|
||||||
|
|
||||||
|
if (topoBitsPtr)
|
||||||
{
|
{
|
||||||
selected_ |= refCast<const topoBitSet>(set).selected_;
|
selected_ |= topoBitsPtr->selected_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -281,9 +291,11 @@ void Foam::topoBitSet::addSet(const labelUList& elems)
|
|||||||
void Foam::topoBitSet::subtractSet(const topoSet& set)
|
void Foam::topoBitSet::subtractSet(const topoSet& set)
|
||||||
{
|
{
|
||||||
// Subtract entries from the set
|
// Subtract entries from the set
|
||||||
if (isA<topoBitSet>(set))
|
const auto* topoBitsPtr = isA<topoBitSet>(set);
|
||||||
|
|
||||||
|
if (topoBitsPtr)
|
||||||
{
|
{
|
||||||
selected_ -= refCast<const topoBitSet>(set).selected_;
|
selected_ -= topoBitsPtr->selected_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -70,10 +70,10 @@ protected:
|
|||||||
virtual void check(const label maxSize);
|
virtual void check(const label maxSize);
|
||||||
|
|
||||||
|
|
||||||
//- Construct with empty selection
|
//- Construct (no-read) with empty selection
|
||||||
topoBitSet(const polyMesh& mesh, const word& setName);
|
topoBitSet(const polyMesh& mesh, const word& setName);
|
||||||
|
|
||||||
//- Construct with size elements
|
//- Construct (no-read) with \c size elements of initial value
|
||||||
topoBitSet
|
topoBitSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -82,7 +82,7 @@ protected:
|
|||||||
const bool val
|
const bool val
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct with bitset values, size elements
|
//- Copy construct from bitset values, size elements
|
||||||
topoBitSet
|
topoBitSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -91,7 +91,7 @@ protected:
|
|||||||
const bitSet& bits
|
const bitSet& bits
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Move construct with bitset values, size elements
|
//- Move construct from bitset values, size elements
|
||||||
topoBitSet
|
topoBitSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -127,6 +127,9 @@ public:
|
|||||||
selected_.reset();
|
selected_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Has the given index?
|
||||||
|
virtual bool contains(const label id) const;
|
||||||
|
|
||||||
//- Has the given index?
|
//- Has the given index?
|
||||||
virtual bool found(const label id) const;
|
virtual bool found(const label id) const;
|
||||||
|
|
||||||
@ -146,25 +149,23 @@ public:
|
|||||||
// Insert all members [0,maxLen) which were not in set.
|
// Insert all members [0,maxLen) which were not in set.
|
||||||
virtual void invert(const label maxLen);
|
virtual void invert(const label maxLen);
|
||||||
|
|
||||||
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
|
virtual void subset(const labelUList& elems);
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
virtual void subset(const topoSet& set);
|
virtual void subset(const topoSet& set);
|
||||||
|
|
||||||
//- Add elements present in set.
|
//- Add given elements to the set
|
||||||
|
virtual void addSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Add given elements to the set
|
||||||
virtual void addSet(const topoSet& set);
|
virtual void addSet(const topoSet& set);
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
//- Subtract given elements from the set
|
||||||
|
virtual void subtractSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Subtract given elements from the set
|
||||||
virtual void subtractSet(const topoSet& set);
|
virtual void subtractSet(const topoSet& set);
|
||||||
|
|
||||||
// Variants taking labelUList&
|
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
|
||||||
virtual void subset(const labelUList& set);
|
|
||||||
|
|
||||||
//- Add elements present in set.
|
|
||||||
virtual void addSet(const labelUList& set);
|
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
|
||||||
virtual void subtractSet(const labelUList& set);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -135,9 +135,8 @@ Foam::topoBoolSet::topoBoolSet
|
|||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
IOobject::NO_REGISTER
|
IOobject::NO_REGISTER
|
||||||
),
|
),
|
||||||
label(0) // zero-sized (unallocated) labelHashSet
|
Foam::zero{} // Empty labelHashSet (initialCapacity = 0)
|
||||||
),
|
)
|
||||||
selected_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -187,6 +186,12 @@ Foam::topoBoolSet::topoBoolSet
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::topoBoolSet::contains(const label id) const
|
||||||
|
{
|
||||||
|
return selected_.test(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::topoBoolSet::found(const label id) const
|
bool Foam::topoBoolSet::found(const label id) const
|
||||||
{
|
{
|
||||||
return selected_.test(id);
|
return selected_.test(id);
|
||||||
|
|||||||
@ -70,10 +70,10 @@ protected:
|
|||||||
virtual void check(const label maxSize);
|
virtual void check(const label maxSize);
|
||||||
|
|
||||||
|
|
||||||
//- Construct with empty selection
|
//- Construct (no-read) with empty selection
|
||||||
topoBoolSet(const polyMesh& mesh, const word& setName);
|
topoBoolSet(const polyMesh& mesh, const word& setName);
|
||||||
|
|
||||||
//- Construct with size elements
|
//- Construct (no-read) with \c size elements of initial value
|
||||||
topoBoolSet
|
topoBoolSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -100,7 +100,6 @@ protected:
|
|||||||
boolList&& bools
|
boolList&& bools
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -127,6 +126,9 @@ public:
|
|||||||
selected_ = false;
|
selected_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Has the given index?
|
||||||
|
virtual bool contains(const label id) const;
|
||||||
|
|
||||||
//- Has the given index?
|
//- Has the given index?
|
||||||
virtual bool found(const label id) const;
|
virtual bool found(const label id) const;
|
||||||
|
|
||||||
@ -146,25 +148,23 @@ public:
|
|||||||
// Insert all members [0,maxLen) which were not in set.
|
// Insert all members [0,maxLen) which were not in set.
|
||||||
virtual void invert(const label maxLen);
|
virtual void invert(const label maxLen);
|
||||||
|
|
||||||
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
|
virtual void subset(const labelUList& elems);
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
virtual void subset(const topoSet& set);
|
virtual void subset(const topoSet& set);
|
||||||
|
|
||||||
//- Add elements present in set.
|
//- Add given elements to the set
|
||||||
|
virtual void addSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Add given elements to the set
|
||||||
virtual void addSet(const topoSet& set);
|
virtual void addSet(const topoSet& set);
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
//- Subtract given elements from the set.
|
||||||
|
virtual void subtractSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Subtract given elements from the set.
|
||||||
virtual void subtractSet(const topoSet& set);
|
virtual void subtractSet(const topoSet& set);
|
||||||
|
|
||||||
// Variants taking labelUList&
|
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
|
||||||
virtual void subset(const labelUList& set);
|
|
||||||
|
|
||||||
//- Add elements present in set.
|
|
||||||
virtual void addSet(const labelUList& set);
|
|
||||||
|
|
||||||
//- Subtract elements present in set.
|
|
||||||
virtual void subtractSet(const labelUList& set);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -140,6 +140,30 @@ Foam::fileName Foam::topoSet::localPath
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::topoSet::readIOcontents
|
||||||
|
(
|
||||||
|
const word& wantedType,
|
||||||
|
labelHashSet& contents
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (isReadRequired() || (isReadOptional() && headerOk()))
|
||||||
|
{
|
||||||
|
Istream& is = readStream(wantedType);
|
||||||
|
|
||||||
|
if (is.good())
|
||||||
|
{
|
||||||
|
is >> contents;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
// Update stored cell numbers using map.
|
// Update stored cell numbers using map.
|
||||||
@ -200,10 +224,8 @@ void Foam::topoSet::updateLabels(const labelUList& map)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::topoSet::check(const label maxSize)
|
void Foam::topoSet::checkLabels(const labelUList& labels, const label maxSize)
|
||||||
{
|
{
|
||||||
const labelHashSet& labels = *this;
|
|
||||||
|
|
||||||
for (const label oldId : labels)
|
for (const label oldId : labels)
|
||||||
{
|
{
|
||||||
if (oldId < 0 || oldId >= maxSize)
|
if (oldId < 0 || oldId >= maxSize)
|
||||||
@ -211,21 +233,41 @@ void Foam::topoSet::check(const label maxSize)
|
|||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Illegal content " << oldId << " of set:" << name()
|
<< "Illegal content " << oldId << " of set:" << name()
|
||||||
<< " of type " << type() << nl
|
<< " of type " << type() << nl
|
||||||
<< "Value should be between [0," << maxSize << ')'
|
<< "Value should be between [0," << maxSize << ')' << nl
|
||||||
<< endl
|
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write maxElem elements, starting at iter. Updates iter and elemI.
|
void Foam::topoSet::checkLabels(const labelHashSet& labels, const label maxSize)
|
||||||
void Foam::topoSet::writeDebug
|
{
|
||||||
|
for (const label oldId : labels)
|
||||||
|
{
|
||||||
|
if (oldId < 0 || oldId >= maxSize)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Illegal content " << oldId << " of set:" << name()
|
||||||
|
<< " of type " << type() << nl
|
||||||
|
<< "Value should be between [0," << maxSize << ')' << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::topoSet::check(const label maxSize)
|
||||||
|
{
|
||||||
|
checkLabels(*this, maxSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write maxElem elements, starting at iter. Updates iter
|
||||||
|
Foam::label Foam::topoSet::writeDebug
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const label maxElem,
|
const label maxElem,
|
||||||
topoSet::const_iterator& iter,
|
labelHashSet::const_iterator& iter
|
||||||
label& elemI
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label n = 0;
|
label n = 0;
|
||||||
@ -239,19 +281,19 @@ void Foam::topoSet::writeDebug
|
|||||||
os << iter.key() << ' ';
|
os << iter.key() << ' ';
|
||||||
|
|
||||||
++n;
|
++n;
|
||||||
++elemI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write maxElem elements, starting at iter. Updates iter and elemI.
|
// Write maxElem elements, starting at iter. Updates iter
|
||||||
void Foam::topoSet::writeDebug
|
Foam::label Foam::topoSet::writeDebug
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& coords,
|
const pointField& coords,
|
||||||
const label maxElem,
|
const label maxElem,
|
||||||
topoSet::const_iterator& iter,
|
labelHashSet::const_iterator& iter
|
||||||
label& elemI
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label n = 0;
|
label n = 0;
|
||||||
@ -265,8 +307,9 @@ void Foam::topoSet::writeDebug
|
|||||||
os << iter.key() << coords[iter.key()] << ' ';
|
os << iter.key() << coords[iter.key()] << ' ';
|
||||||
|
|
||||||
++n;
|
++n;
|
||||||
++elemI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -283,22 +326,20 @@ void Foam::topoSet::writeDebug
|
|||||||
os << "Set bounding box: min = "
|
os << "Set bounding box: min = "
|
||||||
<< bb.min() << " max = " << bb.max() << " metres." << nl << endl;
|
<< bb.min() << " max = " << bb.max() << " metres." << nl << endl;
|
||||||
|
|
||||||
label n = 0;
|
labelHashSet::const_iterator iter = labelHashSet::cbegin();
|
||||||
|
|
||||||
topoSet::const_iterator iter = this->cbegin();
|
|
||||||
|
|
||||||
if (size() <= maxLen)
|
if (size() <= maxLen)
|
||||||
{
|
{
|
||||||
writeDebug(os, coords, maxLen, iter, n);
|
writeDebug(os, coords, maxLen, iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label halfLen = maxLen/2;
|
const label halfLen = maxLen/2;
|
||||||
|
|
||||||
os << "Size larger than " << maxLen << ". Printing first and last "
|
os << "Size larger than " << maxLen << ". Printing first and last "
|
||||||
<< halfLen << " elements:" << nl << endl;
|
<< halfLen << " elements:" << nl << endl;
|
||||||
|
|
||||||
writeDebug(os, coords, halfLen, iter, n);
|
label n = writeDebug(os, coords, halfLen, iter);
|
||||||
|
|
||||||
os << nl << " .." << nl << endl;
|
os << nl << " .." << nl << endl;
|
||||||
|
|
||||||
@ -307,7 +348,7 @@ void Foam::topoSet::writeDebug
|
|||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeDebug(os, coords, halfLen, iter, n);
|
writeDebug(os, coords, halfLen, iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +360,8 @@ Foam::IOobject Foam::topoSet::findIOobject
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOobject io
|
IOobject io
|
||||||
@ -329,13 +371,14 @@ Foam::IOobject Foam::topoSet::findIOobject
|
|||||||
(
|
(
|
||||||
mesh.meshDir()/"sets",
|
mesh.meshDir()/"sets",
|
||||||
word::null,
|
word::null,
|
||||||
IOobject::READ_IF_PRESENT,
|
IOobjectOption::READ_IF_PRESENT,
|
||||||
mesh.facesInstance()
|
mesh.facesInstance()
|
||||||
),
|
),
|
||||||
polyMesh::meshSubDir/"sets",
|
polyMesh::meshSubDir/"sets",
|
||||||
mesh,
|
mesh,
|
||||||
rOpt,
|
rOpt,
|
||||||
wOpt
|
wOpt,
|
||||||
|
reg
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!io.typeHeaderOk<topoSet>(false) && disallowGenericSets != 0)
|
if (!io.typeHeaderOk<topoSet>(false) && disallowGenericSets != 0)
|
||||||
@ -353,7 +396,8 @@ Foam::IOobject Foam::topoSet::findIOobject
|
|||||||
const Time& runTime,
|
const Time& runTime,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt,
|
IOobjectOption::readOption rOpt,
|
||||||
IOobjectOption::writeOption wOpt
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return IOobject
|
return IOobject
|
||||||
@ -364,6 +408,8 @@ Foam::IOobject Foam::topoSet::findIOobject
|
|||||||
polyMesh::meshSubDir/"sets",
|
polyMesh::meshSubDir/"sets",
|
||||||
word::null,
|
word::null,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
|
||||||
|
// The stop instance with "polyMesh/faces"
|
||||||
runTime.findInstance
|
runTime.findInstance
|
||||||
(
|
(
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
@ -374,7 +420,8 @@ Foam::IOobject Foam::topoSet::findIOobject
|
|||||||
polyMesh::meshSubDir/"sets",
|
polyMesh::meshSubDir/"sets",
|
||||||
runTime,
|
runTime,
|
||||||
rOpt,
|
rOpt,
|
||||||
wOpt
|
wOpt,
|
||||||
|
reg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,97 +432,20 @@ Foam::topoSet::topoSet(const IOobject& io, const word& wantedType)
|
|||||||
:
|
:
|
||||||
regIOobject(io)
|
regIOobject(io)
|
||||||
{
|
{
|
||||||
if (isReadRequired() || (isReadOptional() && headerOk()))
|
readIOcontents(wantedType, static_cast<labelHashSet&>(*this));
|
||||||
{
|
|
||||||
if (readStream(wantedType).good())
|
|
||||||
{
|
|
||||||
readStream(wantedType) >> static_cast<labelHashSet&>(*this);
|
|
||||||
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::topoSet::topoSet
|
Foam::topoSet::topoSet(const IOobject& io, const Foam::zero)
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& wantedType,
|
|
||||||
const word& name,
|
|
||||||
IOobjectOption::readOption rOpt,
|
|
||||||
IOobjectOption::writeOption wOpt
|
|
||||||
)
|
|
||||||
:
|
:
|
||||||
regIOobject(findIOobject(mesh, name, rOpt, wOpt))
|
regIOobject(io)
|
||||||
{
|
|
||||||
if (isReadRequired() || (isReadOptional() && headerOk()))
|
|
||||||
{
|
|
||||||
if (readStream(wantedType).good())
|
|
||||||
{
|
|
||||||
readStream(wantedType) >> static_cast<labelHashSet&>(*this);
|
|
||||||
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::topoSet::topoSet
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& name,
|
|
||||||
const label size,
|
|
||||||
IOobjectOption::writeOption wOpt
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt)),
|
|
||||||
labelHashSet(size)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::topoSet::topoSet
|
Foam::topoSet::topoSet(const IOobject& io, const label initialCapacity)
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& name,
|
|
||||||
const labelHashSet& labels,
|
|
||||||
IOobjectOption::writeOption wOpt
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt)),
|
|
||||||
labelHashSet(labels)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::topoSet::topoSet
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& name,
|
|
||||||
labelHashSet&& labels,
|
|
||||||
IOobjectOption::writeOption wOpt
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt)),
|
|
||||||
labelHashSet(std::move(labels))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::topoSet::topoSet
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& name,
|
|
||||||
const labelUList& labels,
|
|
||||||
IOobjectOption::writeOption wOpt
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt)),
|
|
||||||
labelHashSet(labels)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::topoSet::topoSet(const IOobject& io, const label size)
|
|
||||||
:
|
:
|
||||||
regIOobject(io),
|
regIOobject(io),
|
||||||
labelHashSet(size)
|
labelHashSet(initialCapacity)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -493,11 +463,89 @@ Foam::topoSet::topoSet(const IOobject& io, labelHashSet&& labels)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::topoSet::topoSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& wantedType,
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::readOption rOpt,
|
||||||
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(findIOobject(mesh, name, rOpt, wOpt, reg))
|
||||||
|
{
|
||||||
|
readIOcontents(wantedType, static_cast<labelHashSet&>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::topoSet::topoSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const label initialCapacity,
|
||||||
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt, reg)),
|
||||||
|
labelHashSet(initialCapacity)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::topoSet::topoSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const labelHashSet& labels,
|
||||||
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt, reg)),
|
||||||
|
labelHashSet(labels)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::topoSet::topoSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
labelHashSet&& labels,
|
||||||
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt, reg)),
|
||||||
|
labelHashSet(std::move(labels))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::topoSet::topoSet
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const labelUList& labels,
|
||||||
|
IOobjectOption::writeOption wOpt,
|
||||||
|
IOobjectOption::registerOption reg
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(findIOobject(mesh, name, IOobject::NO_READ, wOpt, reg)),
|
||||||
|
labelHashSet(labels)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::topoSet::contains(const label id) const
|
||||||
|
{
|
||||||
|
return static_cast<const labelHashSet&>(*this).contains(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::topoSet::found(const label id) const
|
bool Foam::topoSet::found(const label id) const
|
||||||
{
|
{
|
||||||
return static_cast<const labelHashSet&>(*this).found(id);
|
return static_cast<const labelHashSet&>(*this).contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -534,13 +582,13 @@ void Foam::topoSet::invert(const label maxLen)
|
|||||||
);
|
);
|
||||||
|
|
||||||
clear(); // Maybe don't trust the previous move operation
|
clear(); // Maybe don't trust the previous move operation
|
||||||
reserve(max(64, (maxLen - original.size())));
|
reserve(Foam::max(64, (maxLen - original.size())));
|
||||||
|
|
||||||
for (label id=0; id < maxLen; ++id)
|
for (label id = 0; id < maxLen; ++id)
|
||||||
{
|
{
|
||||||
if (!original.found(id))
|
if (!original.contains(id))
|
||||||
{
|
{
|
||||||
this->set(id);
|
labelHashSet::set(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -558,10 +606,11 @@ void Foam::topoSet::subset(const labelUList& elems)
|
|||||||
// Only retain entries found in both sets
|
// Only retain entries found in both sets
|
||||||
auto& currentSet = static_cast<labelHashSet&>(*this);
|
auto& currentSet = static_cast<labelHashSet&>(*this);
|
||||||
|
|
||||||
DynamicList<label> newElems(elems.size()+currentSet.size());
|
DynamicList<label> newElems(Foam::min(elems.size(), currentSet.size()));
|
||||||
|
|
||||||
for (const label elem : elems)
|
for (const label elem : elems)
|
||||||
{
|
{
|
||||||
if (currentSet.found(elem))
|
if (currentSet.contains(elem))
|
||||||
{
|
{
|
||||||
newElems.push_back(elem);
|
newElems.push_back(elem);
|
||||||
}
|
}
|
||||||
@ -609,22 +658,20 @@ void Foam::topoSet::sync(const polyMesh&)
|
|||||||
|
|
||||||
void Foam::topoSet::writeDebug(Ostream& os, const label maxLen) const
|
void Foam::topoSet::writeDebug(Ostream& os, const label maxLen) const
|
||||||
{
|
{
|
||||||
label n = 0;
|
labelHashSet::const_iterator iter = labelHashSet::cbegin();
|
||||||
|
|
||||||
topoSet::const_iterator iter = this->cbegin();
|
|
||||||
|
|
||||||
if (size() <= maxLen)
|
if (size() <= maxLen)
|
||||||
{
|
{
|
||||||
writeDebug(os, maxLen, iter, n);
|
writeDebug(os, maxLen, iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label halfLen = maxLen/2;
|
const label halfLen = maxLen/2;
|
||||||
|
|
||||||
os << "Size larger than " << maxLen << ". Printing first and last "
|
os << "Size larger than " << maxLen << ". Printing first and last "
|
||||||
<< halfLen << " elements:" << nl << endl;
|
<< halfLen << " elements:" << nl << endl;
|
||||||
|
|
||||||
writeDebug(os, halfLen, iter, n);
|
label n = writeDebug(os, halfLen, iter);
|
||||||
|
|
||||||
os << nl << " .." << nl << endl;
|
os << nl << " .." << nl << endl;
|
||||||
|
|
||||||
@ -633,7 +680,7 @@ void Foam::topoSet::writeDebug(Ostream& os, const label maxLen) const
|
|||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeDebug(os, halfLen, iter, n);
|
writeDebug(os, halfLen, iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,15 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read into labelHashSet if IOobject flags set. Return true if read.
|
||||||
|
bool readIOcontents(const word& wantedType, labelHashSet& contents);
|
||||||
|
|
||||||
|
//- Check limits on addressable range.
|
||||||
|
void checkLabels(const labelUList& labels, const label maxSize);
|
||||||
|
|
||||||
|
//- Check limits on addressable range.
|
||||||
|
void checkLabels(const labelHashSet& labels, const label maxSize);
|
||||||
|
|
||||||
//- Update map from map.
|
//- Update map from map.
|
||||||
// Used to update cell/face labels after morphing
|
// Used to update cell/face labels after morphing
|
||||||
virtual void updateLabels(const labelUList& map);
|
virtual void updateLabels(const labelUList& map);
|
||||||
@ -77,24 +86,25 @@ protected:
|
|||||||
//- Check limits on addressable range.
|
//- Check limits on addressable range.
|
||||||
virtual void check(const label maxSize);
|
virtual void check(const label maxSize);
|
||||||
|
|
||||||
//- Write part of contents nicely formatted. Prints labels only.
|
//- Write part of contents nicely formatted.
|
||||||
void writeDebug
|
// Prints labels only.
|
||||||
|
// \returns number of labels written
|
||||||
|
label writeDebug
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const label maxElem,
|
const label maxElem,
|
||||||
topoSet::const_iterator& iter,
|
labelHashSet::const_iterator& iter
|
||||||
label& elemI
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write part of contents nicely formatted. Prints label
|
//- Write part of contents nicely formatted.
|
||||||
// and corresponding coordinate.
|
// Prints label and corresponding coordinate.
|
||||||
void writeDebug
|
// \returns number of labels written
|
||||||
|
label writeDebug
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& coords,
|
const pointField& coords,
|
||||||
const label maxElem,
|
const label maxElem,
|
||||||
topoSet::const_iterator& iter,
|
labelHashSet::const_iterator& iter
|
||||||
label& elemI
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write labels and coordinates columnwise to os. Truncate to maxLen.
|
//- Write labels and coordinates columnwise to os. Truncate to maxLen.
|
||||||
@ -123,22 +133,37 @@ public:
|
|||||||
//- Name of file set will use.
|
//- Name of file set will use.
|
||||||
static fileName localPath(const polyMesh& mesh, const word& name);
|
static fileName localPath(const polyMesh& mesh, const word& name);
|
||||||
|
|
||||||
//- Find IOobject in the polyMesh/sets (used as constructor helper)
|
//- Find IOobject in the polyMesh/sets/ (used as constructor helper)
|
||||||
static IOobject findIOobject
|
static IOobject findIOobject
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Find IOobject in the polyMesh/sets (used as constructor helper)
|
//- Find IOobject in the polyMesh/sets/ (used as constructor helper)
|
||||||
|
static IOobject findIOobject
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption reg,
|
||||||
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return findIOobject(mesh, name, rOpt, wOpt, reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find IOobject in the polyMesh/sets/ (used as constructor helper)
|
||||||
static IOobject findIOobject
|
static IOobject findIOobject
|
||||||
(
|
(
|
||||||
const Time& runTime,
|
const Time& runTime,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -196,6 +221,21 @@ public:
|
|||||||
// Can't use typeName info here since subclasses not yet instantiated
|
// Can't use typeName info here since subclasses not yet instantiated
|
||||||
topoSet(const IOobject& io, const word& wantedType);
|
topoSet(const IOobject& io, const word& wantedType);
|
||||||
|
|
||||||
|
//- Construct empty (no-read) with IOobject information
|
||||||
|
topoSet(const IOobject& io, const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct empty (no-read) with initial labelHashSet capacity,
|
||||||
|
//- with IOobject information
|
||||||
|
topoSet(const IOobject& io, const label initialCapacity);
|
||||||
|
|
||||||
|
//- Copy construct (no-read) from labelHashSet,
|
||||||
|
//- with IOobject information.
|
||||||
|
topoSet(const IOobject& io, const labelHashSet& labels);
|
||||||
|
|
||||||
|
//- Move construct (no-read) from labelHashSet,
|
||||||
|
//- with IOobject information.
|
||||||
|
topoSet(const IOobject& io, labelHashSet&& labels);
|
||||||
|
|
||||||
//- Construct from polyMesh and name.
|
//- Construct from polyMesh and name.
|
||||||
// Searches for a polyMesh/sets directory but not beyond the
|
// Searches for a polyMesh/sets directory but not beyond the
|
||||||
// mesh.facesInstance().
|
// mesh.facesInstance().
|
||||||
@ -205,21 +245,23 @@ public:
|
|||||||
const word& wantedType,
|
const word& wantedType,
|
||||||
const word& name,
|
const word& name,
|
||||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct empty from additional size of labelHashSet.
|
//- Construct empty (no-read) with initial labelHashSet capacity.
|
||||||
// Searches for a polyMesh/sets directory but not beyond the
|
// Searches for a polyMesh/sets directory but not beyond the
|
||||||
// mesh.facesInstance().
|
// mesh.facesInstance().
|
||||||
topoSet
|
topoSet
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label initialCapacity,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy of labelHashSet
|
//- Copy construct (no-read) from labelHashSet.
|
||||||
// Searches for a polyMesh/sets directory but not beyond the
|
// Searches for a polyMesh/sets directory but not beyond the
|
||||||
// mesh.facesInstance().
|
// mesh.facesInstance().
|
||||||
topoSet
|
topoSet
|
||||||
@ -227,10 +269,11 @@ public:
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const labelHashSet& labels,
|
const labelHashSet& labels,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with moving labelHashSet
|
//- Move construct (no-read) from labelHashSet.
|
||||||
// Searches for a polyMesh/sets directory but not beyond the
|
// Searches for a polyMesh/sets directory but not beyond the
|
||||||
// mesh.facesInstance().
|
// mesh.facesInstance().
|
||||||
topoSet
|
topoSet
|
||||||
@ -238,10 +281,11 @@ public:
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
labelHashSet&& labels,
|
labelHashSet&& labels,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct (no-read) with copy of labels
|
//- Copy construct (no-read) from list of labels.
|
||||||
// Searches for a polyMesh/sets directory but not beyond the
|
// Searches for a polyMesh/sets directory but not beyond the
|
||||||
// mesh.facesInstance().
|
// mesh.facesInstance().
|
||||||
topoSet
|
topoSet
|
||||||
@ -249,18 +293,10 @@ public:
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& name,
|
const word& name,
|
||||||
const labelUList& labels,
|
const labelUList& labels,
|
||||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE
|
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||||
|
IOobjectOption::registerOption reg = IOobjectOption::LEGACY_REGISTER
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct empty from IOobject and HashSet size.
|
|
||||||
topoSet(const IOobject& io, const label size);
|
|
||||||
|
|
||||||
//- Construct from IOobject and copy of labelHashSet.
|
|
||||||
topoSet(const IOobject& io, const labelHashSet& labels);
|
|
||||||
|
|
||||||
//- Construct from IOobject and move labelHashSet.
|
|
||||||
topoSet(const IOobject& io, labelHashSet&& labels);
|
|
||||||
|
|
||||||
|
|
||||||
//- Clone
|
//- Clone
|
||||||
autoPtr<topoSet> clone() const
|
autoPtr<topoSet> clone() const
|
||||||
@ -309,6 +345,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Has the given index?
|
||||||
|
virtual bool contains(const label id) const;
|
||||||
|
|
||||||
//- Has the given index?
|
//- Has the given index?
|
||||||
virtual bool found(const label id) const;
|
virtual bool found(const label id) const;
|
||||||
|
|
||||||
@ -329,23 +368,23 @@ public:
|
|||||||
virtual void invert(const label maxLen);
|
virtual void invert(const label maxLen);
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
virtual void subset(const topoSet& set);
|
virtual void subset(const labelUList& elems);
|
||||||
|
|
||||||
//- Subset contents. Only elements present in both sets remain.
|
//- Subset contents. Only elements present in both sets remain.
|
||||||
virtual void subset(const labelUList& set);
|
virtual void subset(const topoSet& set);
|
||||||
|
|
||||||
//- Add elements
|
//- Add given elements to the set
|
||||||
|
virtual void addSet(const labelUList& elems);
|
||||||
|
|
||||||
|
//- Add given elements to the set
|
||||||
virtual void addSet(const topoSet& set);
|
virtual void addSet(const topoSet& set);
|
||||||
|
|
||||||
//- Add elements
|
//- Subtract given elements from the set
|
||||||
virtual void addSet(const labelUList& set);
|
virtual void subtractSet(const labelUList& elems);
|
||||||
|
|
||||||
//- Subtract elements
|
//- Subtract given elements from the set
|
||||||
virtual void subtractSet(const topoSet& set);
|
virtual void subtractSet(const topoSet& set);
|
||||||
|
|
||||||
//- Subtract elements
|
|
||||||
virtual void subtractSet(const labelUList& set);
|
|
||||||
|
|
||||||
|
|
||||||
//- Sync set across coupled patches.
|
//- Sync set across coupled patches.
|
||||||
virtual void sync(const polyMesh& mesh);
|
virtual void sync(const polyMesh& mesh);
|
||||||
@ -374,19 +413,23 @@ public:
|
|||||||
//- Return max allowable index (+1). Not implemented.
|
//- Return max allowable index (+1). Not implemented.
|
||||||
virtual label maxSize(const polyMesh& mesh) const = 0;
|
virtual label maxSize(const polyMesh& mesh) const = 0;
|
||||||
|
|
||||||
//- Helper: call updateMesh on all sets in container (and
|
//- Helper: call updateMesh on all items in container
|
||||||
// updates instance)
|
//- (and updates instance)
|
||||||
template<class Container>
|
template<class Container>
|
||||||
static void updateMesh
|
static void updateMesh
|
||||||
(
|
(
|
||||||
const fileName& instance,
|
const fileName& instance,
|
||||||
const mapPolyMesh&,
|
const mapPolyMesh&,
|
||||||
Container&
|
Container& items
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Helper: set instance on all sets in container
|
//- Helper: set instance on all items in container
|
||||||
template<class Container>
|
template<class Container>
|
||||||
static void setInstance(const fileName& instance, Container&);
|
static void setInstance
|
||||||
|
(
|
||||||
|
const fileName& instance,
|
||||||
|
Container& items
|
||||||
|
);
|
||||||
|
|
||||||
//- Helper: remove all sets files from mesh instance
|
//- Helper: remove all sets files from mesh instance
|
||||||
static void removeFiles(const polyMesh&);
|
static void removeFiles(const polyMesh&);
|
||||||
|
|||||||
@ -25,19 +25,18 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
void Foam::topoSet::setInstance
|
void Foam::topoSet::setInstance
|
||||||
(
|
(
|
||||||
const fileName& instance,
|
const fileName& instance,
|
||||||
Container& lst
|
Container& items
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(lst, i)
|
for (auto& item : items)
|
||||||
{
|
{
|
||||||
lst[i].instance() = instance;
|
item.instance() = instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,13 +46,13 @@ void Foam::topoSet::updateMesh
|
|||||||
(
|
(
|
||||||
const fileName& instance,
|
const fileName& instance,
|
||||||
const mapPolyMesh& map,
|
const mapPolyMesh& map,
|
||||||
Container& lst
|
Container& items
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(lst, i)
|
for (auto& item : items)
|
||||||
{
|
{
|
||||||
lst[i].instance() = instance;
|
item.instance() = instance;
|
||||||
lst[i].updateMesh(map);
|
item.updateMesh(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -377,14 +377,16 @@ void Foam::regionsToCell::combine(topoSet& set, const bool add) const
|
|||||||
// Note: wip. Select cells first
|
// Note: wip. Select cells first
|
||||||
boolList selectedCell(mesh_.nCells(), true);
|
boolList selectedCell(mesh_.nCells(), true);
|
||||||
|
|
||||||
if (setName_.size() && setName_ != "none")
|
if (!setName_.empty() && setName_ != "none")
|
||||||
{
|
{
|
||||||
Info<< " Loading subset " << setName_ << " to delimit search region."
|
Info<< " Loading subset " << setName_
|
||||||
<< endl;
|
<< " to delimit search region." << nl;
|
||||||
cellSet subSet(mesh_, setName_);
|
|
||||||
|
cellSet loadedSet(mesh_, setName_, IOobject::NO_REGISTER);
|
||||||
|
const labelHashSet& cellLabels = loadedSet;
|
||||||
|
|
||||||
selectedCell = false;
|
selectedCell = false;
|
||||||
for (const label celli : static_cast<const labelHashSet&>(subSet))
|
for (const label celli : cellLabels)
|
||||||
{
|
{
|
||||||
selectedCell[celli] = true;
|
selectedCell[celli] = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user