From 6e5852edb5f03ec59531cdffda0f99ed14325b29 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Tue, 30 Oct 2018 12:01:36 +0000 Subject: [PATCH] ENH: distinguish between cell/face/point topoSetSource (#1060) - add intermediate classes topoSetCellSource, topoSetFaceSource, topoSetPointSource and corresponding New() factories --- .../badQualityToCell/badQualityToCell.C | 43 +++--- .../badQualityToCell/badQualityToCell.H | 27 +--- .../badQualityToFace/badQualityToFace.C | 43 +++--- .../badQualityToFace/badQualityToFace.H | 15 +- ...irectionalPressureGradientExplicitSource.H | 4 +- .../meanVelocityForce/meanVelocityForce.H | 2 - src/meshTools/Make/files | 52 ++++--- .../sets/cellSources/boxToCell/boxToCell.C | 35 ++++- .../sets/cellSources/boxToCell/boxToCell.H | 22 ++- .../sets/cellSources/cellToCell/cellToCell.C | 13 +- .../sets/cellSources/cellToCell/cellToCell.H | 17 +-- .../cylinderAnnulusToCell.C | 43 +++++- .../cylinderAnnulusToCell.H | 13 +- .../cylinderToCell/cylinderToCell.C | 31 +++- .../cylinderToCell/cylinderToCell.H | 11 +- .../sets/cellSources/faceToCell/faceToCell.C | 15 +- .../sets/cellSources/faceToCell/faceToCell.H | 11 +- .../faceZoneToCell/faceZoneToCell.C | 8 +- .../faceZoneToCell/faceZoneToCell.H | 11 +- .../cellSources/fieldToCell/fieldToCell.C | 31 +++- .../cellSources/fieldToCell/fieldToCell.H | 11 +- .../cellSources/labelToCell/labelToCell.C | 34 ++++- .../cellSources/labelToCell/labelToCell.H | 22 ++- .../sets/cellSources/nbrToCell/nbrToCell.C | 23 ++- .../sets/cellSources/nbrToCell/nbrToCell.H | 17 +-- .../cellSources/nearestToCell/nearestToCell.C | 38 ++++- .../cellSources/nearestToCell/nearestToCell.H | 22 ++- .../cellSources/pointToCell/pointToCell.C | 15 +- .../cellSources/pointToCell/pointToCell.H | 11 +- .../cellSources/regionToCell/regionToCell.C | 8 +- .../cellSources/regionToCell/regionToCell.H | 21 ++- .../rotatedBoxToCell/rotatedBoxToCell.C | 33 ++++- .../rotatedBoxToCell/rotatedBoxToCell.H | 11 +- .../cellSources/shapeToCell/shapeToCell.C | 17 +-- .../cellSources/shapeToCell/shapeToCell.H | 17 +-- .../cellSources/sphereToCell/sphereToCell.C | 20 ++- .../cellSources/sphereToCell/sphereToCell.H | 11 +- .../cellSources/surfaceToCell/surfaceToCell.C | 34 +++-- .../cellSources/surfaceToCell/surfaceToCell.H | 11 +- .../targetVolumeToCell/targetVolumeToCell.C | 40 ++++-- .../targetVolumeToCell/targetVolumeToCell.H | 14 +- .../topoSetCellSource/topoSetCellSource.C | 95 +++++++++++++ .../topoSetCellSource/topoSetCellSource.H | 133 ++++++++++++++++++ .../sets/cellSources/zoneToCell/zoneToCell.C | 22 ++- .../sets/cellSources/zoneToCell/zoneToCell.H | 11 +- .../setToCellZone/setToCellZone.C | 4 +- .../setToCellZone/setToCellZone.H | 6 +- .../boundaryToFace/boundaryToFace.C | 22 ++- .../boundaryToFace/boundaryToFace.H | 11 +- .../sets/faceSources/boxToFace/boxToFace.C | 35 ++++- .../sets/faceSources/boxToFace/boxToFace.H | 22 ++- .../sets/faceSources/cellToFace/cellToFace.C | 15 +- .../sets/faceSources/cellToFace/cellToFace.H | 11 +- .../cylinderAnnulusToFace.C | 43 +++++- .../cylinderAnnulusToFace.H | 11 +- .../cylinderToFace/cylinderToFace.C | 31 +++- .../cylinderToFace/cylinderToFace.H | 11 +- .../sets/faceSources/faceToFace/faceToFace.C | 13 +- .../sets/faceSources/faceToFace/faceToFace.H | 17 +-- .../faceSources/labelToFace/labelToFace.C | 38 ++++- .../faceSources/labelToFace/labelToFace.H | 22 ++- .../faceSources/normalToFace/normalToFace.C | 33 +++-- .../faceSources/normalToFace/normalToFace.H | 11 +- .../faceSources/patchToFace/patchToFace.C | 22 ++- .../faceSources/patchToFace/patchToFace.H | 11 +- .../faceSources/pointToFace/pointToFace.C | 29 +++- .../faceSources/pointToFace/pointToFace.H | 11 +- .../faceSources/regionToFace/regionToFace.C | 22 ++- .../faceSources/regionToFace/regionToFace.H | 13 +- .../topoSetFaceSource/topoSetFaceSource.C | 95 +++++++++++++ .../topoSetFaceSource/topoSetFaceSource.H | 133 ++++++++++++++++++ .../sets/faceSources/zoneToFace/zoneToFace.C | 22 ++- .../sets/faceSources/zoneToFace/zoneToFace.H | 11 +- .../setToFaceZone/setToFaceZone.H | 4 +- .../setsToFaceZone/setsToFaceZone.H | 8 +- .../sets/pointSources/boxToPoint/boxToPoint.C | 35 ++++- .../sets/pointSources/boxToPoint/boxToPoint.H | 22 ++- .../pointSources/cellToPoint/cellToPoint.C | 15 +- .../pointSources/cellToPoint/cellToPoint.H | 11 +- .../pointSources/faceToPoint/faceToPoint.C | 15 +- .../pointSources/faceToPoint/faceToPoint.H | 11 +- .../pointSources/labelToPoint/labelToPoint.C | 34 ++++- .../pointSources/labelToPoint/labelToPoint.H | 22 ++- .../nearestToPoint/nearestToPoint.C | 34 ++++- .../nearestToPoint/nearestToPoint.H | 22 ++- .../pointSources/pointToPoint/pointToPoint.C | 9 +- .../pointSources/pointToPoint/pointToPoint.H | 11 +- .../surfaceToPoint/surfaceToPoint.C | 8 +- .../surfaceToPoint/surfaceToPoint.H | 11 +- .../topoSetPointSource/topoSetPointSource.C | 95 +++++++++++++ .../topoSetPointSource/topoSetPointSource.H | 133 ++++++++++++++++++ .../pointSources/zoneToPoint/zoneToPoint.C | 22 ++- .../pointSources/zoneToPoint/zoneToPoint.H | 11 +- .../sets/topoSetSource/topoSetSource.H | 3 +- src/overset/regionsToCell/regionsToCell.C | 57 ++++---- src/overset/regionsToCell/regionsToCell.H | 35 ++--- .../foamyHexMesh/flange/system/faceSetDict | 2 +- 97 files changed, 1754 insertions(+), 739 deletions(-) create mode 100644 src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.C create mode 100644 src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H create mode 100644 src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.C create mode 100644 src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H create mode 100644 src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.C create mode 100644 src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H diff --git a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C index c31e2606b9..81788a5703 100644 --- a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C +++ b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C @@ -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); - + 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 diff --git a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.H b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.H index 98f6be7a19..942ace2c4a 100644 --- a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.H +++ b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.H @@ -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; }; diff --git a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C index dd76d0b0c8..d98621d524 100644 --- a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C +++ b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C @@ -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); - + 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 diff --git a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.H b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.H index e48fe2e030..92ce3a058a 100644 --- a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.H +++ b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.H @@ -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; }; diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H index e5831682df..8741de56d1 100644 --- a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H @@ -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" diff --git a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H b/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H index fac0740aed..051888aa9b 100644 --- a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H +++ b/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H @@ -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" diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index 58c3fa156f..4fcdeafb7a 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -144,49 +144,55 @@ $(topoSets)/pointZoneSet.C sets/topoSetSource/topoSetSource.C -cellSources = sets/cellSources +cellSources = sets/cellSources +$(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)/shapeToCell/shapeToCell.C -$(cellSources)/boxToCell/boxToCell.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 diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C index 377a36d455..5d4b7bcd4c 100644 --- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C +++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C @@ -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))) {} diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H index ce69cda4eb..09a7920f11 100644 --- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H +++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/cellToCell/cellToCell.C b/src/meshTools/sets/cellSources/cellToCell/cellToCell.C index 6761dab811..565ad65e34 100644 --- a/src/meshTools/sets/cellSources/cellToCell/cellToCell.C +++ b/src/meshTools/sets/cellSources/cellToCell/cellToCell.C @@ -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)) {} diff --git a/src/meshTools/sets/cellSources/cellToCell/cellToCell.H b/src/meshTools/sets/cellSources/cellToCell/cellToCell.H index 23fb8be3d8..2b619f12f0 100644 --- a/src/meshTools/sets/cellSources/cellToCell/cellToCell.H +++ b/src/meshTools/sets/cellSources/cellToCell/cellToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C b/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C index 6a88cfb80e..033b7602ce 100644 --- a/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C +++ b/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C @@ -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))), diff --git a/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.H b/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.H index af8bd0bad2..9c02f64dfd 100644 --- a/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.H +++ b/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C index a8ceeb408b..910868d171 100644 --- a/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C +++ b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C @@ -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))) diff --git a/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.H b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.H index 0d3db7640a..f87bd7dbdc 100644 --- a/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.H +++ b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C index 5499aaa963..5966d80fa2 100644 --- a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C +++ b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C @@ -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))) {} diff --git a/src/meshTools/sets/cellSources/faceToCell/faceToCell.H b/src/meshTools/sets/cellSources/faceToCell/faceToCell.H index ced05a8f4e..64e85b3817 100644 --- a/src/meshTools/sets/cellSources/faceToCell/faceToCell.H +++ b/src/meshTools/sets/cellSources/faceToCell/faceToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C index 68c81f2267..8079cd72d0 100644 --- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C +++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C @@ -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))) {} diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H index 33f24e706b..e082198271 100644 --- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H +++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C index 150eeb2ab9..c12bbab2c4 100644 --- a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C +++ b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C @@ -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))) diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.H b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.H index c09e2773c8..6b596f166e 100644 --- a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.H +++ b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/labelToCell/labelToCell.C b/src/meshTools/sets/cellSources/labelToCell/labelToCell.C index 13fda7b6d9..a314644f5e 100644 --- a/src/meshTools/sets/cellSources/labelToCell/labelToCell.C +++ b/src/meshTools/sets/cellSources/labelToCell/labelToCell.C @@ -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()); diff --git a/src/meshTools/sets/cellSources/labelToCell/labelToCell.H b/src/meshTools/sets/cellSources/labelToCell/labelToCell.H index ca9c12e1ff..d9f1c06b3c 100644 --- a/src/meshTools/sets/cellSources/labelToCell/labelToCell.H +++ b/src/meshTools/sets/cellSources/labelToCell/labelToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C b/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C index e4c55b966b..7201163abc 100644 --- a/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C +++ b/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C @@ -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))) {} diff --git a/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.H b/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.H index 7bd4801bd0..43f434cc80 100644 --- a/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.H +++ b/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C b/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C index 03779fd61d..1894e5ec82 100644 --- a/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C +++ b/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C @@ -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)) {} diff --git a/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.H b/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.H index e2b393f5e1..f95f0118ed 100644 --- a/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.H +++ b/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C index 90e99bc112..03fa90f113 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C @@ -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))) {} diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H b/src/meshTools/sets/cellSources/pointToCell/pointToCell.H index 2778f134cd..c61f8997af 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C b/src/meshTools/sets/cellSources/regionToCell/regionToCell.C index 8cbd157bf7..4d5b22b4c2 100644 --- a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C +++ b/src/meshTools/sets/cellSources/regionToCell/regionToCell.C @@ -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))) diff --git a/src/meshTools/sets/cellSources/regionToCell/regionToCell.H b/src/meshTools/sets/cellSources/regionToCell/regionToCell.H index 7324aba1fa..dd699df550 100644 --- a/src/meshTools/sets/cellSources/regionToCell/regionToCell.H +++ b/src/meshTools/sets/cellSources/regionToCell/regionToCell.H @@ -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 @@ -43,10 +43,10 @@ Description \heading Dictionary parameters \table - 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 | '' + 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 | "" \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, diff --git a/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C b/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C index 581214ba54..db7cde1c75 100644 --- a/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C +++ b/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C @@ -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), diff --git a/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.H b/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.H index 204e2175de..f13388afb2 100644 --- a/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.H +++ b/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C index 387eb29f48..5bdbe838e6 100644 --- a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C +++ b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C @@ -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") diff --git a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.H b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.H index 8476e013ab..cb53bee831 100644 --- a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.H +++ b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C index 9dcf09ad52..c79625b627 100644 --- a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C +++ b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C @@ -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))) {} diff --git a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H index 0da213707c..5ba3a2bd44 100644 --- a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H +++ b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C index a2a26564ff..04cd8842e1 100644 --- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C +++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C @@ -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(); + pointIndexHit inter = querySurf.nearest(pt, span); - // Store triangle on point - cache.insert(pointi, triI); + // Triangle label (can be -1) + const label trii = inter.index(); - return triI; - } + // Store triangle on point + cache.insert(pointi, 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))), diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H index cf3fa9f2b8..7b2427a047 100644 --- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H +++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C index 1e1c3f6d0d..bf34accc7f 100644 --- a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C +++ b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C @@ -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)) {} diff --git a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.H b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.H index d2fc080970..63cc917f7f 100644 --- a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.H +++ b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.H @@ -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, diff --git a/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.C b/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.C new file mode 100644 index 0000000000..ae579e4e4a --- /dev/null +++ b/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.C @@ -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)); +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H b/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H new file mode 100644 index 0000000000..f506aaf0c8 --- /dev/null +++ b/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H @@ -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 + +// ************************************************************************* // diff --git a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C index 8170f94c13..81959a589b 100644 --- a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C +++ b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C @@ -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))) {} diff --git a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H index fe86baaccc..15f107782d 100644 --- a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H +++ b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H @@ -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, diff --git a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C index 9203ad8e39..0a6e6e8fe9 100644 --- a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C +++ b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C @@ -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); diff --git a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H index af0695ec32..30f50aaf3d 100644 --- a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H +++ b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H @@ -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); diff --git a/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C b/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C index 280850f1fb..73d8336a89 100644 --- a/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C +++ b/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C @@ -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) {} diff --git a/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.H b/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.H index e654485fb6..ae3e7f0215 100644 --- a/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.H +++ b/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C index 2c388468c6..572e1ffd7c 100644 --- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C +++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C @@ -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))) {} diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H index 96c17c4e83..9de0f3ca63 100644 --- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H +++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C index 5b271c8e0d..34dc77bfe8 100644 --- a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C +++ b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C @@ -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))) {} diff --git a/src/meshTools/sets/faceSources/cellToFace/cellToFace.H b/src/meshTools/sets/faceSources/cellToFace/cellToFace.H index 842203c6d1..b518d1ebe9 100644 --- a/src/meshTools/sets/faceSources/cellToFace/cellToFace.H +++ b/src/meshTools/sets/faceSources/cellToFace/cellToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C b/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C index 99ec5fc1a2..8366a41f2f 100644 --- a/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C +++ b/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C @@ -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))), diff --git a/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.H b/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.H index 842ac28053..15ec51732c 100644 --- a/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.H +++ b/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C b/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C index 0e82f1d94d..6e40dda85c 100644 --- a/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C +++ b/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C @@ -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))) diff --git a/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.H b/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.H index 6a2c4fe39e..e159302afe 100644 --- a/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.H +++ b/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/faceToFace/faceToFace.C b/src/meshTools/sets/faceSources/faceToFace/faceToFace.C index e3ee6f8d60..4310fda995 100644 --- a/src/meshTools/sets/faceSources/faceToFace/faceToFace.C +++ b/src/meshTools/sets/faceSources/faceToFace/faceToFace.C @@ -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)) {} diff --git a/src/meshTools/sets/faceSources/faceToFace/faceToFace.H b/src/meshTools/sets/faceSources/faceToFace/faceToFace.H index 58ed57bedd..452d21df0c 100644 --- a/src/meshTools/sets/faceSources/faceToFace/faceToFace.H +++ b/src/meshTools/sets/faceSources/faceToFace/faceToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/labelToFace/labelToFace.C b/src/meshTools/sets/faceSources/labelToFace/labelToFace.C index 4ea83806cf..0f085a4232 100644 --- a/src/meshTools/sets/faceSources/labelToFace/labelToFace.C +++ b/src/meshTools/sets/faceSources/labelToFace/labelToFace.C @@ -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()); diff --git a/src/meshTools/sets/faceSources/labelToFace/labelToFace.H b/src/meshTools/sets/faceSources/labelToFace/labelToFace.H index 53bc405a78..96635f525c 100644 --- a/src/meshTools/sets/faceSources/labelToFace/labelToFace.H +++ b/src/meshTools/sets/faceSources/labelToFace/labelToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/normalToFace/normalToFace.C b/src/meshTools/sets/faceSources/normalToFace/normalToFace.C index d16998d626..3c5c309afc 100644 --- a/src/meshTools/sets/faceSources/normalToFace/normalToFace.C +++ b/src/meshTools/sets/faceSources/normalToFace/normalToFace.C @@ -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_) diff --git a/src/meshTools/sets/faceSources/normalToFace/normalToFace.H b/src/meshTools/sets/faceSources/normalToFace/normalToFace.H index c276356153..09176ab29d 100644 --- a/src/meshTools/sets/faceSources/normalToFace/normalToFace.H +++ b/src/meshTools/sets/faceSources/normalToFace/normalToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C index a7a502d54f..8a3045f1b7 100644 --- a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C +++ b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C @@ -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))) {} diff --git a/src/meshTools/sets/faceSources/patchToFace/patchToFace.H b/src/meshTools/sets/faceSources/patchToFace/patchToFace.H index 98d8addd72..f30657e494 100644 --- a/src/meshTools/sets/faceSources/patchToFace/patchToFace.H +++ b/src/meshTools/sets/faceSources/patchToFace/patchToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C index 21a1953cf8..7c0ca17972 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C @@ -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))) {} diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H b/src/meshTools/sets/faceSources/pointToFace/pointToFace.H index 3e1ceb9f11..584e27bcb5 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/regionToFace/regionToFace.C b/src/meshTools/sets/faceSources/regionToFace/regionToFace.C index 4825c804c6..a06e5d53af 100644 --- a/src/meshTools/sets/faceSources/regionToFace/regionToFace.C +++ b/src/meshTools/sets/faceSources/regionToFace/regionToFace.C @@ -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)) {} diff --git a/src/meshTools/sets/faceSources/regionToFace/regionToFace.H b/src/meshTools/sets/faceSources/regionToFace/regionToFace.H index fedd9d86d0..c3d79a5520 100644 --- a/src/meshTools/sets/faceSources/regionToFace/regionToFace.H +++ b/src/meshTools/sets/faceSources/regionToFace/regionToFace.H @@ -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, diff --git a/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.C b/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.C new file mode 100644 index 0000000000..bc3cc62c25 --- /dev/null +++ b/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.C @@ -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)); +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H b/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H new file mode 100644 index 0000000000..018275ff59 --- /dev/null +++ b/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H @@ -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 + +// ************************************************************************* // diff --git a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C index b19f28403c..1830bb94b2 100644 --- a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C +++ b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C @@ -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))) {} diff --git a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H index f236d3e870..4c20ee4d96 100644 --- a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H +++ b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H @@ -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, diff --git a/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H b/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H index f82d796eeb..843c3fa66a 100644 --- a/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H +++ b/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H @@ -30,8 +30,8 @@ Description \heading Dictionary parameters \table - Property | Description | Required | Default - faceSet | Name of input faceSet | yes | + Property | Description | Required | Default + faceSet | Name of input faceSet | yes | \endtable Note diff --git a/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H b/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H index 81bd210940..02d5d90485 100644 --- a/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H +++ b/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H @@ -29,10 +29,10 @@ Description \heading Dictionary parameters \table - Property | Description | Required | Default - cellSet | Name of input cellSet | yes | - faceSet | Name of input faceSet | yes | - flip | Force flip of faces | no | false + Property | Description | Required | Default + cellSet | Name of input cellSet | yes | + faceSet | Name of input faceSet | yes | + flip | Force flip of faces | no | false \endtable SourceFiles diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C index 3987f7373a..cec79cccb2 100644 --- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C +++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C @@ -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))) {} diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H index 545418f257..36fe9544b9 100644 --- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H +++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H @@ -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, diff --git a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C index 8ef233ec15..6b21b8415b 100644 --- a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C +++ b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C @@ -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))) {} diff --git a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H index 7bf16ea853..f00c71aa39 100644 --- a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H +++ b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H @@ -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, diff --git a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C index 9f6583eb16..8b0439bed6 100644 --- a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C +++ b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C @@ -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))) {} diff --git a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H index 7a2f3918d3..375a08dd6f 100644 --- a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H +++ b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H @@ -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, diff --git a/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C b/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C index 15e19a773b..f6c2ce4577 100644 --- a/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C +++ b/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C @@ -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()); diff --git a/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.H b/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.H index 5670edcddf..c96f4b9d4e 100644 --- a/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.H +++ b/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.H @@ -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, diff --git a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C index 95fc156c04..a7c62b9474 100644 --- a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C +++ b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C @@ -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)) {} diff --git a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.H b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.H index ff224780ac..0946c742f9 100644 --- a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.H +++ b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.H @@ -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, diff --git a/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C b/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C index 93a40e84e1..120f50c129 100644 --- a/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C +++ b/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C @@ -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)) {} diff --git a/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.H b/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.H index 9257d3bea9..5f1286672e 100644 --- a/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.H +++ b/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.H @@ -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, diff --git a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C index da51f7a9d9..729426e5b8 100644 --- a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C +++ b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C @@ -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))), diff --git a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.H b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.H index 0f6ed0d4e5..e9ae0d1cbd 100644 --- a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.H +++ b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.H @@ -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, diff --git a/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.C b/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.C new file mode 100644 index 0000000000..dd91b9c7a1 --- /dev/null +++ b/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.C @@ -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)); +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H b/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H new file mode 100644 index 0000000000..627b0621ed --- /dev/null +++ b/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H @@ -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 + +// ************************************************************************* // diff --git a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C index 99e45aefdb..3879a24b17 100644 --- a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C +++ b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C @@ -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))) {} diff --git a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H index 8933052076..536a579720 100644 --- a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H +++ b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H @@ -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, diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.H b/src/meshTools/sets/topoSetSource/topoSetSource.H index 4dfacfe3c4..5a085b5b4b 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.H +++ b/src/meshTools/sets/topoSetSource/topoSetSource.H @@ -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" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/overset/regionsToCell/regionsToCell.C b/src/overset/regionsToCell/regionsToCell.C index 2cb3419a4f..99fea0c97c 100644 --- a/src/overset/regionsToCell/regionsToCell.C +++ b/src/overset/regionsToCell/regionsToCell.C @@ -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); - + 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 diff --git a/src/overset/regionsToCell/regionsToCell.H b/src/overset/regionsToCell/regionsToCell.H index 1f7c544574..4f4aba80c3 100644 --- a/src/overset/regionsToCell/regionsToCell.H +++ b/src/overset/regionsToCell/regionsToCell.H @@ -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; }; diff --git a/tutorials/mesh/foamyHexMesh/flange/system/faceSetDict b/tutorials/mesh/foamyHexMesh/flange/system/faceSetDict index 107e7930e9..5f3ed0b9a5 100644 --- a/tutorials/mesh/foamyHexMesh/flange/system/faceSetDict +++ b/tutorials/mesh/foamyHexMesh/flange/system/faceSetDict @@ -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 -- GitLab