Merge branch 'feature-topoSet-with-zone' into 'develop'
topoSet: allow use of 'zone' instead 'set', 'zones' instead of 'sets' in all set sources See merge request Development/openfoam!674
This commit is contained in:
commit
77ec7ab679
@ -50,7 +50,7 @@ Usage
|
||||
source boxToCell;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
boxes
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -60,7 +60,8 @@ Foam::cellToCell::cellToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
names_(one{}, setName)
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -71,15 +72,9 @@ Foam::cellToCell::cellToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh, dict),
|
||||
names_()
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_))
|
||||
{}
|
||||
|
||||
|
||||
Foam::cellToCell::cellToCell
|
||||
@ -89,7 +84,8 @@ Foam::cellToCell::cellToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
names_(one{}, word(checkIs(is)))
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -105,30 +101,44 @@ void Foam::cellToCell::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all elements of cell sets: "
|
||||
Info<< " Adding all elements of cell "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
|
||||
set.addSet(loadedSet);
|
||||
if (isZone_)
|
||||
{
|
||||
set.addSet(mesh_.cellZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
set.addSet(loadedSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all elements of cell sets: "
|
||||
Info<< " Removing all elements of cell "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
|
||||
set.subtractSet(loadedSet);
|
||||
if (isZone_)
|
||||
{
|
||||
set.subtractSet(mesh_.cellZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
set.subtractSet(loadedSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,7 +28,8 @@ Class
|
||||
Foam::cellToCell
|
||||
|
||||
Description
|
||||
A \c topoSetCellSource to select all the cells from given \c cellSet(s).
|
||||
A \c topoSetCellSource to select all the cells from given \c cellSet(s)
|
||||
or \c cellZone(s).
|
||||
|
||||
Operands:
|
||||
\table
|
||||
@ -50,7 +51,7 @@ Usage
|
||||
source cellToCell;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -61,7 +62,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <cellSetName>;
|
||||
zones
|
||||
(
|
||||
<cellZoneName0>
|
||||
<cellZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <cellSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <cellZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -81,17 +93,15 @@ Usage
|
||||
subtract | Remove selected cells from this cellSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input cellSets | wordList | cond'l | -
|
||||
zones | Names of input cellZones | wordList | cond'l | -
|
||||
set | Name of input cellSet | word | cond'l | -
|
||||
zone | Name of input cellZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
- Foam::topoSetCellSource
|
||||
@ -101,8 +111,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellToCell_H
|
||||
#define cellToCell_H
|
||||
#ifndef Foam_cellToCell_H
|
||||
#define Foam_cellToCell_H
|
||||
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
@ -124,9 +134,12 @@ class cellToCell
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Names of sets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -66,18 +66,14 @@ Foam::faceToCell::faceActionNames_
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faceToCell::combine
|
||||
template<class Selector>
|
||||
void Foam::faceToCell::combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
const Selector& faceLabels
|
||||
) const
|
||||
{
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
|
||||
const labelHashSet& faceLabels = loadedSet;
|
||||
|
||||
// Handle owner/neighbour/any selection
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
@ -104,7 +100,7 @@ void Foam::faceToCell::combine
|
||||
{
|
||||
// Count number of selected faces per cell.
|
||||
|
||||
Map<label> facesPerCell(loadedSet.size());
|
||||
Map<label> facesPerCell(faceLabels.size());
|
||||
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
@ -134,6 +130,31 @@ void Foam::faceToCell::combine
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceToCell::combine
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
) const
|
||||
{
|
||||
if (isZone_)
|
||||
{
|
||||
const labelList& faceLabels = mesh_.faceZones()[setName];
|
||||
|
||||
combineImpl(set, add, faceLabels);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
|
||||
const labelHashSet& faceLabels = loadedSet;
|
||||
|
||||
combineImpl(set, add, faceLabels);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faceToCell::faceToCell
|
||||
@ -144,7 +165,8 @@ Foam::faceToCell::faceToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
names_(one{}, setName),
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
@ -157,15 +179,9 @@ Foam::faceToCell::faceToCell
|
||||
:
|
||||
topoSetCellSource(mesh, dict),
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_)),
|
||||
option_(faceActionNames_.get("option", dict))
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::faceToCell::faceToCell
|
||||
@ -175,7 +191,8 @@ Foam::faceToCell::faceToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
names_(one{}, word(checkIs(is))),
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false),
|
||||
option_(faceActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -192,8 +209,9 @@ void Foam::faceToCell::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells according to face sets: "
|
||||
<< flatOutput(names_) << endl;
|
||||
Info<< " Adding cells according to face "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
@ -205,8 +223,9 @@ void Foam::faceToCell::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells according to face sets: "
|
||||
<< flatOutput(names_) << endl;
|
||||
Info<< " Removing cells according to face "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,7 @@ Usage
|
||||
option <option>;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -64,7 +64,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
zones
|
||||
(
|
||||
<faceZoneName0>
|
||||
<faceZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <faceSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <faceZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -93,17 +104,15 @@ Usage
|
||||
neighbour | Cells that are neighbour of given faces
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input faceSets | wordList | cond'l | -
|
||||
zones | Names of input faceZones | wordList | cond'l | -
|
||||
set | Name of input faceSet | word | cond'l | -
|
||||
zone | Name of input faceZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
- Foam::topoSetCellSource
|
||||
@ -114,8 +123,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceToCell_H
|
||||
#define faceToCell_H
|
||||
#ifndef Foam_faceToCell_H
|
||||
#define Foam_faceToCell_H
|
||||
|
||||
#include "topoSetCellSource.H"
|
||||
#include "Enum.H"
|
||||
@ -153,15 +162,27 @@ private:
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Names of sets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
//- Option
|
||||
faceAction option_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Depending on face to cell option add to or delete from cellSet.
|
||||
template<class Selector>
|
||||
void combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const Selector& faceLabels
|
||||
) const;
|
||||
|
||||
//- Depending on face to cell option add to or delete from cellSet.
|
||||
void combine(topoSet& set, const bool add, const word& setName) const;
|
||||
|
||||
|
@ -52,7 +52,7 @@ Usage
|
||||
option <option>;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
zones
|
||||
@ -63,7 +63,7 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <faceZoneName>;
|
||||
zone <faceZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
@ -48,7 +48,7 @@ Usage
|
||||
source patchToCell;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
patches
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,18 +64,14 @@ Foam::pointToCell::pointActionNames_
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::pointToCell::combine
|
||||
template<class Selector>
|
||||
void Foam::pointToCell::combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
const Selector& pointLabels
|
||||
) const
|
||||
{
|
||||
// Load the set
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
|
||||
const labelHashSet& pointLabels = loadedSet;
|
||||
|
||||
// Handle any selection
|
||||
if (option_ == ANY)
|
||||
{
|
||||
@ -114,6 +110,31 @@ void Foam::pointToCell::combine
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointToCell::combine
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
) const
|
||||
{
|
||||
if (isZone_)
|
||||
{
|
||||
const labelList& pointLabels = mesh_.pointZones()[setName];
|
||||
|
||||
combineImpl(set, add, pointLabels);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the set
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
|
||||
const labelHashSet& pointLabels = loadedSet;
|
||||
|
||||
combineImpl(set, add, pointLabels);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointToCell::pointToCell
|
||||
@ -124,7 +145,8 @@ Foam::pointToCell::pointToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
names_(one{}, setName),
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
@ -137,15 +159,9 @@ Foam::pointToCell::pointToCell
|
||||
:
|
||||
topoSetCellSource(mesh, dict),
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_)),
|
||||
option_(pointActionNames_.get("option", dict))
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::pointToCell::pointToCell
|
||||
@ -155,7 +171,8 @@ Foam::pointToCell::pointToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
names_(one{}, word(checkIs(is))),
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false),
|
||||
option_(pointActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -172,7 +189,8 @@ void Foam::pointToCell::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells according to point sets: "
|
||||
Info<< " Adding cells according to point "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
@ -185,7 +203,8 @@ void Foam::pointToCell::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells according to point sets: "
|
||||
Info<< " Removing cells according to point "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,7 @@ Usage
|
||||
option <option>;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -62,8 +62,19 @@ Usage
|
||||
...
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <pointSetName>;
|
||||
// Option-3
|
||||
zones
|
||||
(
|
||||
<pointZoneName0>
|
||||
<pointZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <pointSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <pointZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -90,17 +101,15 @@ Usage
|
||||
edge | Cells using an edge with both points in pointSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input pointSets | wordList | cond'l | -
|
||||
zones | Names of input pointZones | wordList | cond'l | -
|
||||
set | Name of input pointSet | word | cond'l | -
|
||||
zone | Name of input pointZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
- Foam::topoSetCellSource
|
||||
@ -110,8 +119,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointToCell_H
|
||||
#define pointToCell_H
|
||||
#ifndef Foam_pointToCell_H
|
||||
#define Foam_pointToCell_H
|
||||
|
||||
#include "topoSetCellSource.H"
|
||||
#include "Enum.H"
|
||||
@ -148,15 +157,27 @@ private:
|
||||
|
||||
static const Enum<pointAction> pointActionNames_;
|
||||
|
||||
//- Names of sets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
//- Selection type
|
||||
pointAction option_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Depending on point to cell option add to or delete from cellSet.
|
||||
template<class Selector>
|
||||
void combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const Selector& pointLabels
|
||||
) const;
|
||||
|
||||
//- Depending on point-to-cell option add to or delete from cellSet.
|
||||
void combine(topoSet& set, const bool add, const word& setName) const;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -346,18 +346,33 @@ void Foam::regionToCell::combine(topoSet& set, const bool add) const
|
||||
// Note: wip. Select cells first
|
||||
boolList selectedCell(mesh_.nCells(), true);
|
||||
|
||||
if (setName_.size() && setName_ != "none")
|
||||
if (!setName_.empty() && setName_ != "none")
|
||||
{
|
||||
Info<< " Loading subset " << setName_
|
||||
<< " to delimit search region."
|
||||
<< endl;
|
||||
|
||||
cellSet subSet(mesh_, setName_);
|
||||
|
||||
selectedCell = false;
|
||||
for (const label celli : subSet)
|
||||
if (isZone_)
|
||||
{
|
||||
selectedCell[celli] = true;
|
||||
Info<< " Using cellZone " << setName_
|
||||
<< " to delimit search region."
|
||||
<< endl;
|
||||
|
||||
selectedCell = false;
|
||||
for (const label celli : mesh_.cellZones()[setName_])
|
||||
{
|
||||
selectedCell[celli] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " Loading cellSet " << setName_
|
||||
<< " to delimit search region."
|
||||
<< endl;
|
||||
|
||||
cellSet subSet(mesh_, setName_);
|
||||
|
||||
selectedCell = false;
|
||||
for (const label celli : subSet)
|
||||
{
|
||||
selectedCell[celli] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,6 +407,7 @@ Foam::regionToCell::regionToCell
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
setName_(setName),
|
||||
isZone_(false),
|
||||
insidePoints_(insidePoints),
|
||||
nErode_(nErode)
|
||||
{}
|
||||
@ -404,13 +420,24 @@ Foam::regionToCell::regionToCell
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh, dict),
|
||||
setName_(dict.getOrDefault<word>("set", "none")),
|
||||
setName_(),
|
||||
isZone_(false),
|
||||
insidePoints_
|
||||
(
|
||||
dict.getCompat<pointField>("insidePoints", {{ "insidePoint", 0 }})
|
||||
),
|
||||
nErode_(dict.getCheckOrDefault<label>("nErode", 0, labelMinMax::ge(0)))
|
||||
{}
|
||||
{
|
||||
// A single set or zone only!
|
||||
if (dict.readIfPresent("set", setName_))
|
||||
{
|
||||
isZone_ = false;
|
||||
}
|
||||
else if (dict.readIfPresent("zone", setName_))
|
||||
{
|
||||
isZone_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::regionToCell::regionToCell
|
||||
@ -421,6 +448,7 @@ Foam::regionToCell::regionToCell
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
isZone_(false),
|
||||
insidePoints_(checkIs(is)),
|
||||
nErode_(readLabel(checkIs(is)))
|
||||
{}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,6 +59,7 @@ Usage
|
||||
|
||||
// Optional entries
|
||||
set <cellSetName>;
|
||||
zone <cellZoneName>;
|
||||
nErode <label>;
|
||||
}
|
||||
\endverbatim
|
||||
@ -93,8 +94,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regionToCell_H
|
||||
#define regionToCell_H
|
||||
#ifndef Foam_regionToCell_H
|
||||
#define Foam_regionToCell_H
|
||||
|
||||
#include "topoSetCellSource.H"
|
||||
#include "boolList.H"
|
||||
@ -119,8 +120,11 @@ class regionToCell
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name of cellSet to keep to
|
||||
const word setName_;
|
||||
//- Name of cellSet or cellZone to keep to
|
||||
word setName_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
bool isZone_;
|
||||
|
||||
//- Coordinate(s) that is inside connected region
|
||||
const pointField insidePoints_;
|
||||
|
@ -50,7 +50,7 @@ Usage
|
||||
source zoneToCell;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
zones
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -123,7 +123,7 @@ void Foam::setToCellZone::applyToSet
|
||||
{
|
||||
if (!zoneSet.found(celli))
|
||||
{
|
||||
newAddressing.append(celli);
|
||||
newAddressing.push_back(celli);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,11 +144,11 @@ void Foam::setToCellZone::applyToSet
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||
|
||||
forAll(zoneSet.addressing(), i)
|
||||
for (const label celli : zoneSet.addressing())
|
||||
{
|
||||
if (!loadedSet.found(zoneSet.addressing()[i]))
|
||||
if (!loadedSet.found(celli))
|
||||
{
|
||||
newAddressing.append(zoneSet.addressing()[i]);
|
||||
newAddressing.push_back(celli);
|
||||
}
|
||||
}
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
|
@ -50,7 +50,7 @@ Usage
|
||||
source boxToFace;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
boxes
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,23 +68,14 @@ Foam::cellToFace::cellActionNames_
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::cellToFace::combine
|
||||
template<class Selector>
|
||||
void Foam::cellToFace::combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
const Selector& cellLabels
|
||||
) const
|
||||
{
|
||||
// Load the set
|
||||
if (!exists(mesh_.time().path()/topoSet::localPath(mesh_, setName)))
|
||||
{
|
||||
SeriousError<< "Cannot load set "
|
||||
<< setName << endl;
|
||||
}
|
||||
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
const labelHashSet& cellLabels = loadedSet;
|
||||
|
||||
if (option_ == ALL)
|
||||
{
|
||||
// Add all faces from cell
|
||||
@ -212,6 +203,36 @@ void Foam::cellToFace::combine
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellToFace::combine
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
) const
|
||||
{
|
||||
if (isZone_)
|
||||
{
|
||||
const labelList& cellLabels = mesh_.cellZones()[setName];
|
||||
|
||||
combineImpl(set, add, cellLabels);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the set
|
||||
if (!exists(mesh_.time().path()/topoSet::localPath(mesh_, setName)))
|
||||
{
|
||||
SeriousError<< "Cannot load set "
|
||||
<< setName << endl;
|
||||
}
|
||||
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
const labelHashSet& cellLabels = loadedSet;
|
||||
|
||||
combineImpl(set, add, cellLabels);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellToFace::cellToFace
|
||||
@ -222,7 +243,8 @@ Foam::cellToFace::cellToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
names_(one{}, setName),
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
@ -235,15 +257,9 @@ Foam::cellToFace::cellToFace
|
||||
:
|
||||
topoSetFaceSource(mesh, dict),
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_)),
|
||||
option_(cellActionNames_.get("option", dict))
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::cellToFace::cellToFace
|
||||
@ -253,7 +269,8 @@ Foam::cellToFace::cellToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
names_(one{}, word(checkIs(is))),
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false),
|
||||
option_(cellActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -270,7 +287,8 @@ void Foam::cellToFace::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces according to cell sets: "
|
||||
Info<< " Adding faces according to cell "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
@ -283,7 +301,8 @@ void Foam::cellToFace::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces according to cell sets: "
|
||||
Info<< " Removing faces according to cell "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,7 +51,7 @@ Usage
|
||||
option <option>;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -62,7 +62,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <cellSetName>;
|
||||
zones
|
||||
(
|
||||
<cellZoneName0>
|
||||
<cellZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <cellSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <cellZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -90,16 +101,16 @@ Usage
|
||||
outside | Faces with only one neighbour in the cellSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Reqd | Deflt
|
||||
sets | Names of input cellSets | wordList | choice | -
|
||||
zones | Names of input cellZones | wordList | cond'l | -
|
||||
set | Name of input cellSet | word | choice | -
|
||||
zone | Name of input cellZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
- The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
- The \c outside option applies to the cellSets individually.
|
||||
|
||||
See also
|
||||
@ -149,9 +160,12 @@ private:
|
||||
|
||||
static const Enum<cellAction> cellActionNames_;
|
||||
|
||||
//- Names of cellSets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
//- Selection type
|
||||
cellAction option_;
|
||||
|
||||
@ -159,6 +173,15 @@ private:
|
||||
// Private Member Functions
|
||||
|
||||
//- Depending on face to cell option add to or delete from cellSet.
|
||||
template<class Selector>
|
||||
void combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const Selector& cellLabels
|
||||
) const;
|
||||
|
||||
//- Depending on face to cell option add to or delete from set.
|
||||
void combine(topoSet& set, const bool add, const word& setName) const;
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -60,7 +60,8 @@ Foam::faceToFace::faceToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
names_(one{}, setName)
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -71,15 +72,9 @@ Foam::faceToFace::faceToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh, dict),
|
||||
names_()
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_))
|
||||
{}
|
||||
|
||||
|
||||
Foam::faceToFace::faceToFace
|
||||
@ -89,7 +84,8 @@ Foam::faceToFace::faceToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
names_(one{}, word(checkIs(is)))
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -105,30 +101,46 @@ void Foam::faceToFace::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all elements of face sets: "
|
||||
Info<< " Adding all elements of face "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
if (isZone_)
|
||||
{
|
||||
set.addSet(mesh_.faceZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
|
||||
set.addSet(loadedSet);
|
||||
set.addSet(loadedSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all elements of face sets: "
|
||||
Info<< " Removing all elements of face "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
if (isZone_)
|
||||
{
|
||||
set.subtractSet(mesh_.faceZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
|
||||
set.subtractSet(loadedSet);
|
||||
set.subtractSet(loadedSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,7 +50,7 @@ Usage
|
||||
source faceToFace;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -61,7 +61,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
zones
|
||||
(
|
||||
<faceZoneName0>
|
||||
<faceZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <faceSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <faceZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -81,11 +92,13 @@ Usage
|
||||
subtract | Remove selected faces from this faceSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input faceSets | wordList | cond'l | -
|
||||
zones | Names of input faceZones | wordList | cond'l | -
|
||||
set | Name of input faceSet | word | cond'l | -
|
||||
zone | Name of input faceZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
@ -101,8 +114,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceToFace_H
|
||||
#define faceToFace_H
|
||||
#ifndef Foam_faceToFace_H
|
||||
#define Foam_faceToFace_H
|
||||
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
@ -124,9 +137,12 @@ class faceToFace
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Names of faceSets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1149,7 +1149,7 @@ void Foam::holeToFace::applyToSet
|
||||
for (const word& setName : blockedFaceNames_)
|
||||
{
|
||||
const faceSet loadedSet(mesh_, setName);
|
||||
isBlockedFace.set(loadedSet.toc());
|
||||
isBlockedFace.setMany(loadedSet.begin(), loadedSet.end());
|
||||
}
|
||||
|
||||
// Optional initial blocked cells
|
||||
@ -1159,7 +1159,7 @@ void Foam::holeToFace::applyToSet
|
||||
for (const word& setName : blockedCellNames_)
|
||||
{
|
||||
const cellSet loadedSet(mesh_, setName);
|
||||
isCandidateCell.set(loadedSet.toc());
|
||||
isCandidateCell.setMany(loadedSet.begin(), loadedSet.end());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -49,7 +49,7 @@ Usage
|
||||
source patchToFace;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
patches
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -82,18 +82,14 @@ Foam::pointToFace::pointActionNames_
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::pointToFace::combine
|
||||
template<class Selector>
|
||||
void Foam::pointToFace::combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
const Selector& pointLabels
|
||||
) const
|
||||
{
|
||||
// Load the set
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
|
||||
const labelHashSet& pointLabels = loadedSet;
|
||||
|
||||
if (option_ == ANY)
|
||||
{
|
||||
// Add faces with any point in loadedSet
|
||||
@ -160,6 +156,31 @@ void Foam::pointToFace::combine
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointToFace::combine
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
) const
|
||||
{
|
||||
if (isZone_)
|
||||
{
|
||||
const labelList& pointLabels = mesh_.pointZones()[setName];
|
||||
|
||||
combineImpl(set, add, pointLabels);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the set
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
|
||||
const labelHashSet& pointLabels = loadedSet;
|
||||
|
||||
combineImpl(set, add, pointLabels);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointToFace::pointToFace
|
||||
@ -170,7 +191,8 @@ Foam::pointToFace::pointToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
names_(one{}, setName),
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
@ -183,15 +205,9 @@ Foam::pointToFace::pointToFace
|
||||
:
|
||||
topoSetFaceSource(mesh, dict),
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_)),
|
||||
option_(pointActionNames_.get("option", dict))
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::pointToFace::pointToFace
|
||||
@ -201,7 +217,8 @@ Foam::pointToFace::pointToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
names_(one{}, word(checkIs(is))),
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false),
|
||||
option_(pointActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -218,7 +235,8 @@ void Foam::pointToFace::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces according to point sets: "
|
||||
Info<< " Adding faces according to point "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
@ -231,7 +249,8 @@ void Foam::pointToFace::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces according to point sets: "
|
||||
Info<< " Removing faces according to point "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,7 @@ Usage
|
||||
option <option>;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -63,7 +63,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <pointSetName>;
|
||||
zones
|
||||
(
|
||||
<pointZoneName0>
|
||||
<pointZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <pointSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <pointZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -91,17 +102,15 @@ Usage
|
||||
all | All points in the pointSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input pointSets | wordList | cond'l | -
|
||||
zones | Names of input pointZones | wordList | cond'l | -
|
||||
set | Name of input pointSet | word | cond'l | -
|
||||
zone | Name of input pointZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
- Foam::topoSetFaceSource
|
||||
@ -111,8 +120,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointToFace_H
|
||||
#define pointToFace_H
|
||||
#ifndef Foam_pointToFace_H
|
||||
#define Foam_pointToFace_H
|
||||
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "Enum.H"
|
||||
@ -149,15 +158,27 @@ private:
|
||||
|
||||
static const Enum<pointAction> pointActionNames_;
|
||||
|
||||
//- Names of sets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
//- Option
|
||||
pointAction option_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Depending on option add to or delete from set.
|
||||
template<class Selector>
|
||||
void combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const Selector& pointLabels
|
||||
) const;
|
||||
|
||||
//- Depending on face to cell option add to or delete from faceSet.
|
||||
void combine(topoSet& set, const bool add, const word& setName) const;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -136,7 +136,12 @@ void Foam::regionToFace::markZone
|
||||
}
|
||||
|
||||
|
||||
void Foam::regionToFace::combine(topoSet& set, const bool add) const
|
||||
void Foam::regionToFace::combine
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const labelUList& ids
|
||||
) const
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
@ -144,11 +149,9 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const
|
||||
<< " to delimit search region." << endl;
|
||||
}
|
||||
|
||||
faceSet subSet(mesh_, setName_);
|
||||
|
||||
indirectPrimitivePatch patch
|
||||
(
|
||||
IndirectList<face>(mesh_.faces(), subSet.toc()),
|
||||
IndirectList<face>(mesh_.faces(), ids),
|
||||
mesh_.points()
|
||||
);
|
||||
|
||||
@ -158,7 +161,7 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const
|
||||
Tuple2<scalar, label>
|
||||
(
|
||||
sqr(GREAT),
|
||||
Pstream::myProcNo()
|
||||
UPstream::myProcNo()
|
||||
)
|
||||
);
|
||||
|
||||
@ -217,6 +220,7 @@ Foam::regionToFace::regionToFace
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(setName),
|
||||
isZone_(false),
|
||||
nearPoint_(nearPoint)
|
||||
{}
|
||||
|
||||
@ -228,9 +232,20 @@ Foam::regionToFace::regionToFace
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh, dict),
|
||||
setName_(dict.get<word>("set")),
|
||||
setName_(),
|
||||
isZone_(false),
|
||||
nearPoint_(dict.get<point>("nearPoint"))
|
||||
{}
|
||||
{
|
||||
if (dict.readIfPresent("set", setName_))
|
||||
{
|
||||
isZone_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.readEntry("zone", setName_);
|
||||
isZone_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::regionToFace::regionToFace
|
||||
@ -241,6 +256,7 @@ Foam::regionToFace::regionToFace
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
isZone_(false),
|
||||
nearPoint_(checkIs(is))
|
||||
{}
|
||||
|
||||
@ -257,23 +273,41 @@ void Foam::regionToFace::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces of connected region of set "
|
||||
Info<< " Adding all faces of connected region of "
|
||||
<< (isZone_ ? "zone " : "set ")
|
||||
<< setName_ << " starting from point " << nearPoint_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
if (isZone_)
|
||||
{
|
||||
combine(set, true, mesh_.faceZones()[setName_].addressing());
|
||||
}
|
||||
else
|
||||
{
|
||||
faceSet subSet(mesh_, setName_);
|
||||
combine(set, true, subSet.sortedToc());
|
||||
}
|
||||
}
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all cells of connected region of set "
|
||||
Info<< " Removing all cells of connected region of "
|
||||
<< (isZone_ ? "zone " : "set ")
|
||||
<< setName_ << " starting from point " << nearPoint_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
if (isZone_)
|
||||
{
|
||||
combine(set, false, mesh_.faceZones()[setName_].addressing());
|
||||
}
|
||||
else
|
||||
{
|
||||
faceSet subSet(mesh_, setName_);
|
||||
combine(set, false, subSet.sortedToc());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,11 +105,14 @@ class regionToFace
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name of set to use
|
||||
//- Name of set or zone to use
|
||||
word setName_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
bool isZone_;
|
||||
|
||||
//- Coordinate that is nearest/on connected region
|
||||
point nearPoint_;
|
||||
const point nearPoint_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -124,7 +127,12 @@ class regionToFace
|
||||
labelList& faceZone
|
||||
) const;
|
||||
|
||||
void combine(topoSet& set, const bool add) const;
|
||||
void combine
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const labelUList& ids
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
@ -50,7 +50,7 @@ Usage
|
||||
source zoneToFace;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
zones
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,7 +58,7 @@ Foam::topoSetSource::addToUsageTable Foam::cellToFaceZone::usage_
|
||||
|
||||
void Foam::cellToFaceZone::selectFaces
|
||||
(
|
||||
const cellSet& cSet,
|
||||
const bitSet& whichCells,
|
||||
bitSet& selectedFace,
|
||||
bitSet& doFlip
|
||||
) const
|
||||
@ -81,8 +81,8 @@ void Foam::cellToFaceZone::selectFaces
|
||||
// Check all internal faces
|
||||
for (label facei = 0; facei < nInt; ++facei)
|
||||
{
|
||||
const bool ownFound = cSet.found(own[facei]);
|
||||
const bool neiFound = cSet.found(nei[facei]);
|
||||
const bool ownFound = whichCells.test(own[facei]);
|
||||
const bool neiFound = whichCells.test(nei[facei]);
|
||||
|
||||
if (ownFound && !neiFound)
|
||||
{
|
||||
@ -106,7 +106,7 @@ void Foam::cellToFaceZone::selectFaces
|
||||
label facei = pp.start();
|
||||
forAll(pp, i)
|
||||
{
|
||||
neiInSet[facei-nInt] = cSet.found(own[facei]);
|
||||
neiInSet[facei-nInt] = whichCells.test(own[facei]);
|
||||
++facei;
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ void Foam::cellToFaceZone::selectFaces
|
||||
label facei = pp.start();
|
||||
forAll(pp, i)
|
||||
{
|
||||
const bool ownFound = cSet.found(own[facei]);
|
||||
const bool ownFound = whichCells.test(own[facei]);
|
||||
const bool neiFound = neiInSet[facei-nInt];
|
||||
|
||||
if (ownFound && !neiFound)
|
||||
@ -149,7 +149,8 @@ Foam::cellToFaceZone::cellToFaceZone
|
||||
)
|
||||
:
|
||||
topoSetFaceZoneSource(mesh),
|
||||
names_(one{}, setName),
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false),
|
||||
flip_(flip)
|
||||
{}
|
||||
|
||||
@ -162,15 +163,9 @@ Foam::cellToFaceZone::cellToFaceZone
|
||||
:
|
||||
topoSetFaceZoneSource(mesh, dict),
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_)),
|
||||
flip_(dict.getOrDefault("flip", false))
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::cellToFaceZone::cellToFaceZone
|
||||
@ -180,7 +175,8 @@ Foam::cellToFaceZone::cellToFaceZone
|
||||
)
|
||||
:
|
||||
topoSetFaceZoneSource(mesh),
|
||||
names_(one{}, word(checkIs(is))),
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false),
|
||||
flip_(false)
|
||||
{}
|
||||
|
||||
@ -207,7 +203,8 @@ void Foam::cellToFaceZone::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces on outside of cell sets: "
|
||||
Info<< " Adding all faces on outside of cell "
|
||||
<< (isZone_ ? "zones:" : "sets: ")
|
||||
<< flatOutput(names_) << "; orientation pointing ";
|
||||
|
||||
if (flip_)
|
||||
@ -222,12 +219,23 @@ void Foam::cellToFaceZone::applyToSet
|
||||
|
||||
bitSet selectedFace(mesh_.nFaces());
|
||||
bitSet doFlip(mesh_.nFaces());
|
||||
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
// Load the sets
|
||||
cellSet cSet(mesh_, setName);
|
||||
bitSet whichCells(mesh_.nCells());
|
||||
if (isZone_)
|
||||
{
|
||||
whichCells.set(mesh_.cellZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the sets
|
||||
const cellSet loadedSet(mesh_, setName);
|
||||
whichCells.setMany(loadedSet.begin(), loadedSet.end());
|
||||
}
|
||||
|
||||
// Select outside faces
|
||||
selectFaces(cSet, selectedFace, doFlip);
|
||||
selectFaces(whichCells, selectedFace, doFlip);
|
||||
}
|
||||
|
||||
// Start off from copy
|
||||
@ -251,7 +259,8 @@ void Foam::cellToFaceZone::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces on outside of cell sets: "
|
||||
Info<< " Removing all faces on outside of cell "
|
||||
<< (isZone_ ? "zones:" : "sets: ")
|
||||
<< flatOutput(names_) << " ..." << endl;
|
||||
}
|
||||
|
||||
@ -259,10 +268,19 @@ void Foam::cellToFaceZone::applyToSet
|
||||
bitSet doFlip(mesh_.nFaces());
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
// Load the sets
|
||||
cellSet cSet(mesh_, setName);
|
||||
bitSet whichCells(mesh_.nCells());
|
||||
if (isZone_)
|
||||
{
|
||||
whichCells.set(mesh_.cellZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the sets
|
||||
const cellSet loadedSet(mesh_, setName);
|
||||
whichCells.setMany(loadedSet.begin(), loadedSet.end());
|
||||
}
|
||||
// Select outside faces
|
||||
selectFaces(cSet, selectedFace, doFlip);
|
||||
selectFaces(whichCells, selectedFace, doFlip);
|
||||
}
|
||||
|
||||
// Start off empty
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,7 @@ Usage
|
||||
action <action>;
|
||||
source cellToFaceZone;
|
||||
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -63,7 +63,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <word>;
|
||||
zones
|
||||
(
|
||||
<cellZoneName0>
|
||||
<cellZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <cellSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <cellZoneName>;
|
||||
|
||||
// Optional entries
|
||||
flip <bool>;
|
||||
@ -89,6 +100,15 @@ Usage
|
||||
subtract | Remove selected faces of a faceZoneSet from this faceZone
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Reqd | Deflt
|
||||
sets | Names of input cellSets | wordList | choice | -
|
||||
zones | Names of input cellZones | wordList | cond'l | -
|
||||
set | Name of input cellSet | word | choice | -
|
||||
zone | Name of input cellZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Notes
|
||||
- \c flip=true sets the orientation of faces
|
||||
pointing into the \c cellSet, and vice versa.
|
||||
@ -124,9 +144,12 @@ class cellToFaceZone
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Names of cellSets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
//- Whether cellSet is slave cells or master cells
|
||||
const bool flip_;
|
||||
|
||||
@ -136,7 +159,7 @@ class cellToFaceZone
|
||||
//- Select outside faces of cellSet
|
||||
void selectFaces
|
||||
(
|
||||
const cellSet& cSet,
|
||||
const bitSet& cSet,
|
||||
bitSet& selectedFace,
|
||||
bitSet& doFlip
|
||||
) const;
|
||||
|
@ -50,7 +50,7 @@ Usage
|
||||
source boxToPoint;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
boxes
|
||||
|
@ -62,17 +62,14 @@ Foam::cellToPoint::cellActionNames_
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::cellToPoint::combine
|
||||
template<class Selector>
|
||||
void Foam::cellToPoint::combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
const Selector& cellLabels
|
||||
) const
|
||||
{
|
||||
// Load the set
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
const labelHashSet& cellLabels = loadedSet;
|
||||
|
||||
// Add all point from cells in loadedSet
|
||||
for (const label celli : cellLabels)
|
||||
{
|
||||
@ -88,6 +85,31 @@ void Foam::cellToPoint::combine
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellToPoint::combine
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const word& setName
|
||||
) const
|
||||
{
|
||||
if (isZone_)
|
||||
{
|
||||
const labelList& cellLabels = mesh_.cellZones()[setName];
|
||||
|
||||
combineImpl(set, add, cellLabels);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the set
|
||||
cellSet loadedSet(mesh_, setName);
|
||||
|
||||
const labelHashSet& cellLabels = loadedSet;
|
||||
|
||||
combineImpl(set, add, cellLabels);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellToPoint::cellToPoint
|
||||
@ -98,7 +120,8 @@ Foam::cellToPoint::cellToPoint
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
names_(one{}, setName),
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
@ -111,15 +134,9 @@ Foam::cellToPoint::cellToPoint
|
||||
:
|
||||
topoSetPointSource(mesh, dict),
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_)),
|
||||
option_(cellActionNames_.get("option", dict))
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::cellToPoint::cellToPoint
|
||||
@ -129,7 +146,8 @@ Foam::cellToPoint::cellToPoint
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
names_(one{}, word(checkIs(is))),
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false),
|
||||
option_(cellActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -146,7 +164,8 @@ void Foam::cellToPoint::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding points in cell sets: "
|
||||
Info<< " Adding points in cell "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
@ -159,7 +178,8 @@ void Foam::cellToPoint::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing points in cell sets: "
|
||||
Info<< " Removing points in cell "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020,2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,7 +51,7 @@ Usage
|
||||
option <option>;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -62,7 +62,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <pointSetName>;
|
||||
zones
|
||||
(
|
||||
<pointZoneName0>
|
||||
<pointZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <pointSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <pointZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -88,17 +99,15 @@ Usage
|
||||
all | Select all points of cells in the cellSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input cellSets | wordList | cond'l | -
|
||||
set | Name of input cellSet | word | cond'l | -
|
||||
Entry | Description | Type | Reqd | Deflt
|
||||
sets | Names of input cellSets | wordList | choice | -
|
||||
zones | Names of input cellZones | wordList | cond'l | -
|
||||
set | Name of input cellSet | word | choice | -
|
||||
zone | Name of input cellZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
- Foam::topoSetPointSource
|
||||
@ -145,15 +154,27 @@ private:
|
||||
|
||||
static const Enum<cellAction> cellActionNames_;
|
||||
|
||||
//- Names of sets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
//- Option
|
||||
cellAction option_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Depending on cell to point option add to or delete from pointSet.
|
||||
template<class Selector>
|
||||
void combineImpl
|
||||
(
|
||||
topoSet& set,
|
||||
const bool add,
|
||||
const Selector& cellLabels
|
||||
) const;
|
||||
|
||||
void combine(topoSet& set, const bool add, const word& setName) const;
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,16 +68,31 @@ void Foam::faceToPoint::combine
|
||||
const word& setName
|
||||
) const
|
||||
{
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
const labelHashSet& faceLabels = loadedSet;
|
||||
|
||||
// Add all points from faces in loadedSet
|
||||
for (const label facei : faceLabels)
|
||||
if (isZone_)
|
||||
{
|
||||
const face& f = mesh_.faces()[facei];
|
||||
const auto& faceLabels = mesh_.faceZones()[setName].addressing();
|
||||
|
||||
addOrDelete(set, f, add);
|
||||
// Add all points from faces in loadedSet
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
const face& f = mesh_.faces()[facei];
|
||||
|
||||
addOrDelete(set, f, add);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName);
|
||||
const labelHashSet& faceLabels = loadedSet;
|
||||
|
||||
// Add all points from faces in loadedSet
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
const face& f = mesh_.faces()[facei];
|
||||
|
||||
addOrDelete(set, f, add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +107,8 @@ Foam::faceToPoint::faceToPoint
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
names_(one{}, setName),
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
@ -105,15 +121,9 @@ Foam::faceToPoint::faceToPoint
|
||||
:
|
||||
topoSetPointSource(mesh, dict),
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_)),
|
||||
option_(faceActionNames_.get("option", dict))
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::faceToPoint::faceToPoint
|
||||
@ -123,7 +133,8 @@ Foam::faceToPoint::faceToPoint
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
names_(one{}, word(checkIs(is))),
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false),
|
||||
option_(faceActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -140,7 +151,8 @@ void Foam::faceToPoint::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding points from face in face sets: "
|
||||
Info<< " Adding face points in face "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
@ -153,7 +165,8 @@ void Foam::faceToPoint::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing points from face in face sets: "
|
||||
Info<< " Removing face points in face "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,7 @@ Usage
|
||||
option <option>;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -89,17 +89,15 @@ Usage
|
||||
all | Select all points of faces in the faceSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input faceSets | wordList | cond'l | -
|
||||
zones | Names of input faceZones | wordList | cond'l | -
|
||||
set | Name of input faceSet | word | cond'l | -
|
||||
zone | Name of input faceZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
- Foam::topoSetPointSource
|
||||
@ -146,9 +144,12 @@ private:
|
||||
|
||||
static const Enum<faceAction> faceActionNames_;
|
||||
|
||||
//- Names of sets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
//- Option
|
||||
faceAction option_;
|
||||
|
||||
|
@ -60,7 +60,8 @@ Foam::pointToPoint::pointToPoint
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
names_(one{}, setName)
|
||||
names_(Foam::one{}, setName),
|
||||
isZone_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -71,15 +72,9 @@ Foam::pointToPoint::pointToPoint
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh, dict),
|
||||
names_()
|
||||
{
|
||||
// Look for 'sets' or 'set'
|
||||
if (!dict.readIfPresent("sets", names_))
|
||||
{
|
||||
names_.resize(1);
|
||||
dict.readEntry("set", names_.front());
|
||||
}
|
||||
}
|
||||
names_(),
|
||||
isZone_(topoSetSource::readNames(dict, names_))
|
||||
{}
|
||||
|
||||
|
||||
Foam::pointToPoint::pointToPoint
|
||||
@ -89,7 +84,8 @@ Foam::pointToPoint::pointToPoint
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
names_(one{}, word(checkIs(is)))
|
||||
names_(Foam::one{}, word(checkIs(is))),
|
||||
isZone_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -105,30 +101,46 @@ void Foam::pointToPoint::applyToSet
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all elements of point sets: "
|
||||
Info<< " Adding all elements of point "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
if (isZone_)
|
||||
{
|
||||
set.addSet(mesh_.pointZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
|
||||
set.addSet(loadedSet);
|
||||
set.addSet(loadedSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all elements of point sets: "
|
||||
Info<< " Removing all elements of point "
|
||||
<< (isZone_ ? "zones: " : "sets: ")
|
||||
<< flatOutput(names_) << nl;
|
||||
}
|
||||
|
||||
for (const word& setName : names_)
|
||||
{
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
if (isZone_)
|
||||
{
|
||||
set.subtractSet(mesh_.pointZones()[setName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
pointSet loadedSet(mesh_, setName);
|
||||
|
||||
set.subtractSet(loadedSet);
|
||||
set.subtractSet(loadedSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020,2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,7 +50,7 @@ Usage
|
||||
source pointToPoint;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
sets
|
||||
@ -61,7 +61,18 @@ Usage
|
||||
);
|
||||
|
||||
// Option-2
|
||||
set <pointSetName>;
|
||||
zones
|
||||
(
|
||||
<pointZoneName0>
|
||||
<pointZoneName1>
|
||||
...
|
||||
);
|
||||
|
||||
// Option-3
|
||||
set <pointSetName>;
|
||||
|
||||
// Option-4
|
||||
zone <pointZoneName>;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -81,17 +92,15 @@ Usage
|
||||
subtract | Remove selected points from this pointSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
Options for the conditional mandatory entries (in order of precedence):
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input pointSets | wordList | cond'l | -
|
||||
zones | Names of input pointZones | wordList | cond'l | -
|
||||
set | Name of input pointSet | word | cond'l | -
|
||||
zone | Name of input pointZone | word | cond'l | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
- Foam::topoSetPointSource
|
||||
@ -124,9 +133,12 @@ class pointToPoint
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Names of sets to use
|
||||
//- Names of sets or zones to use
|
||||
wordList names_;
|
||||
|
||||
//- Is name a set or a zone
|
||||
const bool isZone_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -50,7 +50,7 @@ Usage
|
||||
source zoneToPoint;
|
||||
|
||||
// Conditional mandatory entries
|
||||
// Select either of the below
|
||||
// Select one of the below
|
||||
|
||||
// Option-1
|
||||
zones
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -124,7 +124,7 @@ void Foam::setToPointZone::applyToSet
|
||||
{
|
||||
if (!zoneSet.found(pointi))
|
||||
{
|
||||
newAddressing.append(pointi);
|
||||
newAddressing.push_back(pointi);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,11 +145,11 @@ void Foam::setToPointZone::applyToSet
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||
|
||||
forAll(zoneSet.addressing(), i)
|
||||
for (const label pointi : zoneSet.addressing())
|
||||
{
|
||||
if (!loadedSet.found(zoneSet.addressing()[i]))
|
||||
if (!loadedSet.found(pointi))
|
||||
{
|
||||
newAddressing.append(zoneSet.addressing()[i]);
|
||||
newAddressing.push_back(pointi);
|
||||
}
|
||||
}
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
|
@ -304,4 +304,52 @@ Foam::tmp<Foam::pointField> Foam::topoSetSource::transform
|
||||
}
|
||||
|
||||
|
||||
bool Foam::topoSetSource::readNames
|
||||
(
|
||||
const dictionary& dict,
|
||||
wordList& names
|
||||
)
|
||||
{
|
||||
bool isZone = false;
|
||||
|
||||
// priority
|
||||
// 1. 'sets'
|
||||
// 2. 'zones'
|
||||
// 3. 'set'
|
||||
// 4. 'zone'
|
||||
|
||||
if (dict.readIfPresent("sets", names, keyType::LITERAL))
|
||||
{
|
||||
// -> isZone = false;
|
||||
}
|
||||
else if (dict.readIfPresent("zones", names, keyType::LITERAL))
|
||||
{
|
||||
isZone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure error messsages make sense if nothing was provided
|
||||
names.resize(1);
|
||||
|
||||
if (dict.readIfPresent("zone", names.front(), keyType::LITERAL))
|
||||
{
|
||||
// Had 'zone', so 'set' is optional...
|
||||
isZone = true;
|
||||
if (dict.readIfPresent("set", names.front(), keyType::LITERAL))
|
||||
{
|
||||
isZone = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No 'zone', so 'set' is mandatory...
|
||||
dict.readEntry("set", names.front(), keyType::LITERAL);
|
||||
// -> isZone = false;
|
||||
}
|
||||
}
|
||||
|
||||
return isZone;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -405,6 +405,11 @@ public:
|
||||
{
|
||||
return actionNames[actionName];
|
||||
}
|
||||
|
||||
//- Helper: extract wordList of patches/zones from dictionary. Returns
|
||||
// true if zone(s). Order of parsing is
|
||||
// sets, zones, set, zone
|
||||
static bool readNames(const dictionary& dict, wordList& names);
|
||||
};
|
||||
|
||||
|
||||
|
@ -171,6 +171,23 @@ void Foam::cellZoneSet::subset(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellZoneSet::subset(const labelUList& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
|
||||
for (const label celli : set)
|
||||
{
|
||||
if (found(celli))
|
||||
{
|
||||
newAddressing.append(celli);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellZoneSet::addSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
@ -190,6 +207,23 @@ void Foam::cellZoneSet::addSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellZoneSet::addSet(const labelUList& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
|
||||
for (const label celli : set)
|
||||
{
|
||||
if (!found(celli))
|
||||
{
|
||||
newAddressing.append(celli);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellZoneSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
@ -210,6 +244,26 @@ void Foam::cellZoneSet::subtractSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellZoneSet::sync(const polyMesh& mesh)
|
||||
{
|
||||
cellSet::sync(mesh);
|
||||
|
@ -128,6 +128,17 @@ public:
|
||||
//- Subtract elements present in 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
|
||||
virtual void sync(const polyMesh& mesh);
|
||||
|
||||
|
@ -171,7 +171,12 @@ void Foam::faceZoneSet::invert(const label maxLen)
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::subset(const topoSet& set)
|
||||
void Foam::faceZoneSet::subset
|
||||
(
|
||||
const word& setName,
|
||||
const labelUList& setAddressing,
|
||||
const UList<bool>& setFlipMap
|
||||
)
|
||||
{
|
||||
label nConflict = 0;
|
||||
|
||||
@ -180,11 +185,9 @@ void Foam::faceZoneSet::subset(const topoSet& set)
|
||||
|
||||
Map<label> faceToIndex(invertToMap(addressing_));
|
||||
|
||||
const faceZoneSet& zoneSet = refCast<const faceZoneSet>(set);
|
||||
|
||||
forAll(zoneSet.addressing(), i)
|
||||
forAll(setAddressing, i)
|
||||
{
|
||||
const label facei = zoneSet.addressing()[i];
|
||||
const label facei = setAddressing[i];
|
||||
|
||||
const auto iter = faceToIndex.cfind(facei);
|
||||
|
||||
@ -192,7 +195,7 @@ void Foam::faceZoneSet::subset(const topoSet& set)
|
||||
{
|
||||
const label index = iter.val();
|
||||
|
||||
if (zoneSet.flipMap()[i] != flipMap_[index])
|
||||
if (setFlipMap.size() && (setFlipMap[i] != flipMap_[index]))
|
||||
{
|
||||
++nConflict;
|
||||
}
|
||||
@ -205,8 +208,70 @@ void Foam::faceZoneSet::subset(const topoSet& set)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "subset : there are " << nConflict
|
||||
<< " faces with different orientation in faceZoneSets "
|
||||
<< name() << " and " << setName << endl;
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
flipMap_.transfer(newFlipMap);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::subset(const topoSet& set)
|
||||
{
|
||||
const faceZoneSet& zoneSet = refCast<const faceZoneSet>(set);
|
||||
subset(zoneSet.name(), zoneSet.addressing(), zoneSet.flipMap());
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::subset(const labelUList& set)
|
||||
{
|
||||
subset(word::null, set, boolList::null());
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::addSet
|
||||
(
|
||||
const word& setName,
|
||||
const labelUList& setAddressing,
|
||||
const UList<bool>& setFlipMap
|
||||
)
|
||||
{
|
||||
label nConflict = 0;
|
||||
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
DynamicList<bool> newFlipMap(flipMap_);
|
||||
|
||||
Map<label> faceToIndex(invertToMap(addressing_));
|
||||
|
||||
forAll(setAddressing, i)
|
||||
{
|
||||
const label facei = setAddressing[i];
|
||||
const auto iter = faceToIndex.cfind(facei);
|
||||
|
||||
if (iter.good())
|
||||
{
|
||||
const label index = iter.val();
|
||||
|
||||
if (setFlipMap.size() && (setFlipMap[i] != flipMap_[index]))
|
||||
{
|
||||
++nConflict;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newAddressing.append(facei);
|
||||
newFlipMap.append(setFlipMap.size() ? setFlipMap[i] : false);
|
||||
}
|
||||
}
|
||||
|
||||
if (nConflict > 0)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "addSet : there are " << nConflict
|
||||
<< " faces with different orientation in faceZonesSets "
|
||||
<< name() << " and " << set.name() << endl;
|
||||
<< name() << " and " << setName << endl;
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
@ -217,60 +282,30 @@ void Foam::faceZoneSet::subset(const topoSet& set)
|
||||
|
||||
void Foam::faceZoneSet::addSet(const topoSet& set)
|
||||
{
|
||||
label nConflict = 0;
|
||||
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
DynamicList<bool> newFlipMap(flipMap_);
|
||||
|
||||
Map<label> faceToIndex(invertToMap(addressing_));
|
||||
|
||||
const faceZoneSet& zoneSet = refCast<const faceZoneSet>(set);
|
||||
|
||||
forAll(zoneSet.addressing(), i)
|
||||
{
|
||||
const label facei = zoneSet.addressing()[i];
|
||||
const auto iter = faceToIndex.cfind(facei);
|
||||
|
||||
if (iter.good())
|
||||
{
|
||||
const label index = iter.val();
|
||||
|
||||
if (zoneSet.flipMap()[i] != flipMap_[index])
|
||||
{
|
||||
++nConflict;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newAddressing.append(facei);
|
||||
newFlipMap.append(zoneSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (nConflict > 0)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "addSet : there are " << nConflict
|
||||
<< " faces with different orientation in faceZonesSets "
|
||||
<< name() << " and " << set.name() << endl;
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
flipMap_.transfer(newFlipMap);
|
||||
updateSet();
|
||||
addSet(zoneSet.name(), zoneSet.addressing(), zoneSet.flipMap());
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
||||
void Foam::faceZoneSet::addSet(const labelUList& set)
|
||||
{
|
||||
addSet(word::null, set, boolList::null());
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::subtractSet
|
||||
(
|
||||
const word& setName,
|
||||
const labelUList& setAddressing,
|
||||
const UList<bool>& setFlipMap
|
||||
)
|
||||
{
|
||||
label nConflict = 0;
|
||||
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
DynamicList<bool> newFlipMap(flipMap_.size());
|
||||
|
||||
const faceZoneSet& zoneSet = refCast<const faceZoneSet>(set);
|
||||
|
||||
Map<label> faceToIndex(invertToMap(zoneSet.addressing()));
|
||||
Map<label> faceToIndex(invertToMap(setAddressing));
|
||||
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
@ -282,7 +317,7 @@ void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
const label index = iter.val();
|
||||
|
||||
if (zoneSet.flipMap()[index] != flipMap_[i])
|
||||
if (setFlipMap.size() && (setFlipMap[index] != flipMap_[i]))
|
||||
{
|
||||
++nConflict;
|
||||
}
|
||||
@ -291,7 +326,7 @@ void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
// Not found in zoneSet so add
|
||||
newAddressing.append(facei);
|
||||
newFlipMap.append(zoneSet.flipMap()[i]);
|
||||
newFlipMap.append(setFlipMap.size() ? setFlipMap[i] : false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +335,7 @@ void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
||||
WarningInFunction
|
||||
<< "subtractSet : there are " << nConflict
|
||||
<< " faces with different orientation in faceZonesSets "
|
||||
<< name() << " and " << set.name() << endl;
|
||||
<< name() << " and " << setName << endl;
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
@ -309,6 +344,19 @@ void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
const faceZoneSet& zoneSet = refCast<const faceZoneSet>(set);
|
||||
subtractSet(zoneSet.name(), zoneSet.addressing(), zoneSet.flipMap());
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::subtractSet(const labelUList& set)
|
||||
{
|
||||
subtractSet(word::null, set, boolList::null());
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZoneSet::sync(const polyMesh& mesh)
|
||||
{
|
||||
// This routine serves two purposes
|
||||
|
@ -62,6 +62,30 @@ class faceZoneSet
|
||||
boolList flipMap_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void subset
|
||||
(
|
||||
const word& setName,
|
||||
const labelUList& setAddressing,
|
||||
const UList<bool>& setFlipMap
|
||||
);
|
||||
|
||||
void addSet
|
||||
(
|
||||
const word& setName,
|
||||
const labelUList& setAddressing,
|
||||
const UList<bool>& setFlipMap
|
||||
);
|
||||
|
||||
void subtractSet
|
||||
(
|
||||
const word& setName,
|
||||
const labelUList& setAddressing,
|
||||
const UList<bool>& setFlipMap
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -142,6 +166,18 @@ public:
|
||||
//- Subtract elements present in 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.
|
||||
virtual void sync(const polyMesh& mesh);
|
||||
|
||||
|
@ -171,6 +171,23 @@ void Foam::pointZoneSet::subset(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointZoneSet::subset(const labelUList& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
|
||||
for (const label pointi : set)
|
||||
{
|
||||
if (found(pointi))
|
||||
{
|
||||
newAddressing.append(pointi);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointZoneSet::addSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
@ -190,6 +207,23 @@ void Foam::pointZoneSet::addSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointZoneSet::addSet(const labelUList& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
|
||||
for (const label pointi : set)
|
||||
{
|
||||
if (!found(pointi))
|
||||
{
|
||||
newAddressing.append(pointi);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointZoneSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
@ -210,6 +244,26 @@ void Foam::pointZoneSet::subtractSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void Foam::pointZoneSet::sync(const polyMesh& mesh)
|
||||
{
|
||||
pointSet::sync(mesh);
|
||||
|
@ -129,6 +129,18 @@ public:
|
||||
//- Subtract elements present in 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.
|
||||
virtual void sync(const polyMesh& mesh);
|
||||
|
||||
|
@ -239,6 +239,22 @@ void Foam::topoBitSet::subset(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBitSet::subset(const labelUList& elems)
|
||||
{
|
||||
// Only retain entries found in both sets
|
||||
bitSet newSelected(selected_.size());
|
||||
|
||||
for (const label id : elems)
|
||||
{
|
||||
if (selected_[id])
|
||||
{
|
||||
newSelected.set(id);
|
||||
}
|
||||
}
|
||||
selected_ = newSelected;
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBitSet::addSet(const topoSet& set)
|
||||
{
|
||||
// Add entries to the set
|
||||
@ -256,6 +272,12 @@ void Foam::topoBitSet::addSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBitSet::addSet(const labelUList& elems)
|
||||
{
|
||||
selected_.set(elems);
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBitSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
// Subtract entries from the set
|
||||
@ -273,4 +295,10 @@ void Foam::topoBitSet::subtractSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBitSet::subtractSet(const labelUList& elems)
|
||||
{
|
||||
selected_.unset(elems);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -154,6 +154,17 @@ public:
|
||||
|
||||
//- Subtract elements present in 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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -250,6 +250,25 @@ void Foam::topoBoolSet::subset(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBoolSet::subset(const labelUList& set)
|
||||
{
|
||||
// Only retain entries found in both sets
|
||||
if (set.empty())
|
||||
{
|
||||
selected_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
const boolList oldSelected(selected_);
|
||||
selected_ = false;
|
||||
for (const label id : set)
|
||||
{
|
||||
selected_[id] = oldSelected[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBoolSet::addSet(const topoSet& set)
|
||||
{
|
||||
// Add entries to the set
|
||||
@ -260,6 +279,16 @@ void Foam::topoBoolSet::addSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBoolSet::addSet(const labelUList& set)
|
||||
{
|
||||
// Add entries to the set
|
||||
for (const label id : set)
|
||||
{
|
||||
selected_[id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBoolSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
// Subtract entries from the set
|
||||
@ -270,4 +299,14 @@ void Foam::topoBoolSet::subtractSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoBoolSet::subtractSet(const labelUList& set)
|
||||
{
|
||||
// Subtract entries from the set
|
||||
for (const label id : set)
|
||||
{
|
||||
selected_.unset(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -154,6 +154,17 @@ public:
|
||||
|
||||
//- Subtract elements present in 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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -553,6 +553,26 @@ void Foam::topoSet::subset(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoSet::subset(const labelUList& elems)
|
||||
{
|
||||
// Only retain entries found in both sets
|
||||
auto& currentSet = static_cast<labelHashSet&>(*this);
|
||||
|
||||
DynamicList<label> newElems(elems.size()+currentSet.size());
|
||||
for (const label elem : elems)
|
||||
{
|
||||
if (currentSet.found(elem))
|
||||
{
|
||||
newElems.push_back(elem);
|
||||
}
|
||||
}
|
||||
if (newElems.size() < currentSet.size())
|
||||
{
|
||||
currentSet = newElems;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoSet::addSet(const topoSet& set)
|
||||
{
|
||||
// Add entries to the set
|
||||
@ -560,6 +580,13 @@ void Foam::topoSet::addSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoSet::addSet(const labelUList& elems)
|
||||
{
|
||||
// Add entries to the set
|
||||
static_cast<labelHashSet&>(*this).set(elems);
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoSet::subtractSet(const topoSet& set)
|
||||
{
|
||||
// Subtract entries from the set
|
||||
@ -567,9 +594,10 @@ void Foam::topoSet::subtractSet(const topoSet& set)
|
||||
}
|
||||
|
||||
|
||||
void Foam::topoSet::deleteSet(const topoSet& set)
|
||||
void Foam::topoSet::subtractSet(const labelUList& elems)
|
||||
{
|
||||
this->subtractSet(set);
|
||||
// Subtract entries from the set
|
||||
static_cast<labelHashSet&>(*this).unset(elems);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -331,12 +331,22 @@ public:
|
||||
//- Subset contents. Only elements present in both sets remain.
|
||||
virtual void subset(const topoSet& set);
|
||||
|
||||
//- Add elements present in set.
|
||||
//- Subset contents. Only elements present in both sets remain.
|
||||
virtual void subset(const labelUList& set);
|
||||
|
||||
//- Add elements
|
||||
virtual void addSet(const topoSet& set);
|
||||
|
||||
//- Subtract elements present in set.
|
||||
//- Add elements
|
||||
virtual void addSet(const labelUList& set);
|
||||
|
||||
//- Subtract elements
|
||||
virtual void subtractSet(const topoSet& set);
|
||||
|
||||
//- Subtract elements
|
||||
virtual void subtractSet(const labelUList& set);
|
||||
|
||||
|
||||
//- Sync set across coupled patches.
|
||||
virtual void sync(const polyMesh& mesh);
|
||||
|
||||
@ -392,7 +402,8 @@ public:
|
||||
|
||||
//- Deprecated(2018-10) subtract elements present in set.
|
||||
// \deprecated(2018-10) - use subtractSet instead
|
||||
virtual void deleteSet(const topoSet& set);
|
||||
FOAM_DEPRECATED_FOR(2018-10, "subtractSet()")
|
||||
virtual void deleteSet(const topoSet& set) { this->subtractSet(set); }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user