ENH: distinguish between cell/face/point topoSetSource (#1060)

- add intermediate classes topoSetCellSource, topoSetFaceSource,
  topoSetPointSource and corresponding New() factories
This commit is contained in:
Mark Olesen
2018-10-30 12:01:36 +00:00
parent 9a87a043d6
commit 9b638f9a71
97 changed files with 1756 additions and 741 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,13 +33,25 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(badQualityToCell, 0); defineTypeNameAndDebug(badQualityToCell, 0);
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, word); addToRunTimeSelectionTable(topoSetSource, badQualityToCell, word);
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, istream); addToRunTimeSelectionTable(topoSetSource, badQualityToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
badQualityToCell,
word,
badQuality
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
badQualityToCell,
istream,
badQuality
);
} }
@ -59,9 +71,8 @@ void Foam::badQualityToCell::combine(topoSet& set, const bool add) const
motionSmoother::checkMesh(false, mesh_, dict_, faces); motionSmoother::checkMesh(false, mesh_, dict_, faces);
faces.sync(mesh_); faces.sync(mesh_);
forAllConstIter(faceSet, faces, iter) for (const label facei : faces)
{ {
label facei = iter.key();
addOrDelete(set, mesh_.faceOwner()[facei], add); addOrDelete(set, mesh_.faceOwner()[facei], add);
if (mesh_.isInternalFace(facei)) if (mesh_.isInternalFace(facei))
{ {
@ -73,36 +84,28 @@ void Foam::badQualityToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::badQualityToCell::badQualityToCell Foam::badQualityToCell::badQualityToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
dict_(dict) dict_(dict)
{} {}
// Construct from Istream
Foam::badQualityToCell::badQualityToCell Foam::badQualityToCell::badQualityToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
dict_(is) dict_(is)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::badQualityToCell::~badQualityToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::badQualityToCell::applyToSet void Foam::badQualityToCell::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,7 +35,7 @@ SourceFiles
#ifndef badQualityToCell_H #ifndef badQualityToCell_H
#define badQualityToCell_H #define badQualityToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "bitSet.H" #include "bitSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace Foam
class badQualityToCell class badQualityToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -74,35 +74,22 @@ public:
// Constructors // Constructors
//- Construct from dictionary //- Construct from dictionary
badQualityToCell badQualityToCell(const polyMesh& mesh, const dictionary& dict);
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream //- Construct from Istream
badQualityToCell badQualityToCell(const polyMesh& mesh, Istream& is);
(
const polyMesh& mesh,
Istream&
);
//- Destructor //- Destructor
virtual ~badQualityToCell(); virtual ~badQualityToCell() = default;
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,
topoSet& topoSet& set
) const; ) const;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,13 +33,25 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(badQualityToFace, 0); defineTypeNameAndDebug(badQualityToFace, 0);
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, word); addToRunTimeSelectionTable(topoSetSource, badQualityToFace, word);
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, istream); addToRunTimeSelectionTable(topoSetSource, badQualityToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, badQualityToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, badQualityToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
badQualityToFace,
word,
badQuality
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
badQualityToFace,
istream,
badQuality
);
} }
@ -59,9 +71,8 @@ void Foam::badQualityToFace::combine(topoSet& set, const bool add) const
motionSmoother::checkMesh(false, mesh_, dict_, faces); motionSmoother::checkMesh(false, mesh_, dict_, faces);
faces.sync(mesh_); faces.sync(mesh_);
forAllConstIter(faceSet, faces, iter) for (const label facei : faces)
{ {
label facei = iter.key();
addOrDelete(set, facei, add); addOrDelete(set, facei, add);
} }
} }
@ -69,36 +80,28 @@ void Foam::badQualityToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::badQualityToFace::badQualityToFace Foam::badQualityToFace::badQualityToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
dict_(dict) dict_(dict)
{} {}
// Construct from Istream
Foam::badQualityToFace::badQualityToFace Foam::badQualityToFace::badQualityToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
dict_(is) dict_(is)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::badQualityToFace::~badQualityToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::badQualityToFace::applyToSet void Foam::badQualityToFace::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,7 +35,7 @@ SourceFiles
#ifndef badQualityToFace_H #ifndef badQualityToFace_H
#define badQualityToFace_H #define badQualityToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
#include "bitSet.H" #include "bitSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace Foam
class badQualityToFace class badQualityToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -89,20 +89,15 @@ public:
//- Destructor //- Destructor
virtual ~badQualityToFace(); virtual ~badQualityToFace() = default;
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,
topoSet& topoSet& set
) const; ) const;
}; };

View File

@ -84,13 +84,11 @@ SourceFiles
#ifndef directionalPressureGradientExplicitSource_H #ifndef directionalPressureGradientExplicitSource_H
#define directionalPressureGradientExplicitSource_H #define directionalPressureGradientExplicitSource_H
#include "cellSetOption.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "topoSetSource.H"
#include "cellSet.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "fvOption.H" #include "fvOption.H"
#include "cellSetOption.H"
#include "interpolationTable.H" #include "interpolationTable.H"

View File

@ -51,8 +51,6 @@ SourceFiles
#define meanVelocityForce_H #define meanVelocityForce_H
#include "autoPtr.H" #include "autoPtr.H"
#include "topoSetSource.H"
#include "cellSet.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "cellSetOption.H" #include "cellSetOption.H"

View File

@ -145,48 +145,54 @@ $(topoSets)/pointZoneSet.C
sets/topoSetSource/topoSetSource.C sets/topoSetSource/topoSetSource.C
cellSources = sets/cellSources cellSources = sets/cellSources
$(cellSources)/faceToCell/faceToCell.C $(cellSources)/topoSetCellSource/topoSetCellSource.C
$(cellSources)/fieldToCell/fieldToCell.C
$(cellSources)/pointToCell/pointToCell.C
$(cellSources)/shapeToCell/shapeToCell.C
$(cellSources)/boxToCell/boxToCell.C $(cellSources)/boxToCell/boxToCell.C
$(cellSources)/cellToCell/cellToCell.C
$(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C
$(cellSources)/cylinderToCell/cylinderToCell.C
$(cellSources)/faceToCell/faceToCell.C
$(cellSources)/faceZoneToCell/faceZoneToCell.C
$(cellSources)/fieldToCell/fieldToCell.C
$(cellSources)/labelToCell/labelToCell.C
$(cellSources)/nbrToCell/nbrToCell.C
$(cellSources)/nearestToCell/nearestToCell.C
$(cellSources)/noneToCell/noneToCell.C
$(cellSources)/pointToCell/pointToCell.C
$(cellSources)/regionToCell/regionToCell.C $(cellSources)/regionToCell/regionToCell.C
$(cellSources)/rotatedBoxToCell/rotatedBoxToCell.C $(cellSources)/rotatedBoxToCell/rotatedBoxToCell.C
$(cellSources)/labelToCell/labelToCell.C $(cellSources)/shapeToCell/shapeToCell.C
$(cellSources)/surfaceToCell/surfaceToCell.C
$(cellSources)/cellToCell/cellToCell.C
$(cellSources)/nearestToCell/nearestToCell.C
$(cellSources)/nbrToCell/nbrToCell.C
$(cellSources)/zoneToCell/zoneToCell.C
$(cellSources)/sphereToCell/sphereToCell.C $(cellSources)/sphereToCell/sphereToCell.C
$(cellSources)/cylinderToCell/cylinderToCell.C $(cellSources)/surfaceToCell/surfaceToCell.C
$(cellSources)/faceZoneToCell/faceZoneToCell.C
$(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C
$(cellSources)/targetVolumeToCell/targetVolumeToCell.C $(cellSources)/targetVolumeToCell/targetVolumeToCell.C
$(cellSources)/zoneToCell/zoneToCell.C
faceSources = sets/faceSources faceSources = sets/faceSources
$(faceSources)/topoSetFaceSource/topoSetFaceSource.C
$(faceSources)/boundaryToFace/boundaryToFace.C
$(faceSources)/boxToFace/boxToFace.C
$(faceSources)/cellToFace/cellToFace.C
$(faceSources)/cylinderAnnulusToFace/cylinderAnnulusToFace.C
$(faceSources)/cylinderToFace/cylinderToFace.C
$(faceSources)/faceToFace/faceToFace.C $(faceSources)/faceToFace/faceToFace.C
$(faceSources)/labelToFace/labelToFace.C $(faceSources)/labelToFace/labelToFace.C
$(faceSources)/cellToFace/cellToFace.C $(faceSources)/noneToFace/noneToFace.C
$(faceSources)/normalToFace/normalToFace.C $(faceSources)/normalToFace/normalToFace.C
$(faceSources)/pointToFace/pointToFace.C
$(faceSources)/patchToFace/patchToFace.C $(faceSources)/patchToFace/patchToFace.C
$(faceSources)/boundaryToFace/boundaryToFace.C $(faceSources)/pointToFace/pointToFace.C
$(faceSources)/zoneToFace/zoneToFace.C
$(faceSources)/boxToFace/boxToFace.C
$(faceSources)/regionToFace/regionToFace.C $(faceSources)/regionToFace/regionToFace.C
$(faceSources)/cylinderToFace/cylinderToFace.C $(faceSources)/zoneToFace/zoneToFace.C
$(faceSources)/cylinderAnnulusToFace/cylinderAnnulusToFace.C
pointSources = sets/pointSources pointSources = sets/pointSources
$(pointSources)/labelToPoint/labelToPoint.C $(pointSources)/topoSetPointSource/topoSetPointSource.C
$(pointSources)/pointToPoint/pointToPoint.C $(pointSources)/boxToPoint/boxToPoint.C
$(pointSources)/cellToPoint/cellToPoint.C $(pointSources)/cellToPoint/cellToPoint.C
$(pointSources)/faceToPoint/faceToPoint.C $(pointSources)/faceToPoint/faceToPoint.C
$(pointSources)/boxToPoint/boxToPoint.C $(pointSources)/labelToPoint/labelToPoint.C
$(pointSources)/nearestToPoint/nearestToPoint.C
$(pointSources)/noneToPoint/noneToPoint.C
$(pointSources)/pointToPoint/pointToPoint.C
$(pointSources)/surfaceToPoint/surfaceToPoint.C $(pointSources)/surfaceToPoint/surfaceToPoint.C
$(pointSources)/zoneToPoint/zoneToPoint.C $(pointSources)/zoneToPoint/zoneToPoint.C
$(pointSources)/nearestToPoint/nearestToPoint.C
faceZoneSources = sets/faceZoneSources faceZoneSources = sets/faceZoneSources
$(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C $(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boxToCell, 0); defineTypeNameAndDebug(boxToCell, 0);
addToRunTimeSelectionTable(topoSetSource, boxToCell, word); addToRunTimeSelectionTable(topoSetSource, boxToCell, word);
addToRunTimeSelectionTable(topoSetSource, boxToCell, istream); addToRunTimeSelectionTable(topoSetSource, boxToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, boxToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, boxToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
boxToCell,
word,
box
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
boxToCell,
istream,
box
);
} }
@ -73,18 +89,29 @@ Foam::boxToCell::boxToCell
const treeBoundBoxList& bbs const treeBoundBoxList& bbs
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
bbs_(bbs) bbs_(bbs)
{} {}
Foam::boxToCell::boxToCell
(
const polyMesh& mesh,
treeBoundBoxList&& bbs
)
:
topoSetCellSource(mesh),
bbs_(std::move(bbs))
{}
Foam::boxToCell::boxToCell Foam::boxToCell::boxToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
bbs_() bbs_()
{ {
// Look for 'boxes' or 'box' // Look for 'boxes' or 'box'
@ -102,8 +129,8 @@ Foam::boxToCell::boxToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
bbs_(1, treeBoundBox(checkIs(is))) bbs_(one(), treeBoundBox(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::boxToCell Foam::boxToCell
Description Description
A topoSetSource to select cells based on cell centres inside box(es). A topoSetCellSource to select cells based on cell centres inside box(es).
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -46,7 +46,7 @@ SourceFiles
#ifndef boxToCell_H #ifndef boxToCell_H
#define boxToCell_H #define boxToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class boxToCell class boxToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -83,12 +83,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components, copying bounding boxes
boxToCell boxToCell(const polyMesh& mesh, const treeBoundBoxList& bbs);
(
const polyMesh& mesh, //- Construct from components, moving bounding boxes
const treeBoundBoxList& bbs boxToCell(const polyMesh& mesh, treeBoundBoxList&& bbs);
);
//- Construct from dictionary //- Construct from dictionary
boxToCell(const polyMesh& mesh, const dictionary& dict); boxToCell(const polyMesh& mesh, const dictionary& dict);
@ -103,11 +102,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(cellToCell, 0); defineTypeNameAndDebug(cellToCell, 0);
addToRunTimeSelectionTable(topoSetSource, cellToCell, word); addToRunTimeSelectionTable(topoSetSource, cellToCell, word);
addToRunTimeSelectionTable(topoSetSource, cellToCell, istream); addToRunTimeSelectionTable(topoSetSource, cellToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, cellToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, cellToCell, istream);
} }
@ -54,7 +56,7 @@ Foam::cellToCell::cellToCell
const word& setName const word& setName
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(setName) setName_(setName)
{} {}
@ -65,8 +67,11 @@ Foam::cellToCell::cellToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), cellToCell
setName_(dict.get<word>("set")) (
mesh,
dict.get<word>("set")
)
{} {}
@ -76,7 +81,7 @@ Foam::cellToCell::cellToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(checkIs(is)) setName_(checkIs(is))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::cellToCell Foam::cellToCell
Description Description
A topoSetSource to select the cells from another cellSet. A topoSetCellSource to select the cells from another cellSet.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -41,7 +41,7 @@ SourceFiles
#ifndef cellToCell_H #ifndef cellToCell_H
#define cellToCell_H #define cellToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class cellToCell class cellToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -72,11 +72,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
cellToCell cellToCell(const polyMesh& mesh, const word& setName);
(
const polyMesh& mesh,
const word& setName
);
//- Construct from dictionary //- Construct from dictionary
cellToCell(const polyMesh& mesh, const dictionary& dict); cellToCell(const polyMesh& mesh, const dictionary& dict);
@ -91,11 +87,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,32 @@ namespace Foam
defineTypeNameAndDebug(cylinderAnnulusToCell, 0); defineTypeNameAndDebug(cylinderAnnulusToCell, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, word); addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, word);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, istream); addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, istream);
addToRunTimeSelectionTable
(
topoSetCellSource,
cylinderAnnulusToCell,
word
);
addToRunTimeSelectionTable
(
topoSetCellSource,
cylinderAnnulusToCell,
istream
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
cylinderAnnulusToCell,
word,
cylinderAnnulus
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
cylinderAnnulusToCell,
istream,
cylinderAnnulus
);
} }
@ -85,7 +111,7 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
const scalar innerRadius const scalar innerRadius
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
point1_(point1), point1_(point1),
point2_(point2), point2_(point2),
outerRadius_(outerRadius), outerRadius_(outerRadius),
@ -99,11 +125,14 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), cylinderAnnulusToCell
point1_(dict.get<point>("p1")), (
point2_(dict.get<point>("p2")), mesh,
outerRadius_(dict.get<scalar>("outerRadius")), dict.get<point>("p1"),
innerRadius_(dict.get<scalar>("innerRadius")) dict.get<point>("p2"),
dict.get<scalar>("outerRadius"),
dict.get<scalar>("innerRadius")
)
{} {}
@ -113,7 +142,7 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
point1_(checkIs(is)), point1_(checkIs(is)),
point2_(checkIs(is)), point2_(checkIs(is)),
outerRadius_(readScalar(checkIs(is))), outerRadius_(readScalar(checkIs(is))),

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderAnnulusToCell Foam::cylinderAnnulusToCell
Description Description
A topoSetSource to select cells based on cell centres inside a A topoSetCellSource to select cells based on cell centres inside a
cylinder annulus. cylinder annulus.
\heading Dictionary parameters \heading Dictionary parameters
@ -45,7 +45,7 @@ SourceFiles
#ifndef cylinderAnnulusToCell_H #ifndef cylinderAnnulusToCell_H
#define cylinderAnnulusToCell_H #define cylinderAnnulusToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ namespace Foam
class cylinderAnnulusToCell class cylinderAnnulusToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -99,7 +99,7 @@ public:
const point& point1, const point& point1,
const point& point2, const point& point2,
const scalar outerRadius, const scalar outerRadius,
const scalar innerRadius const scalar innerRadius = 0
); );
//- Construct from dictionary //- Construct from dictionary
@ -115,11 +115,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(cylinderToCell, 0); defineTypeNameAndDebug(cylinderToCell, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderToCell, word); addToRunTimeSelectionTable(topoSetSource, cylinderToCell, word);
addToRunTimeSelectionTable(topoSetSource, cylinderToCell, istream); addToRunTimeSelectionTable(topoSetSource, cylinderToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, cylinderToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, cylinderToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
cylinderToCell,
word,
cylinder
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
cylinderToCell,
istream,
cylinder
);
} }
@ -82,7 +98,7 @@ Foam::cylinderToCell::cylinderToCell
const scalar radius const scalar radius
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
point1_(point1), point1_(point1),
point2_(point2), point2_(point2),
radius_(radius) radius_(radius)
@ -95,10 +111,13 @@ Foam::cylinderToCell::cylinderToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), cylinderToCell
point1_(dict.get<point>("p1")), (
point2_(dict.get<point>("p2")), mesh,
radius_(dict.get<scalar>("radius")) dict.get<point>("p1"),
dict.get<point>("p2"),
dict.get<scalar>("radius")
)
{} {}
@ -108,7 +127,7 @@ Foam::cylinderToCell::cylinderToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
point1_(checkIs(is)), point1_(checkIs(is)),
point2_(checkIs(is)), point2_(checkIs(is)),
radius_(readScalar(checkIs(is))) radius_(readScalar(checkIs(is)))

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderToCell Foam::cylinderToCell
Description Description
A topoSetSource to select cells based on cell centres inside a cylinder. A topoSetCellSource to select cells with their centres inside a cylinder.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -43,7 +43,7 @@ SourceFiles
#ifndef cylinderToCell_H #ifndef cylinderToCell_H
#define cylinderToCell_H #define cylinderToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class cylinderToCell class cylinderToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -109,11 +109,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(faceToCell, 0); defineTypeNameAndDebug(faceToCell, 0);
addToRunTimeSelectionTable(topoSetSource, faceToCell, word); addToRunTimeSelectionTable(topoSetSource, faceToCell, word);
addToRunTimeSelectionTable(topoSetSource, faceToCell, istream); addToRunTimeSelectionTable(topoSetSource, faceToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, faceToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, faceToCell, istream);
} }
@ -133,7 +135,7 @@ Foam::faceToCell::faceToCell
const faceAction option const faceAction option
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(setName), setName_(setName),
option_(option) option_(option)
{} {}
@ -145,9 +147,12 @@ Foam::faceToCell::faceToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), faceToCell
setName_(dict.get<word>("set")), (
option_(faceActionNames_.get("option", dict)) mesh,
dict.get<word>("set"),
faceActionNames_.get("option", dict)
)
{} {}
@ -157,7 +162,7 @@ Foam::faceToCell::faceToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
option_(faceActionNames_.read(checkIs(is))) option_(faceActionNames_.read(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::faceToCell Foam::faceToCell
Description Description
A topoSetSource to select cells based on usage in a face set. A topoSetCellSource to select cells based on usage in a face set.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -42,7 +42,7 @@ SourceFiles
#ifndef faceToCell_H #ifndef faceToCell_H
#define faceToCell_H #define faceToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "Enum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class faceToCell class faceToCell
: :
public topoSetSource public topoSetCellSource
{ {
public: public:
//- Enumeration defining the valid options //- Enumeration defining the valid options
@ -118,11 +118,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,8 @@ namespace Foam
defineTypeNameAndDebug(faceZoneToCell, 0); defineTypeNameAndDebug(faceZoneToCell, 0);
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word); addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word);
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream); addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, faceZoneToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, faceZoneToCell, istream);
} }
@ -111,7 +113,7 @@ Foam::faceZoneToCell::faceZoneToCell
const faceAction option const faceAction option
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
selectedZones_(one(), zoneName), selectedZones_(one(), zoneName),
option_(option) option_(option)
{} {}
@ -123,7 +125,7 @@ Foam::faceZoneToCell::faceZoneToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
selectedZones_(), selectedZones_(),
option_(faceActionNames_.get("option", dict)) option_(faceActionNames_.get("option", dict))
{ {
@ -143,7 +145,7 @@ Foam::faceZoneToCell::faceZoneToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
selectedZones_(one(), wordRe(checkIs(is))), selectedZones_(one(), wordRe(checkIs(is))),
option_(faceActionNames_.read(checkIs(is))) option_(faceActionNames_.read(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::faceZoneToCell Foam::faceZoneToCell
Description Description
A topoSetSource to select cells based on side of faceZone. A topoSetCellSource to select cells based on side of faceZone.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -47,7 +47,7 @@ SourceFiles
#ifndef faceZoneToCell_H #ifndef faceZoneToCell_H
#define faceZoneToCell_H #define faceZoneToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "wordRes.H" #include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,7 +61,7 @@ namespace Foam
class faceZoneToCell class faceZoneToCell
: :
public topoSetSource public topoSetCellSource
{ {
public: public:
//- Enumeration defining the valid options //- Enumeration defining the valid options
@ -120,11 +120,6 @@ public:
// Member Functions // Member Functions
virtual topoSetSource::sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -38,6 +38,22 @@ namespace Foam
defineTypeNameAndDebug(fieldToCell, 0); defineTypeNameAndDebug(fieldToCell, 0);
addToRunTimeSelectionTable(topoSetSource, fieldToCell, word); addToRunTimeSelectionTable(topoSetSource, fieldToCell, word);
addToRunTimeSelectionTable(topoSetSource, fieldToCell, istream); addToRunTimeSelectionTable(topoSetSource, fieldToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, fieldToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, fieldToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
fieldToCell,
word,
field
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
fieldToCell,
istream,
field
);
} }
@ -100,7 +116,7 @@ Foam::fieldToCell::fieldToCell
const scalar max const scalar max
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
fieldName_(fieldName), fieldName_(fieldName),
min_(min), min_(min),
max_(max) max_(max)
@ -113,10 +129,13 @@ Foam::fieldToCell::fieldToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), fieldToCell
fieldName_(dict.get<word>("field")), (
min_(dict.get<scalar>("min")), mesh,
max_(dict.get<scalar>("max")) dict.get<word>("field"),
dict.get<scalar>("min"),
dict.get<scalar>("max")
)
{} {}
@ -126,7 +145,7 @@ Foam::fieldToCell::fieldToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
fieldName_(checkIs(is)), fieldName_(checkIs(is)),
min_(readScalar(checkIs(is))), min_(readScalar(checkIs(is))),
max_(readScalar(checkIs(is))) max_(readScalar(checkIs(is)))

View File

@ -25,7 +25,7 @@ Class
Foam::fieldToCell Foam::fieldToCell
Description Description
A topoSetSource to select cells based on field values. A topoSetCellSource to select cells based on field values.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -43,7 +43,7 @@ SourceFiles
#ifndef fieldToCell_H #ifndef fieldToCell_H
#define fieldToCell_H #define fieldToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "scalarField.H" #include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace Foam
class fieldToCell class fieldToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -115,11 +115,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(labelToCell, 0); defineTypeNameAndDebug(labelToCell, 0);
addToRunTimeSelectionTable(topoSetSource, labelToCell, word); addToRunTimeSelectionTable(topoSetSource, labelToCell, word);
addToRunTimeSelectionTable(topoSetSource, labelToCell, istream); addToRunTimeSelectionTable(topoSetSource, labelToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, labelToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, labelToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
labelToCell,
word,
label
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
labelToCell,
istream,
label
);
} }
@ -53,19 +69,29 @@ Foam::labelToCell::labelToCell
const labelList& labels const labelList& labels
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
labels_(labels) labels_(labels)
{} {}
Foam::labelToCell::labelToCell
(
const polyMesh& mesh,
labelList&& labels
)
:
topoSetCellSource(mesh),
labels_(std::move(labels))
{}
Foam::labelToCell::labelToCell Foam::labelToCell::labelToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), labelToCell(mesh, dict.get<labelList>("value"))
labels_(dict.get<labelList>("value"))
{} {}
@ -75,7 +101,7 @@ Foam::labelToCell::labelToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
labels_(checkIs(is)) labels_(checkIs(is))
{ {
check(labels_, mesh.nCells()); check(labels_, mesh.nCells());

View File

@ -25,7 +25,7 @@ Class
Foam::labelToCell Foam::labelToCell
Description Description
A topoSetSource to select cells based on explicitly given labels. A topoSetCellSource to select cells based on explicitly given labels.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -41,7 +41,7 @@ SourceFiles
#ifndef labelToCell_H #ifndef labelToCell_H
#define labelToCell_H #define labelToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class labelToCell class labelToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -73,12 +73,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components, copying labels
labelToCell labelToCell(const polyMesh& mesh, const labelList& labels);
(
const polyMesh& mesh, //- Construct from components, moving labels
const labelList& labels labelToCell(const polyMesh& mesh, labelList&& labels);
);
//- Construct from dictionary //- Construct from dictionary
labelToCell(const polyMesh& mesh, const dictionary& dict); labelToCell(const polyMesh& mesh, const dictionary& dict);
@ -93,11 +92,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(nbrToCell, 0); defineTypeNameAndDebug(nbrToCell, 0);
addToRunTimeSelectionTable(topoSetSource, nbrToCell, word); addToRunTimeSelectionTable(topoSetSource, nbrToCell, word);
addToRunTimeSelectionTable(topoSetSource, nbrToCell, istream); addToRunTimeSelectionTable(topoSetSource, nbrToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, nbrToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, nbrToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
nbrToCell,
word,
nbr
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
nbrToCell,
istream,
nbr
);
} }
@ -101,7 +117,7 @@ Foam::nbrToCell::nbrToCell
const label minNbrs const label minNbrs
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
minNbrs_(minNbrs) minNbrs_(minNbrs)
{} {}
@ -112,8 +128,7 @@ Foam::nbrToCell::nbrToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), nbrToCell(mesh, dict.get<label>("neighbours"))
minNbrs_(dict.get<label>("neighbours"))
{} {}
@ -123,7 +138,7 @@ Foam::nbrToCell::nbrToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
minNbrs_(readLabel(checkIs(is))) minNbrs_(readLabel(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::nbrToCell Foam::nbrToCell
Description Description
A topoSetSource to select cells based on number of neighbouring cells A topoSetCellSource to select cells based on number of neighbouring cells
(i.e. number of internal or coupled faces) (i.e. number of internal or coupled faces)
\heading Dictionary parameters \heading Dictionary parameters
@ -42,7 +42,7 @@ SourceFiles
#ifndef nbrToCell_H #ifndef nbrToCell_H
#define nbrToCell_H #define nbrToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +55,7 @@ namespace Foam
class nbrToCell class nbrToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -81,11 +81,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
nbrToCell nbrToCell(const polyMesh& mesh, const label minNbrs);
(
const polyMesh& mesh,
const label minNbrs
);
//- Construct from dictionary //- Construct from dictionary
nbrToCell(const polyMesh& mesh, const dictionary& dict); nbrToCell(const polyMesh& mesh, const dictionary& dict);
@ -100,11 +96,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,22 @@ namespace Foam
defineTypeNameAndDebug(nearestToCell, 0); defineTypeNameAndDebug(nearestToCell, 0);
addToRunTimeSelectionTable(topoSetSource, nearestToCell, word); addToRunTimeSelectionTable(topoSetSource, nearestToCell, word);
addToRunTimeSelectionTable(topoSetSource, nearestToCell, istream); addToRunTimeSelectionTable(topoSetSource, nearestToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, nearestToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, nearestToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
nearestToCell,
word,
nearest
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
nearestToCell,
istream,
nearest
);
} }
@ -87,19 +103,33 @@ Foam::nearestToCell::nearestToCell
const pointField& points const pointField& points
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
points_(points) points_(points)
{} {}
Foam::nearestToCell::nearestToCell
(
const polyMesh& mesh,
pointField&& points
)
:
topoSetCellSource(mesh),
points_(std::move(points))
{}
Foam::nearestToCell::nearestToCell Foam::nearestToCell::nearestToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), nearestToCell
points_(dict.get<pointField>("points")) (
mesh,
dict.get<pointField>("points")
)
{} {}
@ -109,7 +139,7 @@ Foam::nearestToCell::nearestToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
points_(checkIs(is)) points_(checkIs(is))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::nearestToCell Foam::nearestToCell
Description Description
A topoSetSource to select cells nearest to points. A topoSetCellSource to select cells nearest to points.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -41,7 +41,7 @@ SourceFiles
#ifndef nearestToCell_H #ifndef nearestToCell_H
#define nearestToCell_H #define nearestToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class nearestToCell class nearestToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -78,12 +78,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components, copying points
nearestToCell nearestToCell(const polyMesh& mesh, const pointField& points);
(
const polyMesh& mesh, //- Construct from components, moving points
const pointField& points nearestToCell(const polyMesh& mesh, pointField&& points);
);
//- Construct from dictionary //- Construct from dictionary
nearestToCell(const polyMesh& mesh, const dictionary& dict); nearestToCell(const polyMesh& mesh, const dictionary& dict);
@ -98,11 +97,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(pointToCell, 0); defineTypeNameAndDebug(pointToCell, 0);
addToRunTimeSelectionTable(topoSetSource, pointToCell, word); addToRunTimeSelectionTable(topoSetSource, pointToCell, word);
addToRunTimeSelectionTable(topoSetSource, pointToCell, istream); addToRunTimeSelectionTable(topoSetSource, pointToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, pointToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, pointToCell, istream);
} }
@ -116,7 +118,7 @@ Foam::pointToCell::pointToCell
const pointAction option const pointAction option
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(setName), setName_(setName),
option_(option) option_(option)
{} {}
@ -128,9 +130,12 @@ Foam::pointToCell::pointToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), pointToCell
setName_(dict.get<word>("set")), (
option_(pointActionNames_.get("option", dict)) mesh,
dict.get<word>("set"),
pointActionNames_.get("option", dict)
)
{} {}
@ -140,7 +145,7 @@ Foam::pointToCell::pointToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
option_(pointActionNames_.read(checkIs(is))) option_(pointActionNames_.read(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::pointToCell Foam::pointToCell
Description Description
A topoSetSource to select cells based on usage of points. A topoSetCellSource to select cells based on usage of points.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -42,7 +42,7 @@ SourceFiles
#ifndef pointToCell_H #ifndef pointToCell_H
#define pointToCell_H #define pointToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "Enum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class pointToCell class pointToCell
: :
public topoSetSource public topoSetCellSource
{ {
public: public:
//- Enumeration defining the valid options //- Enumeration defining the valid options
@ -115,11 +115,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -37,6 +37,8 @@ namespace Foam
defineTypeNameAndDebug(regionToCell, 0); defineTypeNameAndDebug(regionToCell, 0);
addToRunTimeSelectionTable(topoSetSource, regionToCell, word); addToRunTimeSelectionTable(topoSetSource, regionToCell, word);
addToRunTimeSelectionTable(topoSetSource, regionToCell, istream); addToRunTimeSelectionTable(topoSetSource, regionToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, regionToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, regionToCell, istream);
} }
@ -386,7 +388,7 @@ Foam::regionToCell::regionToCell
const label nErode const label nErode
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(setName), setName_(setName),
insidePoints_(insidePoints), insidePoints_(insidePoints),
nErode_(nErode) nErode_(nErode)
@ -399,7 +401,7 @@ Foam::regionToCell::regionToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(dict.lookupOrDefault<word>("set", "none")), setName_(dict.lookupOrDefault<word>("set", "none")),
insidePoints_ insidePoints_
( (
@ -415,7 +417,7 @@ Foam::regionToCell::regionToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
insidePoints_(checkIs(is)), insidePoints_(checkIs(is)),
nErode_(readLabel(checkIs(is))) nErode_(readLabel(checkIs(is)))

View File

@ -25,8 +25,8 @@ Class
Foam::regionToCell Foam::regionToCell
Description Description
TopoSetSource. Select cells belonging to topological connected region A topoSetCellSource to select cells belonging to a topological connected
(that contains given points) region (that contains given points)
In dictionary input: In dictionary input:
\verbatim \verbatim
@ -46,7 +46,7 @@ Description
Property | Description | Required | Default Property | Description | Required | Default
insidePoints | Points inside regions | yes | insidePoints | Points inside regions | yes |
nErode | Cell layers to erode to detect holes | no | 0 nErode | Cell layers to erode to detect holes | no | 0
set | Restrict to named cellSet | no | '' set | Restrict to named cellSet | no | ""
\endtable \endtable
SourceFiles SourceFiles
@ -57,7 +57,7 @@ SourceFiles
#ifndef regionToCell_H #ifndef regionToCell_H
#define regionToCell_H #define regionToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "boolList.H" #include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,7 +73,7 @@ class regionSplit;
class regionToCell class regionToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -146,11 +146,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,22 @@ namespace Foam
defineTypeNameAndDebug(rotatedBoxToCell, 0); defineTypeNameAndDebug(rotatedBoxToCell, 0);
addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, word); addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, word);
addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, istream); addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, rotatedBoxToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, rotatedBoxToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
rotatedBoxToCell,
word,
rotatedBox
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
rotatedBoxToCell,
istream,
rotatedBox
);
} }
@ -117,7 +133,7 @@ Foam::rotatedBoxToCell::rotatedBoxToCell
const vector& k const vector& k
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
origin_(origin), origin_(origin),
i_(i), i_(i),
j_(j), j_(j),
@ -131,17 +147,20 @@ Foam::rotatedBoxToCell::rotatedBoxToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), rotatedBoxToCell
origin_(dict.get<point>("origin")), (
i_(dict.get<vector>("i")), mesh,
j_(dict.get<vector>("j")), dict.get<point>("origin"),
k_(dict.get<vector>("k")) dict.get<vector>("i"),
dict.get<vector>("j"),
dict.get<vector>("k")
)
{} {}
Foam::rotatedBoxToCell::rotatedBoxToCell(const polyMesh& mesh, Istream& is) Foam::rotatedBoxToCell::rotatedBoxToCell(const polyMesh& mesh, Istream& is)
: :
topoSetSource(mesh), topoSetCellSource(mesh),
origin_(is), origin_(is),
i_(is), i_(is),
j_(is), j_(is),

View File

@ -25,7 +25,7 @@ Class
Foam::rotatedBoxToCell Foam::rotatedBoxToCell
Description Description
A topoSetSource to select cells based on cell centres inside A topoSetCellSource to select cells based on cell centres inside
rotated/skewed box (parallelopiped?). rotated/skewed box (parallelopiped?).
Box defined as origin and i,j,k vectors. Box defined as origin and i,j,k vectors.
@ -55,7 +55,7 @@ SourceFiles
#ifndef rotatedBoxToCell_H #ifndef rotatedBoxToCell_H
#define rotatedBoxToCell_H #define rotatedBoxToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "treeBoundBox.H" #include "treeBoundBox.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ namespace Foam
class rotatedBoxToCell class rotatedBoxToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -120,11 +120,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -37,6 +37,8 @@ namespace Foam
defineTypeNameAndDebug(shapeToCell, 0); defineTypeNameAndDebug(shapeToCell, 0);
addToRunTimeSelectionTable(topoSetSource, shapeToCell, word); addToRunTimeSelectionTable(topoSetSource, shapeToCell, word);
addToRunTimeSelectionTable(topoSetSource, shapeToCell, istream); addToRunTimeSelectionTable(topoSetSource, shapeToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, shapeToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, shapeToCell, istream);
} }
@ -94,7 +96,7 @@ Foam::shapeToCell::shapeToCell
const word& shapeName const word& shapeName
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
type_(shapeName) type_(shapeName)
{ {
if (!cellModel::ptr(type_) && type_ != "splitHex") if (!cellModel::ptr(type_) && type_ != "splitHex")
@ -111,15 +113,8 @@ Foam::shapeToCell::shapeToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), shapeToCell(mesh, dict.get<word>("type"))
type_(dict.get<word>("type")) {}
{
if (!cellModel::ptr(type_) && type_ != "splitHex")
{
FatalErrorInFunction
<< "Illegal cell type " << type_ << exit(FatalError);
}
}
Foam::shapeToCell::shapeToCell Foam::shapeToCell::shapeToCell
@ -128,7 +123,7 @@ Foam::shapeToCell::shapeToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
type_(checkIs(is)) type_(checkIs(is))
{ {
if (!cellModel::ptr(type_) && type_ != "splitHex") if (!cellModel::ptr(type_) && type_ != "splitHex")

View File

@ -25,7 +25,7 @@ Class
Foam::shapeToCell Foam::shapeToCell
Description Description
A topoSetSource to select cells based on cell shape. A topoSetCellSource to select cells based on cell shape.
Handles all known ones from static collection in cellModel Handles all known ones from static collection in cellModel
and splitHex with 10 degrees feature angle. and splitHex with 10 degrees feature angle.
@ -44,7 +44,7 @@ SourceFiles
#ifndef shapeToCell_H #ifndef shapeToCell_H
#define shapeToCell_H #define shapeToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace Foam
class shapeToCell class shapeToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -90,11 +90,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
shapeToCell shapeToCell(const polyMesh& mesh, const word& shapeName);
(
const polyMesh& mesh,
const word& shapeName
);
//- Construct from dictionary //- Construct from dictionary
shapeToCell(const polyMesh& mesh, const dictionary& dict); shapeToCell(const polyMesh& mesh, const dictionary& dict);
@ -109,11 +105,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(sphereToCell, 0); defineTypeNameAndDebug(sphereToCell, 0);
addToRunTimeSelectionTable(topoSetSource, sphereToCell, word); addToRunTimeSelectionTable(topoSetSource, sphereToCell, word);
addToRunTimeSelectionTable(topoSetSource, sphereToCell, istream); addToRunTimeSelectionTable(topoSetSource, sphereToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, sphereToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, sphereToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
sphereToCell,
word,
sphere
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
sphereToCell,
istream,
sphere
);
} }
@ -72,7 +88,7 @@ Foam::sphereToCell::sphereToCell
const scalar radius const scalar radius
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
origin_(origin), origin_(origin),
radius_(radius) radius_(radius)
{} {}
@ -99,7 +115,7 @@ Foam::sphereToCell::sphereToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
origin_(checkIs(is)), origin_(checkIs(is)),
radius_(readScalar(checkIs(is))) radius_(readScalar(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::sphereToCell Foam::sphereToCell
Description Description
A topoSetSource to select cells based on cell centres inside sphere. A topoSetCellSource to select cells based on cell centres inside sphere.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -43,7 +43,7 @@ SourceFiles
#ifndef sphereToCell_H #ifndef sphereToCell_H
#define sphereToCell_H #define sphereToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class sphereToCell class sphereToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -105,11 +105,6 @@ public:
// Member Functions // Member Functions
virtual topoSetSource::sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -40,6 +40,8 @@ namespace Foam
defineTypeNameAndDebug(surfaceToCell, 0); defineTypeNameAndDebug(surfaceToCell, 0);
addToRunTimeSelectionTable(topoSetSource, surfaceToCell, word); addToRunTimeSelectionTable(topoSetSource, surfaceToCell, word);
addToRunTimeSelectionTable(topoSetSource, surfaceToCell, istream); addToRunTimeSelectionTable(topoSetSource, surfaceToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, surfaceToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, surfaceToCell, istream);
} }
@ -72,25 +74,22 @@ Foam::label Foam::surfaceToCell::getNearest
Map<label>& cache Map<label>& cache
) )
{ {
Map<label>::const_iterator iter = cache.find(pointi); const auto iter = cache.cfind(pointi);
if (iter != cache.end()) if (iter.found())
{ {
// Found cached answer return *iter; // Return cached value
return iter();
} }
else
{
pointIndexHit inter = querySurf.nearest(pt, span); pointIndexHit inter = querySurf.nearest(pt, span);
// Triangle label (can be -1) // Triangle label (can be -1)
label triI = inter.index(); const label trii = inter.index();
// Store triangle on point // Store triangle on point
cache.insert(pointi, triI); cache.insert(pointi, trii);
return triI; return trii;
}
} }
@ -148,7 +147,6 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
{ {
cpuTime timer; cpuTime timer;
if (useSurfaceOrientation_ && (includeInside_ || includeOutside_)) if (useSurfaceOrientation_ && (includeInside_ || includeOutside_))
{ {
const meshSearch queryMesh(mesh_); const meshSearch queryMesh(mesh_);
@ -364,7 +362,7 @@ Foam::surfaceToCell::surfaceToCell
const scalar curvature const scalar curvature
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
surfName_(surfName), surfName_(surfName),
outsidePoints_(outsidePoints), outsidePoints_(outsidePoints),
includeCut_(includeCut), includeCut_(includeCut),
@ -396,7 +394,7 @@ Foam::surfaceToCell::surfaceToCell
const scalar curvature const scalar curvature
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
surfName_(surfName), surfName_(surfName),
outsidePoints_(outsidePoints), outsidePoints_(outsidePoints),
includeCut_(includeCut), includeCut_(includeCut),
@ -419,7 +417,7 @@ Foam::surfaceToCell::surfaceToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
surfName_(dict.get<fileName>("file").expand()), surfName_(dict.get<fileName>("file").expand()),
outsidePoints_(dict.get<pointField>("outsidePoints")), outsidePoints_(dict.get<pointField>("outsidePoints")),
includeCut_(dict.get<bool>("includeCut")), includeCut_(dict.get<bool>("includeCut")),
@ -452,7 +450,7 @@ Foam::surfaceToCell::surfaceToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
surfName_(checkIs(is)), surfName_(checkIs(is)),
outsidePoints_(checkIs(is)), outsidePoints_(checkIs(is)),
includeCut_(readBool(checkIs(is))), includeCut_(readBool(checkIs(is))),

View File

@ -25,7 +25,7 @@ Class
Foam::surfaceToCell Foam::surfaceToCell
Description Description
A topoSetSource to select cells based on relation to surface. A topoSetCellSource to select cells based on relation to surface.
Selects: Selects:
- all cells inside/outside/cut by surface - all cells inside/outside/cut by surface
@ -58,7 +58,7 @@ SourceFiles
#ifndef surfaceToCell_H #ifndef surfaceToCell_H
#define surfaceToCell_H #define surfaceToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "Map.H" #include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,7 +74,7 @@ class triSurface;
class surfaceToCell class surfaceToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -209,11 +209,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -38,6 +38,22 @@ namespace Foam
defineTypeNameAndDebug(targetVolumeToCell, 0); defineTypeNameAndDebug(targetVolumeToCell, 0);
addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, word); addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, word);
addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, istream); addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, targetVolumeToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, targetVolumeToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
targetVolumeToCell,
word,
targetVolume
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
targetVolumeToCell,
istream,
targetVolume
);
} }
@ -103,7 +119,6 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
return; return;
} }
bitSet maskSet(mesh_.nCells(), true); bitSet maskSet(mesh_.nCells(), true);
label nTotCells = mesh_.globalData().nTotalCells(); label nTotCells = mesh_.globalData().nTotalCells();
if (maskSetName_.size()) if (maskSetName_.size())
@ -138,7 +153,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
label maxPointi = -1; label maxPointi = -1;
forAll(points, pointi) forAll(points, pointi)
{ {
scalar c = (points[pointi] & normal_); const scalar c = (points[pointi] & normal_);
if (c > maxComp) if (c > maxComp)
{ {
maxComp = c; maxComp = c;
@ -265,12 +280,14 @@ Foam::targetVolumeToCell::targetVolumeToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const scalar vol, const scalar vol,
const vector& normal const vector& normal,
const word& maskSetName
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
vol_(vol), vol_(vol),
normal_(normal) normal_(normal),
maskSetName_(maskSetName)
{} {}
@ -280,10 +297,13 @@ Foam::targetVolumeToCell::targetVolumeToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), targetVolumeToCell
vol_(dict.get<scalar>("volume")), (
normal_(dict.get<vector>("normal")), mesh,
maskSetName_(dict.lookupOrDefault<word>("set", "")) dict.get<scalar>("volume"),
dict.get<vector>("normal"),
dict.lookupOrDefault<word>("set", "")
)
{} {}
@ -293,7 +313,7 @@ Foam::targetVolumeToCell::targetVolumeToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
vol_(readScalar(checkIs(is))), vol_(readScalar(checkIs(is))),
normal_(checkIs(is)) normal_(checkIs(is))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::targetVolumeToCell Foam::targetVolumeToCell
Description Description
A topoSetSource to select cells based on the wanted volume of selected A topoSetCellSource to select cells based on the wanted volume of selected
cells. Adapts a plane until it has enough. cells. Adapts a plane until it has enough.
\heading Dictionary parameters \heading Dictionary parameters
@ -44,7 +44,7 @@ SourceFiles
#ifndef targetVolumeToCell_H #ifndef targetVolumeToCell_H
#define targetVolumeToCell_H #define targetVolumeToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ class bitSet;
class targetVolumeToCell class targetVolumeToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -105,7 +105,8 @@ public:
( (
const polyMesh& mesh, const polyMesh& mesh,
const scalar vol, const scalar vol,
const vector& normal const vector& normal,
const word& maskSetName = ""
); );
//- Construct from dictionary //- Construct from dictionary
@ -121,11 +122,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "topoSetCellSource.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(topoSetCellSource, 0);
defineRunTimeSelectionTable(topoSetCellSource, word);
defineRunTimeSelectionTable(topoSetCellSource, istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoSetCellSource::topoSetCellSource(const polyMesh& mesh)
:
topoSetSource(mesh)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
)
{
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetCellSource type "
<< sourceType << nl << nl
<< "Valid types :" << endl
<< wordConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<topoSetCellSource>(cstrIter()(mesh, dict));
}
Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
)
{
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetCellSource type "
<< sourceType << nl << nl
<< "Valid types :" << endl
<< istreamConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<topoSetCellSource>(cstrIter()(mesh, is));
}
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::topoSetCellSource
Description
Base class of a topoSet source for selecting cells.
SourceFiles
topoSetCellSource.C
\*---------------------------------------------------------------------------*/
#ifndef topoSetCellSource_H
#define topoSetCellSource_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class topoSetCellSource Declaration
\*---------------------------------------------------------------------------*/
class topoSetCellSource
:
public topoSetSource
{
public:
//- Runtime type information
TypeName("topoSetCellSource");
// Declare run-time constructor selection table
// For the dictionary constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetCellSource,
word,
(
const polyMesh& mesh,
const dictionary& dict
),
(mesh, dict)
);
// For the Istream constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetCellSource,
istream,
(
const polyMesh& mesh,
Istream& is
),
(mesh, is)
);
// Constructors
//- Construct from components
explicit topoSetCellSource(const polyMesh& mesh);
// Selectors
//- Return a reference to the selected source type
static autoPtr<topoSetCellSource> New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
);
//- Return a reference to the selected source type
static autoPtr<topoSetCellSource> New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
);
//- Destructor
virtual ~topoSetCellSource() = default;
// Member Functions
virtual topoSetSource::sourceType setType() const
{
return CELLSETSOURCE;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(zoneToCell, 0); defineTypeNameAndDebug(zoneToCell, 0);
addToRunTimeSelectionTable(topoSetSource, zoneToCell, word); addToRunTimeSelectionTable(topoSetSource, zoneToCell, word);
addToRunTimeSelectionTable(topoSetSource, zoneToCell, istream); addToRunTimeSelectionTable(topoSetSource, zoneToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, zoneToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, zoneToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
zoneToCell,
word,
zone
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
zoneToCell,
istream,
zone
);
} }
@ -93,7 +109,7 @@ Foam::zoneToCell::zoneToCell
const wordRe& zoneName const wordRe& zoneName
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
selectedZones_(one(), zoneName) selectedZones_(one(), zoneName)
{} {}
@ -104,7 +120,7 @@ Foam::zoneToCell::zoneToCell
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
selectedZones_() selectedZones_()
{ {
// Look for 'zones' and 'zone', but accept 'name' as well // Look for 'zones' and 'zone', but accept 'name' as well
@ -123,7 +139,7 @@ Foam::zoneToCell::zoneToCell
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
selectedZones_(one(), wordRe(checkIs(is))) selectedZones_(one(), wordRe(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::zoneToCell Foam::zoneToCell
Description Description
A topoSetSource to select cells based on one or more cellZones. A topoSetCellSource to select cells based on one or more cellZones.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -46,7 +46,7 @@ SourceFiles
#ifndef zoneToCell_H #ifndef zoneToCell_H
#define zoneToCell_H #define zoneToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "wordRes.H" #include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class zoneToCell class zoneToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -100,11 +100,6 @@ public:
// Member Functions // Member Functions
virtual topoSetSource::sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -109,10 +109,8 @@ void Foam::setToCellZone::applyToSet
// Start off from copy // Start off from copy
DynamicList<label> newAddressing(fzSet.addressing()); DynamicList<label> newAddressing(fzSet.addressing());
forAllConstIter(cellSet, fSet, iter) for (const label celli : fSet)
{ {
label celli = iter.key();
if (!fzSet.found(celli)) if (!fzSet.found(celli))
{ {
newAddressing.append(celli); newAddressing.append(celli);

View File

@ -72,11 +72,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
setToCellZone setToCellZone(const polyMesh& mesh, const word& setName);
(
const polyMesh& mesh,
const word& setName
);
//- Construct from dictionary //- Construct from dictionary
setToCellZone(const polyMesh& mesh, const dictionary& dict); setToCellZone(const polyMesh& mesh, const dictionary& dict);

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boundaryToFace, 0); defineTypeNameAndDebug(boundaryToFace, 0);
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word); addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream); addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, boundaryToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, boundaryToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
boundaryToFace,
word,
boundary
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
boundaryToFace,
istream,
boundary
);
} }
@ -65,7 +81,7 @@ void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh) Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh)
: :
topoSetSource(mesh) topoSetFaceSource(mesh)
{} {}
@ -75,7 +91,7 @@ Foam::boundaryToFace::boundaryToFace
const dictionary& const dictionary&
) )
: :
topoSetSource(mesh) topoSetFaceSource(mesh)
{} {}
@ -85,7 +101,7 @@ Foam::boundaryToFace::boundaryToFace
Istream& Istream&
) )
: :
topoSetSource(mesh) topoSetFaceSource(mesh)
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::boundaryToFace Foam::boundaryToFace
Description Description
A topoSetSource to select all external (boundary) faces. A topoSetFaceSource to select all external (boundary) faces.
\heading Dictionary parameters \heading Dictionary parameters
None None
@ -38,7 +38,7 @@ SourceFiles
#ifndef boundaryToFace_H #ifndef boundaryToFace_H
#define boundaryToFace_H #define boundaryToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,7 +51,7 @@ namespace Foam
class boundaryToFace class boundaryToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -87,11 +87,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boxToFace, 0); defineTypeNameAndDebug(boxToFace, 0);
addToRunTimeSelectionTable(topoSetSource, boxToFace, word); addToRunTimeSelectionTable(topoSetSource, boxToFace, word);
addToRunTimeSelectionTable(topoSetSource, boxToFace, istream); addToRunTimeSelectionTable(topoSetSource, boxToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, boxToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, boxToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
boxToFace,
word,
box
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
boxToFace,
istream,
box
);
} }
@ -73,18 +89,29 @@ Foam::boxToFace::boxToFace
const treeBoundBoxList& bbs const treeBoundBoxList& bbs
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
bbs_(bbs) bbs_(bbs)
{} {}
Foam::boxToFace::boxToFace
(
const polyMesh& mesh,
treeBoundBoxList&& bbs
)
:
topoSetFaceSource(mesh),
bbs_(std::move(bbs))
{}
Foam::boxToFace::boxToFace Foam::boxToFace::boxToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
bbs_() bbs_()
{ {
// Look for 'boxes' or 'box' // Look for 'boxes' or 'box'
@ -102,8 +129,8 @@ Foam::boxToFace::boxToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
bbs_(1, treeBoundBox(checkIs(is))) bbs_(one(), treeBoundBox(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::boxToFace Foam::boxToFace
Description Description
A topoSetSource to select faces based on face centres inside box. A topoSetFaceSource to select faces based on face centres inside box.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -46,7 +46,7 @@ SourceFiles
#ifndef boxToFace_H #ifndef boxToFace_H
#define boxToFace_H #define boxToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class boxToFace class boxToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -83,12 +83,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components, copying bounding boxes
boxToFace boxToFace(const polyMesh& mesh, const treeBoundBoxList& bbs);
(
const polyMesh& mesh, //- Construct from components, moving bounding boxes
const treeBoundBoxList& bbs boxToFace(const polyMesh& mesh, treeBoundBoxList&& bbs);
);
//- Construct from dictionary //- Construct from dictionary
boxToFace(const polyMesh& mesh, const dictionary& dict); boxToFace(const polyMesh& mesh, const dictionary& dict);
@ -103,11 +102,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -37,6 +37,8 @@ namespace Foam
defineTypeNameAndDebug(cellToFace, 0); defineTypeNameAndDebug(cellToFace, 0);
addToRunTimeSelectionTable(topoSetSource, cellToFace, word); addToRunTimeSelectionTable(topoSetSource, cellToFace, word);
addToRunTimeSelectionTable(topoSetSource, cellToFace, istream); addToRunTimeSelectionTable(topoSetSource, cellToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, cellToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, cellToFace, istream);
} }
@ -153,7 +155,7 @@ Foam::cellToFace::cellToFace
const cellAction option const cellAction option
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(setName), setName_(setName),
option_(option) option_(option)
{} {}
@ -165,9 +167,12 @@ Foam::cellToFace::cellToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), cellToFace
setName_(dict.get<word>("set")), (
option_(cellActionNames_.get("option", dict)) mesh,
dict.get<word>("set"),
cellActionNames_.get("option", dict)
)
{} {}
@ -177,7 +182,7 @@ Foam::cellToFace::cellToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
option_(cellActionNames_.read(checkIs(is))) option_(cellActionNames_.read(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::cellToFace Foam::cellToFace
Description Description
A topoSetSource to select a faceSet from cells. A topoSetFaceSource to select a faceSet from a cellSet.
Either use 'all' cell faces, or only faces that have cells Either use 'all' cell faces, or only faces that have cells
on 'both' sides. on 'both' sides.
@ -48,7 +48,7 @@ SourceFiles
#ifndef cellToFace_H #ifndef cellToFace_H
#define cellToFace_H #define cellToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
#include "Enum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,7 +62,7 @@ namespace Foam
class cellToFace class cellToFace
: :
public topoSetSource public topoSetFaceSource
{ {
public: public:
//- Enumeration defining the valid options //- Enumeration defining the valid options
@ -121,11 +121,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,32 @@ namespace Foam
defineTypeNameAndDebug(cylinderAnnulusToFace, 0); defineTypeNameAndDebug(cylinderAnnulusToFace, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, word); addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, word);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, istream); addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, istream);
addToRunTimeSelectionTable
(
topoSetFaceSource,
cylinderAnnulusToFace,
word
);
addToRunTimeSelectionTable
(
topoSetFaceSource,
cylinderAnnulusToFace,
istream
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
cylinderAnnulusToFace,
word,
cylinderAnnulus
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
cylinderAnnulusToFace,
istream,
cylinderAnnulus
);
} }
@ -85,7 +111,7 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
const scalar innerRadius const scalar innerRadius
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
point1_(point1), point1_(point1),
point2_(point2), point2_(point2),
outerRadius_(outerRadius), outerRadius_(outerRadius),
@ -99,11 +125,14 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), cylinderAnnulusToFace
point1_(dict.get<point>("p1")), (
point2_(dict.get<point>("p2")), mesh,
outerRadius_(dict.get<scalar>("outerRadius")), dict.get<point>("p1"),
innerRadius_(dict.get<scalar>("innerRadius")) dict.get<point>("p2"),
dict.get<scalar>("outerRadius"),
dict.get<scalar>("innerRadius")
)
{} {}
@ -113,7 +142,7 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
point1_(checkIs(is)), point1_(checkIs(is)),
point2_(checkIs(is)), point2_(checkIs(is)),
outerRadius_(readScalar(checkIs(is))), outerRadius_(readScalar(checkIs(is))),

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderAnnulusToFace Foam::cylinderAnnulusToFace
Description Description
A topoSetSource to select faces based on face centres inside a A topoSetFaceSource to select faces based on face centres inside a
cylinder annulus. cylinder annulus.
\heading Dictionary parameters \heading Dictionary parameters
@ -45,7 +45,7 @@ SourceFiles
#ifndef cylinderAnnulusToFace_H #ifndef cylinderAnnulusToFace_H
#define cylinderAnnulusToFace_H #define cylinderAnnulusToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ namespace Foam
class cylinderAnnulusToFace class cylinderAnnulusToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -115,11 +115,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(cylinderToFace, 0); defineTypeNameAndDebug(cylinderToFace, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderToFace, word); addToRunTimeSelectionTable(topoSetSource, cylinderToFace, word);
addToRunTimeSelectionTable(topoSetSource, cylinderToFace, istream); addToRunTimeSelectionTable(topoSetSource, cylinderToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, cylinderToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, cylinderToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
cylinderToFace,
word,
cylinder
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
cylinderToFace,
istream,
cylinder
);
} }
@ -82,7 +98,7 @@ Foam::cylinderToFace::cylinderToFace
const scalar radius const scalar radius
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
point1_(point1), point1_(point1),
point2_(point2), point2_(point2),
radius_(radius) radius_(radius)
@ -95,10 +111,13 @@ Foam::cylinderToFace::cylinderToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), cylinderToFace
point1_(dict.get<point>("p1")), (
point2_(dict.get<point>("p2")), mesh,
radius_(dict.get<scalar>("radius")) dict.get<point>("p1"),
dict.get<point>("p2"),
dict.get<scalar>("radius")
)
{} {}
@ -108,7 +127,7 @@ Foam::cylinderToFace::cylinderToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
point1_(checkIs(is)), point1_(checkIs(is)),
point2_(checkIs(is)), point2_(checkIs(is)),
radius_(readScalar(checkIs(is))) radius_(readScalar(checkIs(is)))

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderToFace Foam::cylinderToFace
Description Description
A topoSetSource to select faces based on face centres inside a cylinder. A topoSetFaceSource to select faces based on face centres inside a cylinder.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -43,7 +43,7 @@ SourceFiles
#ifndef cylinderToFace_H #ifndef cylinderToFace_H
#define cylinderToFace_H #define cylinderToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class cylinderToFace class cylinderToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -109,11 +109,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(faceToFace, 0); defineTypeNameAndDebug(faceToFace, 0);
addToRunTimeSelectionTable(topoSetSource, faceToFace, word); addToRunTimeSelectionTable(topoSetSource, faceToFace, word);
addToRunTimeSelectionTable(topoSetSource, faceToFace, istream); addToRunTimeSelectionTable(topoSetSource, faceToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, faceToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, faceToFace, istream);
} }
@ -54,7 +56,7 @@ Foam::faceToFace::faceToFace
const word& setName const word& setName
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(setName) setName_(setName)
{} {}
@ -65,8 +67,11 @@ Foam::faceToFace::faceToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), faceToFace
setName_(dict.get<word>("set")) (
mesh,
dict.get<word>("set")
)
{} {}
@ -76,7 +81,7 @@ Foam::faceToFace::faceToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(checkIs(is)) setName_(checkIs(is))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::faceToFace Foam::faceToFace
Description Description
A topoSetSource to select faces based on usage in another faceSet. A topoSetFaceSource to select faces based on usage in another faceSet.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -41,7 +41,7 @@ SourceFiles
#ifndef faceToFace_H #ifndef faceToFace_H
#define faceToFace_H #define faceToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class faceToFace class faceToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -72,11 +72,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
faceToFace faceToFace(const polyMesh& mesh, const word& setName);
(
const polyMesh& mesh,
const word& setName
);
//- Construct from dictionary //- Construct from dictionary
faceToFace(const polyMesh& mesh, const dictionary& dict); faceToFace(const polyMesh& mesh, const dictionary& dict);
@ -91,11 +87,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(labelToFace, 0); defineTypeNameAndDebug(labelToFace, 0);
addToRunTimeSelectionTable(topoSetSource, labelToFace, word); addToRunTimeSelectionTable(topoSetSource, labelToFace, word);
addToRunTimeSelectionTable(topoSetSource, labelToFace, istream); addToRunTimeSelectionTable(topoSetSource, labelToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, labelToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, labelToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
labelToFace,
word,
label
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
labelToFace,
istream,
label
);
} }
@ -53,19 +69,33 @@ Foam::labelToFace::labelToFace
const labelList& labels const labelList& labels
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
labels_(labels) labels_(labels)
{} {}
Foam::labelToFace::labelToFace
(
const polyMesh& mesh,
labelList&& labels
)
:
topoSetFaceSource(mesh),
labels_(std::move(labels))
{}
Foam::labelToFace::labelToFace Foam::labelToFace::labelToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), labelToFace
labels_(dict.get<labelList>("value")) (
mesh,
dict.get<labelList>("value")
)
{} {}
@ -75,7 +105,7 @@ Foam::labelToFace::labelToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
labels_(checkIs(is)) labels_(checkIs(is))
{ {
check(labels_, mesh.nFaces()); check(labels_, mesh.nFaces());

View File

@ -25,7 +25,7 @@ Class
Foam::labelToFace Foam::labelToFace
Description Description
A topoSetSource to select faces given explicitly provided face labels. A topoSetFaceSource to select faces given explicitly provided face labels.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -42,7 +42,7 @@ SourceFiles
#ifndef labelToFace_H #ifndef labelToFace_H
#define labelToFace_H #define labelToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +55,7 @@ namespace Foam
class labelToFace class labelToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -74,12 +74,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components, copying labels
labelToFace labelToFace(const polyMesh& mesh, const labelList& labels);
(
const polyMesh& mesh, //- Construct from components, moving labels
const labelList& labels labelToFace(const polyMesh& mesh, labelList&& labels);
);
//- Construct from dictionary //- Construct from dictionary
labelToFace(const polyMesh& mesh, const dictionary& dict); labelToFace(const polyMesh& mesh, const dictionary& dict);
@ -94,11 +93,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,22 @@ namespace Foam
defineTypeNameAndDebug(normalToFace, 0); defineTypeNameAndDebug(normalToFace, 0);
addToRunTimeSelectionTable(topoSetSource, normalToFace, word); addToRunTimeSelectionTable(topoSetSource, normalToFace, word);
addToRunTimeSelectionTable(topoSetSource, normalToFace, istream); addToRunTimeSelectionTable(topoSetSource, normalToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, normalToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, normalToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
normalToFace,
word,
normal
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
normalToFace,
istream,
normal
);
} }
@ -73,7 +89,7 @@ Foam::normalToFace::normalToFace
const scalar tol const scalar tol
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
normal_(normal), normal_(normal),
tol_(tol) tol_(tol)
{ {
@ -83,9 +99,12 @@ Foam::normalToFace::normalToFace
Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict) Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
: :
topoSetSource(mesh), normalToFace
normal_(dict.get<vector>("normal")), (
tol_(dict.get<scalar>("cos")) mesh,
dict.get<vector>("normal"),
dict.get<scalar>("cos")
)
{ {
setNormal(); setNormal();
} }
@ -93,7 +112,7 @@ Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is) Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is)
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
normal_(checkIs(is)), normal_(checkIs(is)),
tol_(readScalar(checkIs(is))) tol_(readScalar(checkIs(is)))
{ {
@ -131,10 +150,8 @@ void Foam::normalToFace::applyToSet
DynamicList<label> toBeRemoved(set.size()/10); DynamicList<label> toBeRemoved(set.size()/10);
forAllConstIter(topoSet, set, iter) for (const label facei : static_cast<const labelHashSet&>(set))
{ {
const label facei = iter.key();
const vector n = normalised(mesh_.faceAreas()[facei]); const vector n = normalised(mesh_.faceAreas()[facei]);
if (mag(1 - (n & normal_)) < tol_) if (mag(1 - (n & normal_)) < tol_)

View File

@ -25,7 +25,7 @@ Class
Foam::normalToFace Foam::normalToFace
Description Description
A topoSetSource to select faces based on normal. A topoSetFaceSource to select faces based on normal.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -42,7 +42,7 @@ SourceFiles
#ifndef normalToFace_H #ifndef normalToFace_H
#define normalToFace_H #define normalToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +55,7 @@ namespace Foam
class normalToFace class normalToFace
: :
public topoSetSource public topoSetFaceSource
{ {
private: private:
@ -104,11 +104,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(patchToFace, 0); defineTypeNameAndDebug(patchToFace, 0);
addToRunTimeSelectionTable(topoSetSource, patchToFace, word); addToRunTimeSelectionTable(topoSetSource, patchToFace, word);
addToRunTimeSelectionTable(topoSetSource, patchToFace, istream); addToRunTimeSelectionTable(topoSetSource, patchToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, patchToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, patchToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
patchToFace,
word,
patch
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
patchToFace,
istream,
patch
);
} }
@ -93,7 +109,7 @@ Foam::patchToFace::patchToFace
const wordRe& patchName const wordRe& patchName
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
selectedPatches_(one(), patchName) selectedPatches_(one(), patchName)
{} {}
@ -104,7 +120,7 @@ Foam::patchToFace::patchToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
selectedPatches_() selectedPatches_()
{ {
// Look for 'patches' and 'patch', but accept 'name' as well // Look for 'patches' and 'patch', but accept 'name' as well
@ -123,7 +139,7 @@ Foam::patchToFace::patchToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
selectedPatches_(one(), wordRe(checkIs(is))) selectedPatches_(one(), wordRe(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::patchToFace Foam::patchToFace
Description Description
A topoSetSource to select faces based on usage in patches. A topoSetFaceSource to select faces based on usage in patches.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -46,7 +46,7 @@ SourceFiles
#ifndef patchToFace_H #ifndef patchToFace_H
#define patchToFace_H #define patchToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
#include "wordRes.H" #include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class patchToFace class patchToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -100,11 +100,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,22 @@ namespace Foam
defineTypeNameAndDebug(pointToFace, 0); defineTypeNameAndDebug(pointToFace, 0);
addToRunTimeSelectionTable(topoSetSource, pointToFace, word); addToRunTimeSelectionTable(topoSetSource, pointToFace, word);
addToRunTimeSelectionTable(topoSetSource, pointToFace, istream); addToRunTimeSelectionTable(topoSetSource, pointToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, pointToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, pointToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
pointToFace,
word,
point
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
pointToFace,
istream,
point
);
} }
@ -147,7 +163,7 @@ Foam::pointToFace::pointToFace
const pointAction option const pointAction option
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(setName), setName_(setName),
option_(option) option_(option)
{} {}
@ -159,9 +175,12 @@ Foam::pointToFace::pointToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), pointToFace
setName_(dict.get<word>("set")), (
option_(pointActionNames_.get("option", dict)) mesh,
dict.get<word>("set"),
pointActionNames_.get("option", dict)
)
{} {}
@ -171,7 +190,7 @@ Foam::pointToFace::pointToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
option_(pointActionNames_.read(checkIs(is))) option_(pointActionNames_.read(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::pointToFace Foam::pointToFace
Description Description
A topoSetSource to select faces based on use of points. A topoSetFaceSource to select faces based on use of points.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -42,7 +42,7 @@ SourceFiles
#ifndef pointToFace_H #ifndef pointToFace_H
#define pointToFace_H #define pointToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
#include "Enum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class pointToFace class pointToFace
: :
public topoSetSource public topoSetFaceSource
{ {
public: public:
@ -118,11 +118,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -40,6 +40,22 @@ namespace Foam
defineTypeNameAndDebug(regionToFace, 0); defineTypeNameAndDebug(regionToFace, 0);
addToRunTimeSelectionTable(topoSetSource, regionToFace, word); addToRunTimeSelectionTable(topoSetSource, regionToFace, word);
addToRunTimeSelectionTable(topoSetSource, regionToFace, istream); addToRunTimeSelectionTable(topoSetSource, regionToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, regionToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, regionToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
regionToFace,
word,
region
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
regionToFace,
istream,
region
);
} }
@ -180,7 +196,7 @@ Foam::regionToFace::regionToFace
const point& nearPoint const point& nearPoint
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(setName), setName_(setName),
nearPoint_(nearPoint) nearPoint_(nearPoint)
{} {}
@ -192,7 +208,7 @@ Foam::regionToFace::regionToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(dict.get<word>("set")), setName_(dict.get<word>("set")),
nearPoint_(dict.get<point>("nearPoint")) nearPoint_(dict.get<point>("nearPoint"))
{} {}
@ -204,7 +220,7 @@ Foam::regionToFace::regionToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
nearPoint_(checkIs(is)) nearPoint_(checkIs(is))
{} {}

View File

@ -25,8 +25,8 @@ Class
Foam::regionToFace Foam::regionToFace
Description Description
A topoSetSource to select faces belonging to topological connected region A topoSetFaceSource to select faces belonging to a topological connected
(that contains given point) region (that contains given point)
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -43,7 +43,7 @@ SourceFiles
#ifndef regionToFace_H #ifndef regionToFace_H
#define regionToFace_H #define regionToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
#include "indirectPrimitivePatch.H" #include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace Foam
class regionToFace class regionToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -113,11 +113,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "topoSetFaceSource.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(topoSetFaceSource, 0);
defineRunTimeSelectionTable(topoSetFaceSource, word);
defineRunTimeSelectionTable(topoSetFaceSource, istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoSetFaceSource::topoSetFaceSource(const polyMesh& mesh)
:
topoSetSource(mesh)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
)
{
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetFaceSource type "
<< sourceType << nl << nl
<< "Valid types :" << endl
<< wordConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<topoSetFaceSource>(cstrIter()(mesh, dict));
}
Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
)
{
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetFaceSource type "
<< sourceType << nl << nl
<< "Valid types :" << endl
<< istreamConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<topoSetFaceSource>(cstrIter()(mesh, is));
}
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::topoSetFaceSource
Description
Base class of a topoSet source for selecting faces.
SourceFiles
topoSetFaceSource.C
\*---------------------------------------------------------------------------*/
#ifndef topoSetFaceSource_H
#define topoSetFaceSource_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class topoSetFaceSource Declaration
\*---------------------------------------------------------------------------*/
class topoSetFaceSource
:
public topoSetSource
{
public:
//- Runtime type information
TypeName("topoSetFaceSource");
// Declare run-time constructor selection table
// For the dictionary constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetFaceSource,
word,
(
const polyMesh& mesh,
const dictionary& dict
),
(mesh, dict)
);
// For the Istream constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetFaceSource,
istream,
(
const polyMesh& mesh,
Istream& is
),
(mesh, is)
);
// Constructors
//- Construct from components
explicit topoSetFaceSource(const polyMesh& mesh);
// Selectors
//- Return a reference to the selected source type
static autoPtr<topoSetFaceSource> New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
);
//- Return a reference to the selected source type
static autoPtr<topoSetFaceSource> New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
);
//- Destructor
virtual ~topoSetFaceSource() = default;
// Member Functions
virtual topoSetSource::sourceType setType() const
{
return FACESETSOURCE;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(zoneToFace, 0); defineTypeNameAndDebug(zoneToFace, 0);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, word); addToRunTimeSelectionTable(topoSetSource, zoneToFace, word);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, istream); addToRunTimeSelectionTable(topoSetSource, zoneToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, zoneToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, zoneToFace, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
zoneToFace,
word,
zone
);
addNamedToRunTimeSelectionTable
(
topoSetFaceSource,
zoneToFace,
istream,
zone
);
} }
@ -93,7 +109,7 @@ Foam::zoneToFace::zoneToFace
const wordRe& zoneName const wordRe& zoneName
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
selectedZones_(one(), zoneName) selectedZones_(one(), zoneName)
{} {}
@ -104,7 +120,7 @@ Foam::zoneToFace::zoneToFace
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
selectedZones_() selectedZones_()
{ {
// Look for 'zones' and 'zone', but accept 'name' as well // Look for 'zones' and 'zone', but accept 'name' as well
@ -123,7 +139,7 @@ Foam::zoneToFace::zoneToFace
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetFaceSource(mesh),
selectedZones_(one(), wordRe(checkIs(is))) selectedZones_(one(), wordRe(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::zoneToFace Foam::zoneToFace
Description Description
A topoSetSource to select faces based on one of more faceZones. A topoSetFaceSource to select faces based on one of more faceZones.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -46,7 +46,7 @@ SourceFiles
#ifndef zoneToFace_H #ifndef zoneToFace_H
#define zoneToFace_H #define zoneToFace_H
#include "topoSetSource.H" #include "topoSetFaceSource.H"
#include "wordRes.H" #include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class zoneToFace class zoneToFace
: :
public topoSetSource public topoSetFaceSource
{ {
// Private data // Private data
@ -100,11 +100,6 @@ public:
// Member Functions // Member Functions
virtual topoSetSource::sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boxToPoint, 0); defineTypeNameAndDebug(boxToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, boxToPoint, word); addToRunTimeSelectionTable(topoSetSource, boxToPoint, word);
addToRunTimeSelectionTable(topoSetSource, boxToPoint, istream); addToRunTimeSelectionTable(topoSetSource, boxToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, boxToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, boxToPoint, istream);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
boxToPoint,
word,
box
);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
boxToPoint,
istream,
box
);
} }
@ -73,18 +89,29 @@ Foam::boxToPoint::boxToPoint
const treeBoundBoxList& bbs const treeBoundBoxList& bbs
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
bbs_(bbs) bbs_(bbs)
{} {}
Foam::boxToPoint::boxToPoint
(
const polyMesh& mesh,
treeBoundBoxList&& bbs
)
:
topoSetPointSource(mesh),
bbs_(std::move(bbs))
{}
Foam::boxToPoint::boxToPoint Foam::boxToPoint::boxToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
bbs_() bbs_()
{ {
// Look for 'boxes' or 'box' // Look for 'boxes' or 'box'
@ -102,8 +129,8 @@ Foam::boxToPoint::boxToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
bbs_(1, treeBoundBox(checkIs(is))) bbs_(one(), treeBoundBox(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::boxToPoint Foam::boxToPoint
Description Description
A topoSetSource to select points based on whether they are inside box. A topoSetPointSource to select points based on whether they are inside box.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -46,7 +46,7 @@ SourceFiles
#ifndef boxToPoint_H #ifndef boxToPoint_H
#define boxToPoint_H #define boxToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class boxToPoint class boxToPoint
: :
public topoSetSource public topoSetPointSource
{ {
// Private data // Private data
@ -84,12 +84,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components, copying bounding boxes
boxToPoint boxToPoint(const polyMesh& mesh, const treeBoundBoxList& bbs);
(
const polyMesh& mesh, //- Construct from components, moving bounding boxes
const treeBoundBoxList& bbs boxToPoint(const polyMesh& mesh, treeBoundBoxList&& bbs);
);
//- Construct from dictionary //- Construct from dictionary
boxToPoint(const polyMesh& mesh, const dictionary& dict); boxToPoint(const polyMesh& mesh, const dictionary& dict);
@ -104,11 +103,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(cellToPoint, 0); defineTypeNameAndDebug(cellToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, cellToPoint, word); addToRunTimeSelectionTable(topoSetSource, cellToPoint, word);
addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream); addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, cellToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, cellToPoint, istream);
} }
@ -90,7 +92,7 @@ Foam::cellToPoint::cellToPoint
const cellAction option const cellAction option
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
setName_(setName), setName_(setName),
option_(option) option_(option)
{} {}
@ -102,9 +104,12 @@ Foam::cellToPoint::cellToPoint
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), cellToPoint
setName_(dict.get<word>("set")), (
option_(cellActionNames_.get("option", dict)) mesh,
dict.get<word>("set"),
cellActionNames_.get("option", dict)
)
{} {}
@ -114,7 +119,7 @@ Foam::cellToPoint::cellToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
option_(cellActionNames_.read(checkIs(is))) option_(cellActionNames_.read(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::cellToPoint Foam::cellToPoint
Description Description
A topoSetSource to select points based on usage in cells. A topoSetPointSource to select points based on usage in cells.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -42,7 +42,7 @@ SourceFiles
#ifndef cellToPoint_H #ifndef cellToPoint_H
#define cellToPoint_H #define cellToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
#include "Enum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class cellToPoint class cellToPoint
: :
public topoSetSource public topoSetPointSource
{ {
public: public:
@ -114,11 +114,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(faceToPoint, 0); defineTypeNameAndDebug(faceToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, faceToPoint, word); addToRunTimeSelectionTable(topoSetSource, faceToPoint, word);
addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream); addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, faceToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, faceToPoint, istream);
} }
Foam::topoSetSource::addToUsageTable Foam::faceToPoint::usage_ Foam::topoSetSource::addToUsageTable Foam::faceToPoint::usage_
@ -84,7 +86,7 @@ Foam::faceToPoint::faceToPoint
const faceAction option const faceAction option
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
setName_(setName), setName_(setName),
option_(option) option_(option)
{} {}
@ -96,9 +98,12 @@ Foam::faceToPoint::faceToPoint
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), faceToPoint
setName_(dict.get<word>("set")), (
option_(faceActionNames_.get("option", dict)) mesh,
dict.get<word>("set"),
faceActionNames_.get("option", dict)
)
{} {}
@ -108,7 +113,7 @@ Foam::faceToPoint::faceToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
option_(faceActionNames_.read(checkIs(is))) option_(faceActionNames_.read(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::faceToPoint Foam::faceToPoint
Description Description
A topoSetSource to select points based on usage in faces. A topoSetPointSource to select points based on usage in faces.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -42,7 +42,7 @@ SourceFiles
#ifndef faceToPoint_H #ifndef faceToPoint_H
#define faceToPoint_H #define faceToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
#include "Enum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class faceToPoint class faceToPoint
: :
public topoSetSource public topoSetPointSource
{ {
public: public:
@ -114,11 +114,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(labelToPoint, 0); defineTypeNameAndDebug(labelToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, labelToPoint, word); addToRunTimeSelectionTable(topoSetSource, labelToPoint, word);
addToRunTimeSelectionTable(topoSetSource, labelToPoint, istream); addToRunTimeSelectionTable(topoSetSource, labelToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, labelToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, labelToPoint, istream);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
labelToPoint,
word,
label
);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
labelToPoint,
istream,
label
);
} }
@ -53,19 +69,29 @@ Foam::labelToPoint::labelToPoint
const labelList& labels const labelList& labels
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
labels_(labels) labels_(labels)
{} {}
Foam::labelToPoint::labelToPoint
(
const polyMesh& mesh,
labelList&& labels
)
:
topoSetPointSource(mesh),
labels_(std::move(labels))
{}
Foam::labelToPoint::labelToPoint Foam::labelToPoint::labelToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), labelToPoint(mesh, dict.get<labelList>("value"))
labels_(dict.get<labelList>("value"))
{} {}
@ -75,7 +101,7 @@ Foam::labelToPoint::labelToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
labels_(checkIs(is)) labels_(checkIs(is))
{ {
check(labels_, mesh.nPoints()); check(labels_, mesh.nPoints());

View File

@ -25,7 +25,7 @@ Class
Foam::labelToPoint Foam::labelToPoint
Description Description
A topoSetSource to select points given explicitly provided labels. A topoSetPointSource to select points given explicitly provided labels.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -41,7 +41,7 @@ SourceFiles
#ifndef labelToPoint_H #ifndef labelToPoint_H
#define labelToPoint_H #define labelToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class labelToPoint class labelToPoint
: :
public topoSetSource public topoSetPointSource
{ {
// Private data // Private data
@ -73,12 +73,11 @@ public:
// Constructors // Constructors
//- Copy construct from components //- Construct from components, copying labels
labelToPoint labelToPoint(const polyMesh& mesh, const labelList& labels);
(
const polyMesh& mesh, //- Construct from components, moving labels
const labelList& labels labelToPoint(const polyMesh& mesh, labelList&& labels);
);
//- Construct from dictionary //- Construct from dictionary
labelToPoint(const polyMesh& mesh, const dictionary& dict); labelToPoint(const polyMesh& mesh, const dictionary& dict);
@ -93,11 +92,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,22 @@ namespace Foam
defineTypeNameAndDebug(nearestToPoint, 0); defineTypeNameAndDebug(nearestToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, word); addToRunTimeSelectionTable(topoSetSource, nearestToPoint, word);
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, istream); addToRunTimeSelectionTable(topoSetSource, nearestToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, nearestToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, nearestToPoint, istream);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
nearestToPoint,
word,
nearest
);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
nearestToPoint,
istream,
nearest
);
} }
@ -106,19 +122,29 @@ Foam::nearestToPoint::nearestToPoint
const pointField& points const pointField& points
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
points_(points) points_(points)
{} {}
Foam::nearestToPoint::nearestToPoint
(
const polyMesh& mesh,
pointField&& points
)
:
topoSetPointSource(mesh),
points_(std::move(points))
{}
Foam::nearestToPoint::nearestToPoint Foam::nearestToPoint::nearestToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), nearestToPoint(mesh, dict.get<pointField>("points"))
points_(dict.get<pointField>("points"))
{} {}
@ -128,7 +154,7 @@ Foam::nearestToPoint::nearestToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
points_(checkIs(is)) points_(checkIs(is))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::nearestToPoint Foam::nearestToPoint
Description Description
A topoSetSource to select points nearest to points. A topoSetPointSource to select points nearest to points.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -41,7 +41,7 @@ SourceFiles
#ifndef nearestToPoint_H #ifndef nearestToPoint_H
#define nearestToPoint_H #define nearestToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class nearestToPoint class nearestToPoint
: :
public topoSetSource public topoSetPointSource
{ {
// Private data // Private data
@ -78,12 +78,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components, copying points
nearestToPoint nearestToPoint(const polyMesh& mesh, const pointField& points);
(
const polyMesh& mesh, //- Construct from components, moving points
const pointField& points nearestToPoint(const polyMesh& mesh, pointField&& points);
);
//- Construct from dictionary //- Construct from dictionary
nearestToPoint(const polyMesh& mesh, const dictionary& dict); nearestToPoint(const polyMesh& mesh, const dictionary& dict);
@ -98,11 +97,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -35,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(pointToPoint, 0); defineTypeNameAndDebug(pointToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, pointToPoint, word); addToRunTimeSelectionTable(topoSetSource, pointToPoint, word);
addToRunTimeSelectionTable(topoSetSource, pointToPoint, istream); addToRunTimeSelectionTable(topoSetSource, pointToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, pointToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, pointToPoint, istream);
} }
@ -54,7 +56,7 @@ Foam::pointToPoint::pointToPoint
const word& setName const word& setName
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
setName_(setName) setName_(setName)
{} {}
@ -65,8 +67,7 @@ Foam::pointToPoint::pointToPoint
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), pointToPoint(mesh, dict.get<word>("set"))
setName_(dict.get<word>("set"))
{} {}
@ -76,7 +77,7 @@ Foam::pointToPoint::pointToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
setName_(checkIs(is)) setName_(checkIs(is))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::pointToPoint Foam::pointToPoint
Description Description
A topoSetSource to select the points from another pointSet. A topoSetPointSource to select the points from another pointSet.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -41,7 +41,7 @@ SourceFiles
#ifndef pointToPoint_H #ifndef pointToPoint_H
#define pointToPoint_H #define pointToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class pointToPoint class pointToPoint
: :
public topoSetSource public topoSetPointSource
{ {
// Private data // Private data
@ -91,11 +91,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -37,6 +37,8 @@ namespace Foam
defineTypeNameAndDebug(surfaceToPoint, 0); defineTypeNameAndDebug(surfaceToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, word); addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, word);
addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, istream); addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, surfaceToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, surfaceToPoint, istream);
} }
@ -133,7 +135,7 @@ Foam::surfaceToPoint::surfaceToPoint
const bool includeOutside const bool includeOutside
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
surfName_(surfName), surfName_(surfName),
scale_(1.0), scale_(1.0),
nearDist_(nearDist), nearDist_(nearDist),
@ -150,7 +152,7 @@ Foam::surfaceToPoint::surfaceToPoint
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
surfName_(dict.get<fileName>("file").expand()), surfName_(dict.get<fileName>("file").expand()),
scale_(dict.lookupOrDefault<scalar>("scale", -1)), scale_(dict.lookupOrDefault<scalar>("scale", -1)),
nearDist_(dict.get<scalar>("nearDistance")), nearDist_(dict.get<scalar>("nearDistance")),
@ -167,7 +169,7 @@ Foam::surfaceToPoint::surfaceToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
surfName_(checkIs(is)), surfName_(checkIs(is)),
scale_(1.0), scale_(1.0),
nearDist_(readScalar(checkIs(is))), nearDist_(readScalar(checkIs(is))),

View File

@ -25,7 +25,7 @@ Class
Foam::surfaceToPoint Foam::surfaceToPoint
Description Description
A topoSetSource to selects points based on relation to surface. A topoSetPointSource to select points based on relation to surface.
Select based on: Select based on:
- distance to surface - distance to surface
@ -51,7 +51,7 @@ SourceFiles
#ifndef surfaceToPoint_H #ifndef surfaceToPoint_H
#define surfaceToPoint_H #define surfaceToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,7 +67,7 @@ class triSurfaceSearch;
class surfaceToPoint class surfaceToPoint
: :
public topoSetSource public topoSetPointSource
{ {
// Private data // Private data
@ -129,11 +129,6 @@ public:
// Member Functions // Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "topoSetPointSource.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(topoSetPointSource, 0);
defineRunTimeSelectionTable(topoSetPointSource, word);
defineRunTimeSelectionTable(topoSetPointSource, istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoSetPointSource::topoSetPointSource(const polyMesh& mesh)
:
topoSetSource(mesh)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetPointSource> Foam::topoSetPointSource::New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
)
{
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetPointSource type "
<< sourceType << nl << nl
<< "Valid types :" << endl
<< wordConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<topoSetPointSource>(cstrIter()(mesh, dict));
}
Foam::autoPtr<Foam::topoSetPointSource> Foam::topoSetPointSource::New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
)
{
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetPointSource type "
<< sourceType << nl << nl
<< "Valid types :" << endl
<< istreamConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<topoSetPointSource>(cstrIter()(mesh, is));
}
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::topoSetPointSource
Description
Base class of a topoSet source for selecting points.
SourceFiles
topoSetPointSource.C
\*---------------------------------------------------------------------------*/
#ifndef topoSetPointSource_H
#define topoSetPointSource_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class topoSetPointSource Declaration
\*---------------------------------------------------------------------------*/
class topoSetPointSource
:
public topoSetSource
{
public:
//- Runtime type information
TypeName("topoSetPointSource");
// Declare run-time constructor selection table
// For the dictionary constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetPointSource,
word,
(
const polyMesh& mesh,
const dictionary& dict
),
(mesh, dict)
);
// For the Istream constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetPointSource,
istream,
(
const polyMesh& mesh,
Istream& is
),
(mesh, is)
);
// Constructors
//- Construct from components
explicit topoSetPointSource(const polyMesh& mesh);
// Selectors
//- Return a reference to the selected source type
static autoPtr<topoSetPointSource> New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
);
//- Return a reference to the selected source type
static autoPtr<topoSetPointSource> New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
);
//- Destructor
virtual ~topoSetPointSource() = default;
// Member Functions
virtual topoSetSource::sourceType setType() const
{
return POINTSETSOURCE;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(zoneToPoint, 0); defineTypeNameAndDebug(zoneToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, word); addToRunTimeSelectionTable(topoSetSource, zoneToPoint, word);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, istream); addToRunTimeSelectionTable(topoSetSource, zoneToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, zoneToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, zoneToPoint, istream);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
zoneToPoint,
word,
zone
);
addNamedToRunTimeSelectionTable
(
topoSetPointSource,
zoneToPoint,
istream,
zone
);
} }
@ -93,7 +109,7 @@ Foam::zoneToPoint::zoneToPoint
const wordRe& zoneName const wordRe& zoneName
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
selectedZones_(one(), zoneName) selectedZones_(one(), zoneName)
{} {}
@ -104,7 +120,7 @@ Foam::zoneToPoint::zoneToPoint
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
selectedZones_() selectedZones_()
{ {
// Look for 'zones' and 'zone', but accept 'name' as well // Look for 'zones' and 'zone', but accept 'name' as well
@ -123,7 +139,7 @@ Foam::zoneToPoint::zoneToPoint
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetPointSource(mesh),
selectedZones_(one(), wordRe(checkIs(is))) selectedZones_(one(), wordRe(checkIs(is)))
{} {}

View File

@ -25,7 +25,7 @@ Class
Foam::zoneToPoint Foam::zoneToPoint
Description Description
A topoSetSource to select points based on one or more pointZones. A topoSetPointSource to select points based on one or more pointZones.
\heading Dictionary parameters \heading Dictionary parameters
\table \table
@ -46,7 +46,7 @@ SourceFiles
#ifndef zoneToPoint_H #ifndef zoneToPoint_H
#define zoneToPoint_H #define zoneToPoint_H
#include "topoSetSource.H" #include "topoSetPointSource.H"
#include "wordRes.H" #include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class zoneToPoint class zoneToPoint
: :
public topoSetSource public topoSetPointSource
{ {
// Private data // Private data
@ -100,11 +100,6 @@ public:
// Member Functions // Member Functions
virtual topoSetSource::sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet virtual void applyToSet
( (
const topoSetSource::setAction action, const topoSetSource::setAction action,

View File

@ -39,14 +39,13 @@ SourceFiles
#define topoSetSource_H #define topoSetSource_H
#include "pointField.H" #include "pointField.H"
#include "word.H"
#include "labelList.H" #include "labelList.H"
#include "faceList.H" #include "faceList.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "Enum.H" #include "Enum.H"
#include "HashTable.H" #include "HashTable.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,13 +34,25 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(regionsToCell, 0); defineTypeNameAndDebug(regionsToCell, 0);
addToRunTimeSelectionTable(topoSetSource, regionsToCell, word); addToRunTimeSelectionTable(topoSetSource, regionsToCell, word);
addToRunTimeSelectionTable(topoSetSource, regionsToCell, istream); addToRunTimeSelectionTable(topoSetSource, regionsToCell, istream);
addToRunTimeSelectionTable(topoSetCellSource, regionsToCell, word);
addToRunTimeSelectionTable(topoSetCellSource, regionsToCell, istream);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
regionsToCell,
word,
regions
);
addNamedToRunTimeSelectionTable
(
topoSetCellSource,
regionsToCell,
istream,
regions
);
} }
@ -112,12 +124,10 @@ Foam::boolList Foam::regionsToCell::findRegions
{ {
boolList keepRegion(cellRegion.nRegions(), false); boolList keepRegion(cellRegion.nRegions(), false);
forAll(insidePoints_, i) for (const point& insidePt : insidePoints_)
{ {
// Find the region containing the insidePoint // Find the region containing the insidePoint
const point& insidePt = insidePoints_[i];
//label cellI = mesh_.findCell(insidePt); //label cellI = mesh_.findCell(insidePt);
label cellI = -1; label cellI = -1;
forAll(selectedCell, index) forAll(selectedCell, index)
@ -204,10 +214,8 @@ void Foam::regionsToCell::shrinkRegions
const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
forAll(pbm, patchI) for (const polyPatch& pp : pbm)
{ {
const polyPatch& pp = pbm[patchI];
if (!pp.coupled() && !isA<emptyPolyPatch>(pp)) if (!pp.coupled() && !isA<emptyPolyPatch>(pp))
{ {
forAll(pp, i) forAll(pp, i)
@ -374,9 +382,9 @@ void Foam::regionsToCell::combine(topoSet& set, const bool add) const
cellSet subSet(mesh_, setName_); cellSet subSet(mesh_, setName_);
selectedCell = false; selectedCell = false;
forAllConstIter(cellSet, subSet, iter) for (const label celli : static_cast<const labelHashSet&>(subSet))
{ {
selectedCell[iter.key()] = true; selectedCell[celli] = true;
} }
} }
@ -401,7 +409,6 @@ void Foam::regionsToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::regionsToCell::regionsToCell Foam::regionsToCell::regionsToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -410,21 +417,20 @@ Foam::regionsToCell::regionsToCell
const label nErode const label nErode
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(setName), setName_(setName),
insidePoints_(insidePoints), insidePoints_(insidePoints),
nErode_(nErode) nErode_(nErode)
{} {}
// Construct from dictionary
Foam::regionsToCell::regionsToCell Foam::regionsToCell::regionsToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict const dictionary& dict
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(dict.lookupOrDefault<word>("set", "none")), setName_(dict.lookupOrDefault<word>("set", "none")),
insidePoints_ insidePoints_
( (
@ -432,30 +438,23 @@ Foam::regionsToCell::regionsToCell
? dict.lookup("insidePoints") ? dict.lookup("insidePoints")
: dict.lookup("insidePoint") : dict.lookup("insidePoint")
), ),
nErode_(dict.lookupOrDefault("nErode", 0)) nErode_(dict.lookupOrDefault<label>("nErode", 0))
{} {}
// Construct from Istream
Foam::regionsToCell::regionsToCell Foam::regionsToCell::regionsToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& is Istream& is
) )
: :
topoSetSource(mesh), topoSetCellSource(mesh),
setName_(checkIs(is)), setName_(checkIs(is)),
insidePoints_(checkIs(is)), insidePoints_(checkIs(is)),
nErode_(readLabel(checkIs(is))) nErode_(readLabel(checkIs(is)))
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionsToCell::~regionsToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regionsToCell::applyToSet void Foam::regionsToCell::applyToSet

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ SourceFiles
#ifndef regionsToCell_H #ifndef regionsToCell_H
#define regionsToCell_H #define regionsToCell_H
#include "topoSetSource.H" #include "topoSetCellSource.H"
#include "boolList.H" #include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,6 +57,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations
class regionSplit; class regionSplit;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -65,7 +66,7 @@ class regionSplit;
class regionsToCell class regionsToCell
: :
public topoSetSource public topoSetCellSource
{ {
// Private data // Private data
@ -98,7 +99,7 @@ class regionsToCell
( (
const bool verbose, const bool verbose,
const boolList& selectedCell, const boolList& selectedCell,
const regionSplit& const regionSplit& cellRegion
) const; ) const;
//- Unselect regions not containing a locationInMesh //- Unselect regions not containing a locationInMesh
@ -131,33 +132,23 @@ public:
); );
//- Construct from dictionary //- Construct from dictionary
regionsToCell regionsToCell(const polyMesh& mesh, const dictionary& dict);
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream //- Construct from Istream
regionsToCell regionsToCell(const polyMesh& mesh, Istream& is);
(
const polyMesh& mesh,
Istream&
);
//- Destructor //- Destructor
virtual ~regionsToCell(); virtual ~regionsToCell() = default;
// Member Functions // Member Functions
virtual sourceType setType() const virtual void applyToSet
{ (
return CELLSETSOURCE; const topoSetSource::setAction action,
} topoSet& set
) const;
virtual void applyToSet(const topoSetSource::setAction action, topoSet&)
const;
}; };

View File

@ -18,7 +18,7 @@ FoamFile
// Name of set to operate on // Name of set to operate on
name facesToBeRemoved; name facesToBeRemoved;
// One of clear/new/invert/add/delete|subset/list // One of (clear | new | invert | add | delete | subset | list)
action new; action new;
// Actions to apply to pointSet. These are all the topoSetSource's ending // Actions to apply to pointSet. These are all the topoSetSource's ending