ENH: distinguish between face zone topoSetSource (#1060)

- add intermediate class topoSetFaceZoneSource
  and corresponding New() factories
This commit is contained in:
Mark Olesen
2020-11-16 09:59:28 +01:00
parent 54139592b9
commit 8969110f2a
32 changed files with 909 additions and 149 deletions

View File

@ -206,6 +206,7 @@ $(pointSources)/surfaceToPoint/surfaceToPoint.C
$(pointSources)/zoneToPoint/zoneToPoint.C
faceZoneSources = sets/faceZoneSources
$(faceZoneSources)/topoSetFaceZoneSource/topoSetFaceZoneSource.C
$(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C
$(faceZoneSources)/setsToFaceZone/setsToFaceZone.C
$(faceZoneSources)/setToFaceZone/setToFaceZone.C
@ -214,9 +215,11 @@ $(faceZoneSources)/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C
$(faceZoneSources)/planeToFaceZone/planeToFaceZone.C
cellZoneSources = sets/cellZoneSources
$(cellZoneSources)/topoSetCellZoneSource/topoSetCellZoneSource.C
$(cellZoneSources)/setToCellZone/setToCellZone.C
pointZoneSources = sets/pointZoneSources
$(pointZoneSources)/topoSetPointZoneSource/topoSetPointZoneSource.C
$(pointZoneSources)/setToPointZone/setToPointZone.C
momentOfInertia/momentOfInertia.C

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,7 +32,6 @@ License
namespace Foam
{
defineTypeNameAndDebug(topoSetCellSource, 0);
defineRunTimeSelectionTable(topoSetCellSource, word);
defineRunTimeSelectionTable(topoSetCellSource, istream);
}
@ -48,7 +47,8 @@ Foam::topoSetCellSource::topoSetCellSource(const polyMesh& mesh)
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
Foam::autoPtr<Foam::topoSetCellSource>
Foam::topoSetCellSource::New
(
const word& sourceType,
const polyMesh& mesh,
@ -62,7 +62,7 @@ Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
FatalIOErrorInLookup
(
dict,
"topoSetCellSource",
"cellSetSource",
sourceType,
*wordConstructorTablePtr_
) << exit(FatalIOError);
@ -72,7 +72,8 @@ Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
}
Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
Foam::autoPtr<Foam::topoSetCellSource>
Foam::topoSetCellSource::New
(
const word& sourceType,
const polyMesh& mesh,
@ -85,7 +86,7 @@ Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
{
FatalErrorInLookup
(
"topoSetCellSource",
"cellSetSource",
sourceType,
*istreamConstructorTablePtr_
) << exit(FatalError);

View File

@ -58,9 +58,6 @@ class topoSetCellSource
{
public:
//- Runtime type information
TypeName("topoSetCellSource");
// Declare run-time constructor selection table
// For the dictionary constructor

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,6 +38,9 @@ namespace Foam
defineTypeNameAndDebug(setToCellZone, 0);
addToRunTimeSelectionTable(topoSetSource, setToCellZone, word);
addToRunTimeSelectionTable(topoSetSource, setToCellZone, istream);
addToRunTimeSelectionTable(topoSetCellZoneSource, setToCellZone, word);
addToRunTimeSelectionTable(topoSetCellZoneSource, setToCellZone, istream);
}
@ -57,7 +60,7 @@ Foam::setToCellZone::setToCellZone
const word& setName
)
:
topoSetSource(mesh),
topoSetCellZoneSource(mesh),
setName_(setName)
{}
@ -68,7 +71,7 @@ Foam::setToCellZone::setToCellZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetCellZoneSource(mesh),
setName_(dict.get<word>("set"))
{}
@ -79,7 +82,7 @@ Foam::setToCellZone::setToCellZone
Istream& is
)
:
topoSetSource(mesh),
topoSetCellZoneSource(mesh),
setName_(checkIs(is))
{}
@ -96,6 +99,7 @@ void Foam::setToCellZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a cellZoneSet." << endl;
return;
}
else
{

View File

@ -82,7 +82,7 @@ SourceFiles
#ifndef setToCellZone_H
#define setToCellZone_H
#include "topoSetSource.H"
#include "topoSetCellZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -95,7 +95,7 @@ namespace Foam
class setToCellZone
:
public topoSetSource
public topoSetCellZoneSource
{
// Private Data
@ -130,12 +130,6 @@ public:
// Member Functions
//- The source category is a cellZone
virtual topoSetSource::sourceType setType() const
{
return CELLZONE_SOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "topoSetCellZoneSource.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineRunTimeSelectionTable(topoSetCellZoneSource, word);
defineRunTimeSelectionTable(topoSetCellZoneSource, istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoSetCellZoneSource::topoSetCellZoneSource(const polyMesh& mesh)
:
topoSetSource(mesh)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetCellZoneSource>
Foam::topoSetCellZoneSource::New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
)
{
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"cellZoneSource",
sourceType,
*wordConstructorTablePtr_
) << exit(FatalIOError);
}
return autoPtr<topoSetCellZoneSource>(cstrIter()(mesh, dict));
}
Foam::autoPtr<Foam::topoSetCellZoneSource>
Foam::topoSetCellZoneSource::New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
)
{
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInLookup
(
"cellZoneSource",
sourceType,
*istreamConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<topoSetCellZoneSource>(cstrIter()(mesh, is));
}
// ************************************************************************* //

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::topoSetCellZoneSource
Description
The \c topoSetCellZoneSource is a intermediate class
for handling \c topoSet sources for selecting cell zones.
The class is not an executable \c topoSet itself,
yet a provider for common entries to its derived \c topoSet.
SourceFiles
topoSetCellZoneSource.C
\*---------------------------------------------------------------------------*/
#ifndef topoSetCellZoneSource_H
#define topoSetCellZoneSource_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class cellZoneSet;
/*---------------------------------------------------------------------------*\
Class topoSetCellZoneSource Declaration
\*---------------------------------------------------------------------------*/
class topoSetCellZoneSource
:
public topoSetSource
{
public:
// Declare run-time constructor selection table
// For the dictionary constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetCellZoneSource,
word,
(
const polyMesh& mesh,
const dictionary& dict
),
(mesh, dict)
);
// For the Istream constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetCellZoneSource,
istream,
(
const polyMesh& mesh,
Istream& is
),
(mesh, is)
);
// Constructors
//- Construct from components
explicit topoSetCellZoneSource(const polyMesh& mesh);
//- Clone (disallowed)
autoPtr<topoSetCellZoneSource> clone() const
{
NotImplemented;
return nullptr;
}
// Selectors
//- Return a reference to the selected source type
static autoPtr<topoSetCellZoneSource> New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
);
//- Return a reference to the selected source type
static autoPtr<topoSetCellZoneSource> New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
);
//- Destructor
virtual ~topoSetCellZoneSource() = default;
// Member Functions
//- The source category is a cellZone
virtual topoSetSource::sourceType setType() const
{
return CELLZONE_SOURCE;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,7 +32,6 @@ License
namespace Foam
{
defineTypeNameAndDebug(topoSetFaceSource, 0);
defineRunTimeSelectionTable(topoSetFaceSource, word);
defineRunTimeSelectionTable(topoSetFaceSource, istream);
}
@ -48,7 +47,8 @@ Foam::topoSetFaceSource::topoSetFaceSource(const polyMesh& mesh)
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
Foam::autoPtr<Foam::topoSetFaceSource>
Foam::topoSetFaceSource::New
(
const word& sourceType,
const polyMesh& mesh,
@ -62,7 +62,7 @@ Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
FatalIOErrorInLookup
(
dict,
"topoSetFaceSource",
"faceSetSource",
sourceType,
*wordConstructorTablePtr_
) << exit(FatalIOError);
@ -72,7 +72,8 @@ Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
}
Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
Foam::autoPtr<Foam::topoSetFaceSource>
Foam::topoSetFaceSource::New
(
const word& sourceType,
const polyMesh& mesh,
@ -85,7 +86,7 @@ Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
{
FatalErrorInLookup
(
"topoSetFaceSource",
"faceSetSource",
sourceType,
*istreamConstructorTablePtr_
) << exit(FatalError);

View File

@ -58,9 +58,6 @@ class topoSetFaceSource
{
public:
//- Runtime type information
TypeName("topoSetFaceSource");
// Declare run-time constructor selection table
// For the dictionary constructor

View File

@ -37,6 +37,7 @@ namespace Foam
defineTypeNameAndDebug(zoneToFace, 0);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, word);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, istream);
addToRunTimeSelectionTable(topoSetFaceSource, zoneToFace, word);
addToRunTimeSelectionTable(topoSetFaceSource, zoneToFace, istream);
addNamedToRunTimeSelectionTable

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,6 +38,19 @@ namespace Foam
defineTypeNameAndDebug(faceZoneToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, istream);
addToRunTimeSelectionTable
(
topoSetFaceZoneSource,
faceZoneToFaceZone,
word
);
addToRunTimeSelectionTable
(
topoSetFaceZoneSource,
faceZoneToFaceZone,
istream
);
}
@ -57,7 +70,7 @@ Foam::faceZoneToFaceZone::faceZoneToFaceZone
const word& setName
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(setName)
{}
@ -68,7 +81,7 @@ Foam::faceZoneToFaceZone::faceZoneToFaceZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(dict.get<word>("zone"))
{}
@ -79,7 +92,7 @@ Foam::faceZoneToFaceZone::faceZoneToFaceZone
Istream& is
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(checkIs(is))
{}
@ -96,6 +109,7 @@ void Foam::faceZoneToFaceZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a faceZoneSet." << endl;
return;
}
else
{

View File

@ -81,7 +81,7 @@ SourceFiles
#ifndef faceZoneToFaceZone_H
#define faceZoneToFaceZone_H
#include "topoSetSource.H"
#include "topoSetFaceZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -94,7 +94,7 @@ namespace Foam
class faceZoneToFaceZone
:
public topoSetSource
public topoSetFaceZoneSource
{
// Private Data
@ -114,11 +114,7 @@ public:
// Constructors
//- Construct from components
faceZoneToFaceZone
(
const polyMesh& mesh,
const word& setName
);
faceZoneToFaceZone(const polyMesh& mesh, const word& setName);
//- Construct from dictionary
faceZoneToFaceZone(const polyMesh& mesh, const dictionary& dict);
@ -133,12 +129,6 @@ public:
// Member Functions
//- The source category is a faceZone
virtual topoSetSource::sourceType setType() const
{
return FACEZONE_SOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -41,6 +41,24 @@ namespace Foam
defineTypeNameAndDebug(planeToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, planeToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, planeToFaceZone, istream);
addToRunTimeSelectionTable(topoSetFaceZoneSource, planeToFaceZone, word);
addToRunTimeSelectionTable(topoSetFaceZoneSource, planeToFaceZone, istream);
addNamedToRunTimeSelectionTable
(
topoSetFaceZoneSource,
planeToFaceZone,
word,
plane
);
addNamedToRunTimeSelectionTable
(
topoSetFaceZoneSource,
planeToFaceZone,
istream,
plane
);
}
@ -352,7 +370,7 @@ Foam::planeToFaceZone::planeToFaceZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
point_(dict.get<vector>("point")),
normal_(dict.get<vector>("normal")),
option_
@ -368,7 +386,7 @@ Foam::planeToFaceZone::planeToFaceZone
Istream& is
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
point_(checkIs(is)),
normal_(checkIs(is)),
option_(faceZoneActionNames_.read(checkIs(is)))
@ -387,25 +405,30 @@ void Foam::planeToFaceZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a faceZoneSet." << endl;
return;
}
else
{
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding faces which form a plane at " << point_
<< " with normal " << normal_ << endl;
faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
combine(fzSet, true);
if (action == topoSetSource::NEW || action == topoSetSource::ADD)
{
if (verbose_)
{
Info<< " Adding faces that form a plane at "
<< point_ << " with normal " << normal_ << endl;
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing faces which form a plane at " << point_
<< " with normal " << normal_ << endl;
combine(fzSet, false);
combine(zoneSet, true);
}
else if (action == topoSetSource::SUBTRACT)
{
if (verbose_)
{
Info<< " Removing faces that form a plane at "
<< point_ << " with normal " << normal_ << endl;
}
combine(zoneSet, false);
}
}

View File

@ -101,23 +101,20 @@ SourceFiles
#ifndef planeToFaceZone_H
#define planeToFaceZone_H
#include "topoSetSource.H"
#include "Enum.H"
#include "topoSetFaceZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class faceZoneSet;
/*---------------------------------------------------------------------------*\
Class planeToFaceZone Declaration
\*---------------------------------------------------------------------------*/
class planeToFaceZone
:
public topoSetSource
public topoSetFaceZoneSource
{
public:
@ -166,18 +163,10 @@ public:
planeToFaceZone() = delete;
//- Construct from dictionary
planeToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
planeToFaceZone(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
planeToFaceZone
(
const polyMesh& mesh,
Istream&
);
planeToFaceZone(const polyMesh& mesh, Istream& is);
//- Destructor
@ -186,11 +175,6 @@ public:
// Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -45,6 +45,20 @@ namespace Foam
searchableSurfaceToFaceZone,
word
);
addToRunTimeSelectionTable
(
topoSetFaceZoneSource,
searchableSurfaceToFaceZone,
word
);
addNamedToRunTimeSelectionTable
(
topoSetFaceZoneSource,
searchableSurfaceToFaceZone,
word,
surface
);
}
@ -92,7 +106,7 @@ Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
surfacePtr_
(
searchableSurface::New
@ -140,6 +154,7 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a faceZoneSet." << endl;
return;
}
else
{

View File

@ -86,13 +86,14 @@ SourceFiles
#ifndef searchableSurfaceToFaceZone_H
#define searchableSurfaceToFaceZone_H
#include "topoSetSource.H"
#include "topoSetFaceZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class searchableSurface;
/*---------------------------------------------------------------------------*\
@ -101,7 +102,7 @@ class searchableSurface;
class searchableSurfaceToFaceZone
:
public topoSetSource
public topoSetFaceZoneSource
{
// Private Data
@ -155,12 +156,6 @@ public:
// Member Functions
//- The source category is a faceZone
virtual topoSetSource::sourceType setType() const
{
return FACEZONE_SOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,6 +38,19 @@ namespace Foam
defineTypeNameAndDebug(setAndNormalToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, istream);
addToRunTimeSelectionTable
(
topoSetFaceZoneSource,
setAndNormalToFaceZone,
word
);
addToRunTimeSelectionTable
(
topoSetFaceZoneSource,
setAndNormalToFaceZone,
istream
);
}
@ -58,7 +71,7 @@ Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
const vector& normal
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(setName),
normal_(normal)
{}
@ -70,7 +83,7 @@ Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(dict.get<word>("faceSet")),
normal_(dict.get<vector>("normal"))
{}
@ -82,7 +95,7 @@ Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
Istream& is
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(checkIs(is)),
normal_(checkIs(is))
{}
@ -100,6 +113,7 @@ void Foam::setAndNormalToFaceZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a faceZoneSet." << endl;
return;
}
else
{

View File

@ -80,7 +80,7 @@ SourceFiles
#ifndef setAndNormalToFaceZone_H
#define setAndNormalToFaceZone_H
#include "topoSetSource.H"
#include "topoSetFaceZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,7 +93,7 @@ namespace Foam
class setAndNormalToFaceZone
:
public topoSetSource
public topoSetFaceZoneSource
{
// Private Data
@ -135,12 +135,6 @@ public:
// Member Functions
//- The source category is a faceZone
virtual topoSetSource::sourceType setType() const
{
return FACEZONE_SOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,6 +38,9 @@ namespace Foam
defineTypeNameAndDebug(setToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, istream);
addToRunTimeSelectionTable(topoSetFaceZoneSource, setToFaceZone, word);
addToRunTimeSelectionTable(topoSetFaceZoneSource, setToFaceZone, istream);
}
@ -58,7 +61,7 @@ Foam::setToFaceZone::setToFaceZone
const word& setName
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(setName)
{}
@ -69,7 +72,7 @@ Foam::setToFaceZone::setToFaceZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(dict.get<word>("faceSet"))
{
if (dict.found("cellSet"))
@ -87,7 +90,7 @@ Foam::setToFaceZone::setToFaceZone
Istream& is
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
setName_(checkIs(is))
{}
@ -104,6 +107,7 @@ void Foam::setToFaceZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a faceZoneSet." << endl;
return;
}
else
{

View File

@ -87,7 +87,7 @@ SourceFiles
#ifndef setToFaceZone_H
#define setToFaceZone_H
#include "topoSetSource.H"
#include "topoSetFaceZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -100,7 +100,7 @@ namespace Foam
class setToFaceZone
:
public topoSetSource
public topoSetFaceZoneSource
{
// Private Data
@ -139,12 +139,6 @@ public:
// Member Functions
//- The source category is a faceZone
virtual topoSetSource::sourceType setType() const
{
return FACEZONE_SOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -39,6 +39,9 @@ namespace Foam
defineTypeNameAndDebug(setsToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, setsToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setsToFaceZone, istream);
addToRunTimeSelectionTable(topoSetFaceZoneSource, setsToFaceZone, word);
addToRunTimeSelectionTable(topoSetFaceZoneSource, setsToFaceZone, istream);
}
@ -61,7 +64,7 @@ Foam::setsToFaceZone::setsToFaceZone
const bool flip
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
faceSetName_(faceSetName),
cellSetName_(cellSetName),
flip_(flip)
@ -74,7 +77,7 @@ Foam::setsToFaceZone::setsToFaceZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
faceSetName_(dict.get<word>("faceSet")),
cellSetName_(dict.get<word>("cellSet")),
flip_(dict.getOrDefault("flip", false))
@ -87,7 +90,7 @@ Foam::setsToFaceZone::setsToFaceZone
Istream& is
)
:
topoSetSource(mesh),
topoSetFaceZoneSource(mesh),
faceSetName_(checkIs(is)),
cellSetName_(checkIs(is)),
flip_(false)
@ -106,6 +109,7 @@ void Foam::setsToFaceZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a faceZoneSet." << endl;
return;
}
else
{

View File

@ -89,7 +89,7 @@ SourceFiles
#ifndef setsToFaceZone_H
#define setsToFaceZone_H
#include "topoSetSource.H"
#include "topoSetFaceZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -102,7 +102,7 @@ namespace Foam
class setsToFaceZone
:
public topoSetSource
public topoSetFaceZoneSource
{
// Private Data
@ -149,12 +149,6 @@ public:
// Member Functions
//- The source category is a pointSet
virtual topoSetSource::sourceType setType() const
{
return FACEZONE_SOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "topoSetFaceZoneSource.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineRunTimeSelectionTable(topoSetFaceZoneSource, word);
defineRunTimeSelectionTable(topoSetFaceZoneSource, istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoSetFaceZoneSource::topoSetFaceZoneSource(const polyMesh& mesh)
:
topoSetSource(mesh)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetFaceZoneSource>
Foam::topoSetFaceZoneSource::New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
)
{
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"faceZoneSource",
sourceType,
*wordConstructorTablePtr_
) << exit(FatalIOError);
}
return autoPtr<topoSetFaceZoneSource>(cstrIter()(mesh, dict));
}
Foam::autoPtr<Foam::topoSetFaceZoneSource>
Foam::topoSetFaceZoneSource::New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
)
{
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInLookup
(
"faceZoneSource",
sourceType,
*istreamConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<topoSetFaceZoneSource>(cstrIter()(mesh, is));
}
// ************************************************************************* //

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::topoSetFaceZoneSource
Description
The \c topoSetFaceZoneSource is a intermediate class
for handling \c topoSet sources for selecting face zones.
The class is not an executable \c topoSet itself,
yet a provider for common entries to its derived \c topoSet.
SourceFiles
topoSetFaceZoneSource.C
\*---------------------------------------------------------------------------*/
#ifndef topoSetFaceZoneSource_H
#define topoSetFaceZoneSource_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class faceZoneSet;
/*---------------------------------------------------------------------------*\
Class topoSetFaceZoneSource Declaration
\*---------------------------------------------------------------------------*/
class topoSetFaceZoneSource
:
public topoSetSource
{
public:
// Declare run-time constructor selection table
// For the dictionary constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetFaceZoneSource,
word,
(
const polyMesh& mesh,
const dictionary& dict
),
(mesh, dict)
);
// For the Istream constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetFaceZoneSource,
istream,
(
const polyMesh& mesh,
Istream& is
),
(mesh, is)
);
// Constructors
//- Construct from components
explicit topoSetFaceZoneSource(const polyMesh& mesh);
//- Clone (disallowed)
autoPtr<topoSetFaceZoneSource> clone() const
{
NotImplemented;
return nullptr;
}
// Selectors
//- Return a reference to the selected source type
static autoPtr<topoSetFaceZoneSource> New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
);
//- Return a reference to the selected source type
static autoPtr<topoSetFaceZoneSource> New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
);
//- Destructor
virtual ~topoSetFaceZoneSource() = default;
// Member Functions
//- The source category is a faceZone
virtual topoSetSource::sourceType setType() const
{
return FACEZONE_SOURCE;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,7 +32,6 @@ License
namespace Foam
{
defineTypeNameAndDebug(topoSetPointSource, 0);
defineRunTimeSelectionTable(topoSetPointSource, word);
defineRunTimeSelectionTable(topoSetPointSource, istream);
}
@ -48,7 +47,8 @@ Foam::topoSetPointSource::topoSetPointSource(const polyMesh& mesh)
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetPointSource> Foam::topoSetPointSource::New
Foam::autoPtr<Foam::topoSetPointSource>
Foam::topoSetPointSource::New
(
const word& sourceType,
const polyMesh& mesh,
@ -62,7 +62,7 @@ Foam::autoPtr<Foam::topoSetPointSource> Foam::topoSetPointSource::New
FatalIOErrorInLookup
(
dict,
"topoSetPointSource",
"pointSetSource",
sourceType,
*wordConstructorTablePtr_
) << exit(FatalIOError);
@ -85,7 +85,7 @@ Foam::autoPtr<Foam::topoSetPointSource> Foam::topoSetPointSource::New
{
FatalErrorInLookup
(
"topoSetPointSource",
"pointSetSource",
sourceType,
*istreamConstructorTablePtr_
) << exit(FatalError);

View File

@ -58,9 +58,6 @@ class topoSetPointSource
{
public:
//- Runtime type information
TypeName("topoSetPointSource");
// Declare run-time constructor selection table
// For the dictionary constructor

View File

@ -37,6 +37,7 @@ namespace Foam
defineTypeNameAndDebug(zoneToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, word);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, istream);
addToRunTimeSelectionTable(topoSetPointSource, zoneToPoint, word);
addToRunTimeSelectionTable(topoSetPointSource, zoneToPoint, istream);
addNamedToRunTimeSelectionTable

View File

@ -38,6 +38,9 @@ namespace Foam
defineTypeNameAndDebug(setToPointZone, 0);
addToRunTimeSelectionTable(topoSetSource, setToPointZone, word);
addToRunTimeSelectionTable(topoSetSource, setToPointZone, istream);
addToRunTimeSelectionTable(topoSetPointZoneSource, setToPointZone, word);
addToRunTimeSelectionTable(topoSetPointZoneSource, setToPointZone, istream);
}
@ -57,7 +60,7 @@ Foam::setToPointZone::setToPointZone
const word& setName
)
:
topoSetSource(mesh),
topoSetPointZoneSource(mesh),
setName_(setName)
{}
@ -68,7 +71,7 @@ Foam::setToPointZone::setToPointZone
const dictionary& dict
)
:
topoSetSource(mesh),
topoSetPointZoneSource(mesh),
setName_(dict.get<word>("set"))
{}
@ -79,7 +82,7 @@ Foam::setToPointZone::setToPointZone
Istream& is
)
:
topoSetSource(mesh),
topoSetPointZoneSource(mesh),
setName_(checkIs(is))
{}
@ -96,6 +99,7 @@ void Foam::setToPointZone::applyToSet
{
WarningInFunction
<< "Operation only allowed on a pointZoneSet." << endl;
return;
}
else
{

View File

@ -83,7 +83,7 @@ SourceFiles
#ifndef setToPointZone_H
#define setToPointZone_H
#include "topoSetSource.H"
#include "topoSetPointZoneSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,7 +96,7 @@ namespace Foam
class setToPointZone
:
public topoSetSource
public topoSetPointZoneSource
{
// Private Data
@ -135,12 +135,6 @@ public:
// Member Functions
//- The source category is a pointZone
virtual topoSetSource::sourceType setType() const
{
return POINTZONE_SOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "topoSetPointZoneSource.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineRunTimeSelectionTable(topoSetPointZoneSource, word);
defineRunTimeSelectionTable(topoSetPointZoneSource, istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoSetPointZoneSource::topoSetPointZoneSource(const polyMesh& mesh)
:
topoSetSource(mesh)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetPointZoneSource>
Foam::topoSetPointZoneSource::New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
)
{
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"pointZoneSource",
sourceType,
*wordConstructorTablePtr_
) << exit(FatalIOError);
}
return autoPtr<topoSetPointZoneSource>(cstrIter()(mesh, dict));
}
Foam::autoPtr<Foam::topoSetPointZoneSource>
Foam::topoSetPointZoneSource::New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
)
{
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
if (!cstrIter.found())
{
FatalErrorInLookup
(
"pointZoneSource",
sourceType,
*istreamConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<topoSetPointZoneSource>(cstrIter()(mesh, is));
}
// ************************************************************************* //

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::topoSetPointZoneSource
Description
The \c topoSetPointZoneSource is a intermediate class
for handling \c topoSet sources for selecting point zones.
The class is not an executable \c topoSet itself,
yet a provider for common entries to its derived \c topoSet.
SourceFiles
topoSetPointZoneSource.C
\*---------------------------------------------------------------------------*/
#ifndef topoSetPointZoneSource_H
#define topoSetPointZoneSource_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class pointZoneSet;
/*---------------------------------------------------------------------------*\
Class topoSetPointZoneSource Declaration
\*---------------------------------------------------------------------------*/
class topoSetPointZoneSource
:
public topoSetSource
{
public:
// Declare run-time constructor selection table
// For the dictionary constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetPointZoneSource,
word,
(
const polyMesh& mesh,
const dictionary& dict
),
(mesh, dict)
);
// For the Istream constructor
declareRunTimeSelectionTable
(
autoPtr,
topoSetPointZoneSource,
istream,
(
const polyMesh& mesh,
Istream& is
),
(mesh, is)
);
// Constructors
//- Construct from components
explicit topoSetPointZoneSource(const polyMesh& mesh);
//- Clone (disallowed)
autoPtr<topoSetPointZoneSource> clone() const
{
NotImplemented;
return nullptr;
}
// Selectors
//- Return a reference to the selected source type
static autoPtr<topoSetPointZoneSource> New
(
const word& sourceType,
const polyMesh& mesh,
const dictionary& dict
);
//- Return a reference to the selected source type
static autoPtr<topoSetPointZoneSource> New
(
const word& sourceType,
const polyMesh& mesh,
Istream& is
);
//- Destructor
virtual ~topoSetPointZoneSource() = default;
// Member Functions
//- The source category is a pointZone
virtual topoSetSource::sourceType setType() const
{
return POINTZONE_SOURCE;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,7 +50,8 @@ namespace Foam
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
Foam::autoPtr<Foam::topoSet>
Foam::topoSet::New
(
const word& setType,
const polyMesh& mesh,
@ -75,7 +76,8 @@ Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
}
Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
Foam::autoPtr<Foam::topoSet>
Foam::topoSet::New
(
const word& setType,
const polyMesh& mesh,
@ -100,7 +102,8 @@ Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
}
Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
Foam::autoPtr<Foam::topoSet>
Foam::topoSet::New
(
const word& setType,
const polyMesh& mesh,