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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -145,48 +145,54 @@ $(topoSets)/pointZoneSet.C
sets/topoSetSource/topoSetSource.C
cellSources = sets/cellSources
$(cellSources)/faceToCell/faceToCell.C
$(cellSources)/fieldToCell/fieldToCell.C
$(cellSources)/pointToCell/pointToCell.C
$(cellSources)/shapeToCell/shapeToCell.C
$(cellSources)/topoSetCellSource/topoSetCellSource.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)/rotatedBoxToCell/rotatedBoxToCell.C
$(cellSources)/labelToCell/labelToCell.C
$(cellSources)/surfaceToCell/surfaceToCell.C
$(cellSources)/cellToCell/cellToCell.C
$(cellSources)/nearestToCell/nearestToCell.C
$(cellSources)/nbrToCell/nbrToCell.C
$(cellSources)/zoneToCell/zoneToCell.C
$(cellSources)/shapeToCell/shapeToCell.C
$(cellSources)/sphereToCell/sphereToCell.C
$(cellSources)/cylinderToCell/cylinderToCell.C
$(cellSources)/faceZoneToCell/faceZoneToCell.C
$(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C
$(cellSources)/surfaceToCell/surfaceToCell.C
$(cellSources)/targetVolumeToCell/targetVolumeToCell.C
$(cellSources)/zoneToCell/zoneToCell.C
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)/labelToFace/labelToFace.C
$(faceSources)/cellToFace/cellToFace.C
$(faceSources)/noneToFace/noneToFace.C
$(faceSources)/normalToFace/normalToFace.C
$(faceSources)/pointToFace/pointToFace.C
$(faceSources)/patchToFace/patchToFace.C
$(faceSources)/boundaryToFace/boundaryToFace.C
$(faceSources)/zoneToFace/zoneToFace.C
$(faceSources)/boxToFace/boxToFace.C
$(faceSources)/pointToFace/pointToFace.C
$(faceSources)/regionToFace/regionToFace.C
$(faceSources)/cylinderToFace/cylinderToFace.C
$(faceSources)/cylinderAnnulusToFace/cylinderAnnulusToFace.C
$(faceSources)/zoneToFace/zoneToFace.C
pointSources = sets/pointSources
$(pointSources)/labelToPoint/labelToPoint.C
$(pointSources)/pointToPoint/pointToPoint.C
$(pointSources)/topoSetPointSource/topoSetPointSource.C
$(pointSources)/boxToPoint/boxToPoint.C
$(pointSources)/cellToPoint/cellToPoint.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)/zoneToPoint/zoneToPoint.C
$(pointSources)/nearestToPoint/nearestToPoint.C
faceZoneSources = sets/faceZoneSources
$(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boxToCell, 0);
addToRunTimeSelectionTable(topoSetSource, boxToCell, word);
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
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
bbs_(bbs)
{}
Foam::boxToCell::boxToCell
(
const polyMesh& mesh,
treeBoundBoxList&& bbs
)
:
topoSetCellSource(mesh),
bbs_(std::move(bbs))
{}
Foam::boxToCell::boxToCell
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
bbs_()
{
// Look for 'boxes' or 'box'
@ -102,8 +129,8 @@ Foam::boxToCell::boxToCell
Istream& is
)
:
topoSetSource(mesh),
bbs_(1, treeBoundBox(checkIs(is)))
topoSetCellSource(mesh),
bbs_(one(), treeBoundBox(checkIs(is)))
{}

View File

@ -25,7 +25,7 @@ Class
Foam::boxToCell
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
\table
@ -46,7 +46,7 @@ SourceFiles
#ifndef boxToCell_H
#define boxToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
#include "treeBoundBoxList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class boxToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -83,12 +83,11 @@ public:
// Constructors
//- Construct from components
boxToCell
(
const polyMesh& mesh,
const treeBoundBoxList& bbs
);
//- Construct from components, copying bounding boxes
boxToCell(const polyMesh& mesh, const treeBoundBoxList& bbs);
//- Construct from components, moving bounding boxes
boxToCell(const polyMesh& mesh, treeBoundBoxList&& bbs);
//- Construct from dictionary
boxToCell(const polyMesh& mesh, const dictionary& dict);
@ -103,11 +102,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderAnnulusToCell
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.
\heading Dictionary parameters
@ -45,7 +45,7 @@ SourceFiles
#ifndef cylinderAnnulusToCell_H
#define cylinderAnnulusToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ namespace Foam
class cylinderAnnulusToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -99,7 +99,7 @@ public:
const point& point1,
const point& point2,
const scalar outerRadius,
const scalar innerRadius
const scalar innerRadius = 0
);
//- Construct from dictionary
@ -115,11 +115,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderToCell
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
\table
@ -43,7 +43,7 @@ SourceFiles
#ifndef cylinderToCell_H
#define cylinderToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class cylinderToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -109,11 +109,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::faceToCell
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
\table
@ -42,7 +42,7 @@ SourceFiles
#ifndef faceToCell_H
#define faceToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class faceToCell
:
public topoSetSource
public topoSetCellSource
{
public:
//- Enumeration defining the valid options
@ -118,11 +118,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::nbrToCell
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)
\heading Dictionary parameters
@ -42,7 +42,7 @@ SourceFiles
#ifndef nbrToCell_H
#define nbrToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +55,7 @@ namespace Foam
class nbrToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -81,11 +81,7 @@ public:
// Constructors
//- Construct from components
nbrToCell
(
const polyMesh& mesh,
const label minNbrs
);
nbrToCell(const polyMesh& mesh, const label minNbrs);
//- Construct from dictionary
nbrToCell(const polyMesh& mesh, const dictionary& dict);
@ -100,11 +96,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::rotatedBoxToCell
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?).
Box defined as origin and i,j,k vectors.
@ -55,7 +55,7 @@ SourceFiles
#ifndef rotatedBoxToCell_H
#define rotatedBoxToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
#include "treeBoundBox.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ namespace Foam
class rotatedBoxToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -120,11 +120,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::shapeToCell
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
and splitHex with 10 degrees feature angle.
@ -44,7 +44,7 @@ SourceFiles
#ifndef shapeToCell_H
#define shapeToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace Foam
class shapeToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -90,11 +90,7 @@ public:
// Constructors
//- Construct from components
shapeToCell
(
const polyMesh& mesh,
const word& shapeName
);
shapeToCell(const polyMesh& mesh, const word& shapeName);
//- Construct from dictionary
shapeToCell(const polyMesh& mesh, const dictionary& dict);
@ -109,11 +105,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(sphereToCell, 0);
addToRunTimeSelectionTable(topoSetSource, sphereToCell, word);
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
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
origin_(origin),
radius_(radius)
{}
@ -99,7 +115,7 @@ Foam::sphereToCell::sphereToCell
Istream& is
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
origin_(checkIs(is)),
radius_(readScalar(checkIs(is)))
{}

View File

@ -25,7 +25,7 @@ Class
Foam::sphereToCell
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
\table
@ -43,7 +43,7 @@ SourceFiles
#ifndef sphereToCell_H
#define sphereToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class sphereToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -105,11 +105,6 @@ public:
// Member Functions
virtual topoSetSource::sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -40,6 +40,8 @@ namespace Foam
defineTypeNameAndDebug(surfaceToCell, 0);
addToRunTimeSelectionTable(topoSetSource, surfaceToCell, word);
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>::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 *iter; // Return cached value
}
else
{
pointIndexHit inter = querySurf.nearest(pt, span);
// Triangle label (can be -1)
label triI = inter.index();
const label trii = inter.index();
// 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;
if (useSurfaceOrientation_ && (includeInside_ || includeOutside_))
{
const meshSearch queryMesh(mesh_);
@ -364,7 +362,7 @@ Foam::surfaceToCell::surfaceToCell
const scalar curvature
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
surfName_(surfName),
outsidePoints_(outsidePoints),
includeCut_(includeCut),
@ -396,7 +394,7 @@ Foam::surfaceToCell::surfaceToCell
const scalar curvature
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
surfName_(surfName),
outsidePoints_(outsidePoints),
includeCut_(includeCut),
@ -419,7 +417,7 @@ Foam::surfaceToCell::surfaceToCell
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
surfName_(dict.get<fileName>("file").expand()),
outsidePoints_(dict.get<pointField>("outsidePoints")),
includeCut_(dict.get<bool>("includeCut")),
@ -452,7 +450,7 @@ Foam::surfaceToCell::surfaceToCell
Istream& is
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
surfName_(checkIs(is)),
outsidePoints_(checkIs(is)),
includeCut_(readBool(checkIs(is))),

View File

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

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::targetVolumeToCell
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.
\heading Dictionary parameters
@ -44,7 +44,7 @@ SourceFiles
#ifndef targetVolumeToCell_H
#define targetVolumeToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ class bitSet;
class targetVolumeToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -105,7 +105,8 @@ public:
(
const polyMesh& mesh,
const scalar vol,
const vector& normal
const vector& normal,
const word& maskSetName = ""
);
//- Construct from dictionary
@ -121,11 +122,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
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);
addToRunTimeSelectionTable(topoSetSource, zoneToCell, word);
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
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
selectedZones_(one(), zoneName)
{}
@ -104,7 +120,7 @@ Foam::zoneToCell::zoneToCell
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
selectedZones_()
{
// Look for 'zones' and 'zone', but accept 'name' as well
@ -123,7 +139,7 @@ Foam::zoneToCell::zoneToCell
Istream& is
)
:
topoSetSource(mesh),
topoSetCellSource(mesh),
selectedZones_(one(), wordRe(checkIs(is)))
{}

View File

@ -25,7 +25,7 @@ Class
Foam::zoneToCell
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
\table
@ -46,7 +46,7 @@ SourceFiles
#ifndef zoneToCell_H
#define zoneToCell_H
#include "topoSetSource.H"
#include "topoSetCellSource.H"
#include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class zoneToCell
:
public topoSetSource
public topoSetCellSource
{
// Private data
@ -100,11 +100,6 @@ public:
// Member Functions
virtual topoSetSource::sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

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

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boundaryToFace, 0);
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
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)
:
topoSetSource(mesh)
topoSetFaceSource(mesh)
{}
@ -75,7 +91,7 @@ Foam::boundaryToFace::boundaryToFace
const dictionary&
)
:
topoSetSource(mesh)
topoSetFaceSource(mesh)
{}
@ -85,7 +101,7 @@ Foam::boundaryToFace::boundaryToFace
Istream&
)
:
topoSetSource(mesh)
topoSetFaceSource(mesh)
{}

View File

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

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boxToFace, 0);
addToRunTimeSelectionTable(topoSetSource, boxToFace, word);
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
)
:
topoSetSource(mesh),
topoSetFaceSource(mesh),
bbs_(bbs)
{}
Foam::boxToFace::boxToFace
(
const polyMesh& mesh,
treeBoundBoxList&& bbs
)
:
topoSetFaceSource(mesh),
bbs_(std::move(bbs))
{}
Foam::boxToFace::boxToFace
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceSource(mesh),
bbs_()
{
// Look for 'boxes' or 'box'
@ -102,8 +129,8 @@ Foam::boxToFace::boxToFace
Istream& is
)
:
topoSetSource(mesh),
bbs_(1, treeBoundBox(checkIs(is)))
topoSetFaceSource(mesh),
bbs_(one(), treeBoundBox(checkIs(is)))
{}

View File

@ -25,7 +25,7 @@ Class
Foam::boxToFace
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
\table
@ -46,7 +46,7 @@ SourceFiles
#ifndef boxToFace_H
#define boxToFace_H
#include "topoSetSource.H"
#include "topoSetFaceSource.H"
#include "treeBoundBoxList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class boxToFace
:
public topoSetSource
public topoSetFaceSource
{
// Private data
@ -83,12 +83,11 @@ public:
// Constructors
//- Construct from components
boxToFace
(
const polyMesh& mesh,
const treeBoundBoxList& bbs
);
//- Construct from components, copying bounding boxes
boxToFace(const polyMesh& mesh, const treeBoundBoxList& bbs);
//- Construct from components, moving bounding boxes
boxToFace(const polyMesh& mesh, treeBoundBoxList&& bbs);
//- Construct from dictionary
boxToFace(const polyMesh& mesh, const dictionary& dict);
@ -103,11 +102,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::cellToFace
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
on 'both' sides.
@ -48,7 +48,7 @@ SourceFiles
#ifndef cellToFace_H
#define cellToFace_H
#include "topoSetSource.H"
#include "topoSetFaceSource.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,7 +62,7 @@ namespace Foam
class cellToFace
:
public topoSetSource
public topoSetFaceSource
{
public:
//- Enumeration defining the valid options
@ -121,11 +121,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderAnnulusToFace
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.
\heading Dictionary parameters
@ -45,7 +45,7 @@ SourceFiles
#ifndef cylinderAnnulusToFace_H
#define cylinderAnnulusToFace_H
#include "topoSetSource.H"
#include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ namespace Foam
class cylinderAnnulusToFace
:
public topoSetSource
public topoSetFaceSource
{
// Private data
@ -115,11 +115,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::cylinderToFace
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
\table
@ -43,7 +43,7 @@ SourceFiles
#ifndef cylinderToFace_H
#define cylinderToFace_H
#include "topoSetSource.H"
#include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
class cylinderToFace
:
public topoSetSource
public topoSetFaceSource
{
// Private data
@ -109,11 +109,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::faceToFace
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
\table
@ -41,7 +41,7 @@ SourceFiles
#ifndef faceToFace_H
#define faceToFace_H
#include "topoSetSource.H"
#include "topoSetFaceSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
class faceToFace
:
public topoSetSource
public topoSetFaceSource
{
// Private data
@ -72,11 +72,7 @@ public:
// Constructors
//- Construct from components
faceToFace
(
const polyMesh& mesh,
const word& setName
);
faceToFace(const polyMesh& mesh, const word& setName);
//- Construct from dictionary
faceToFace(const polyMesh& mesh, const dictionary& dict);
@ -91,11 +87,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

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

View File

@ -35,6 +35,22 @@ namespace Foam
defineTypeNameAndDebug(normalToFace, 0);
addToRunTimeSelectionTable(topoSetSource, normalToFace, word);
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
)
:
topoSetSource(mesh),
topoSetFaceSource(mesh),
normal_(normal),
tol_(tol)
{
@ -83,9 +99,12 @@ Foam::normalToFace::normalToFace
Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
:
topoSetSource(mesh),
normal_(dict.get<vector>("normal")),
tol_(dict.get<scalar>("cos"))
normalToFace
(
mesh,
dict.get<vector>("normal"),
dict.get<scalar>("cos")
)
{
setNormal();
}
@ -93,7 +112,7 @@ Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is)
:
topoSetSource(mesh),
topoSetFaceSource(mesh),
normal_(checkIs(is)),
tol_(readScalar(checkIs(is)))
{
@ -131,10 +150,8 @@ void Foam::normalToFace::applyToSet
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]);
if (mag(1 - (n & normal_)) < tol_)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,8 +25,8 @@ Class
Foam::regionToFace
Description
A topoSetSource to select faces belonging to topological connected region
(that contains given point)
A topoSetFaceSource to select faces belonging to a topological connected
region (that contains given point)
\heading Dictionary parameters
\table
@ -43,7 +43,7 @@ SourceFiles
#ifndef regionToFace_H
#define regionToFace_H
#include "topoSetSource.H"
#include "topoSetFaceSource.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace Foam
class regionToFace
:
public topoSetSource
public topoSetFaceSource
{
// Private data
@ -113,11 +113,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet
(
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);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, word);
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
)
:
topoSetSource(mesh),
topoSetFaceSource(mesh),
selectedZones_(one(), zoneName)
{}
@ -104,7 +120,7 @@ Foam::zoneToFace::zoneToFace
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceSource(mesh),
selectedZones_()
{
// Look for 'zones' and 'zone', but accept 'name' as well
@ -123,7 +139,7 @@ Foam::zoneToFace::zoneToFace
Istream& is
)
:
topoSetSource(mesh),
topoSetFaceSource(mesh),
selectedZones_(one(), wordRe(checkIs(is)))
{}

View File

@ -25,7 +25,7 @@ Class
Foam::zoneToFace
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
\table
@ -46,7 +46,7 @@ SourceFiles
#ifndef zoneToFace_H
#define zoneToFace_H
#include "topoSetSource.H"
#include "topoSetFaceSource.H"
#include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class zoneToFace
:
public topoSetSource
public topoSetFaceSource
{
// Private data
@ -100,11 +100,6 @@ public:
// Member Functions
virtual topoSetSource::sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -34,6 +34,22 @@ namespace Foam
defineTypeNameAndDebug(boxToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, boxToPoint, word);
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
)
:
topoSetSource(mesh),
topoSetPointSource(mesh),
bbs_(bbs)
{}
Foam::boxToPoint::boxToPoint
(
const polyMesh& mesh,
treeBoundBoxList&& bbs
)
:
topoSetPointSource(mesh),
bbs_(std::move(bbs))
{}
Foam::boxToPoint::boxToPoint
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetPointSource(mesh),
bbs_()
{
// Look for 'boxes' or 'box'
@ -102,8 +129,8 @@ Foam::boxToPoint::boxToPoint
Istream& is
)
:
topoSetSource(mesh),
bbs_(1, treeBoundBox(checkIs(is)))
topoSetPointSource(mesh),
bbs_(one(), treeBoundBox(checkIs(is)))
{}

View File

@ -25,7 +25,7 @@ Class
Foam::boxToPoint
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
\table
@ -46,7 +46,7 @@ SourceFiles
#ifndef boxToPoint_H
#define boxToPoint_H
#include "topoSetSource.H"
#include "topoSetPointSource.H"
#include "treeBoundBoxList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class boxToPoint
:
public topoSetSource
public topoSetPointSource
{
// Private data
@ -84,12 +84,11 @@ public:
// Constructors
//- Construct from components
boxToPoint
(
const polyMesh& mesh,
const treeBoundBoxList& bbs
);
//- Construct from components, copying bounding boxes
boxToPoint(const polyMesh& mesh, const treeBoundBoxList& bbs);
//- Construct from components, moving bounding boxes
boxToPoint(const polyMesh& mesh, treeBoundBoxList&& bbs);
//- Construct from dictionary
boxToPoint(const polyMesh& mesh, const dictionary& dict);
@ -104,11 +103,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ Class
Foam::surfaceToPoint
Description
A topoSetSource to selects points based on relation to surface.
A topoSetPointSource to select points based on relation to surface.
Select based on:
- distance to surface
@ -51,7 +51,7 @@ SourceFiles
#ifndef surfaceToPoint_H
#define surfaceToPoint_H
#include "topoSetSource.H"
#include "topoSetPointSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,7 +67,7 @@ class triSurfaceSearch;
class surfaceToPoint
:
public topoSetSource
public topoSetPointSource
{
// Private data
@ -129,11 +129,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet
(
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);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, word);
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
)
:
topoSetSource(mesh),
topoSetPointSource(mesh),
selectedZones_(one(), zoneName)
{}
@ -104,7 +120,7 @@ Foam::zoneToPoint::zoneToPoint
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetPointSource(mesh),
selectedZones_()
{
// Look for 'zones' and 'zone', but accept 'name' as well
@ -123,7 +139,7 @@ Foam::zoneToPoint::zoneToPoint
Istream& is
)
:
topoSetSource(mesh),
topoSetPointSource(mesh),
selectedZones_(one(), wordRe(checkIs(is)))
{}

View File

@ -25,7 +25,7 @@ Class
Foam::zoneToPoint
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
\table
@ -46,7 +46,7 @@ SourceFiles
#ifndef zoneToPoint_H
#define zoneToPoint_H
#include "topoSetSource.H"
#include "topoSetPointSource.H"
#include "wordRes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace Foam
class zoneToPoint
:
public topoSetSource
public topoSetPointSource
{
// Private data
@ -100,11 +100,6 @@ public:
// Member Functions
virtual topoSetSource::sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

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

View File

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

View File

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

View File

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