ENH: improve verbosity controls for topoSetSource

This commit is contained in:
Mark Olesen
2021-06-19 11:43:09 +02:00
parent 02881f6237
commit b2fdc67273
14 changed files with 155 additions and 30 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,6 +45,16 @@ Foam::topoSetCellSource::topoSetCellSource(const polyMesh& mesh)
{} {}
Foam::topoSetCellSource::topoSetCellSource
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh, dict)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetCellSource> Foam::autoPtr<Foam::topoSetCellSource>

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -89,9 +89,13 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from mesh
explicit topoSetCellSource(const polyMesh& mesh); explicit topoSetCellSource(const polyMesh& mesh);
//- Construct from mesh, use "verbose" entry if present
topoSetCellSource(const polyMesh& mesh, const dictionary& dict);
//- Clone (disallowed) //- Clone (disallowed)
autoPtr<topoSetCellSource> clone() const autoPtr<topoSetCellSource> clone() const
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,6 +45,16 @@ Foam::topoSetCellZoneSource::topoSetCellZoneSource(const polyMesh& mesh)
{} {}
Foam::topoSetCellZoneSource::topoSetCellZoneSource
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh, dict)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetCellZoneSource> Foam::autoPtr<Foam::topoSetCellZoneSource>

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,9 +92,13 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from mesh
explicit topoSetCellZoneSource(const polyMesh& mesh); explicit topoSetCellZoneSource(const polyMesh& mesh);
//- Construct from mesh, use "verbose" entry if present
topoSetCellZoneSource(const polyMesh& mesh, const dictionary& dict);
//- Clone (disallowed) //- Clone (disallowed)
autoPtr<topoSetCellZoneSource> clone() const autoPtr<topoSetCellZoneSource> clone() const
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,6 +45,16 @@ Foam::topoSetFaceSource::topoSetFaceSource(const polyMesh& mesh)
{} {}
Foam::topoSetFaceSource::topoSetFaceSource
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh, dict)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetFaceSource> Foam::autoPtr<Foam::topoSetFaceSource>

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -89,9 +89,13 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from mesh
explicit topoSetFaceSource(const polyMesh& mesh); explicit topoSetFaceSource(const polyMesh& mesh);
//- Construct from mesh, use "verbose" entry if present
topoSetFaceSource(const polyMesh& mesh, const dictionary& dict);
//- Clone (disallowed) //- Clone (disallowed)
autoPtr<topoSetFaceSource> clone() const autoPtr<topoSetFaceSource> clone() const
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,6 +45,16 @@ Foam::topoSetFaceZoneSource::topoSetFaceZoneSource(const polyMesh& mesh)
{} {}
Foam::topoSetFaceZoneSource::topoSetFaceZoneSource
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh, dict)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetFaceZoneSource> Foam::autoPtr<Foam::topoSetFaceZoneSource>

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,9 +92,13 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from mesh
explicit topoSetFaceZoneSource(const polyMesh& mesh); explicit topoSetFaceZoneSource(const polyMesh& mesh);
//- Construct from mesh, use "verbose" entry if present
topoSetFaceZoneSource(const polyMesh& mesh, const dictionary& dict);
//- Clone (disallowed) //- Clone (disallowed)
autoPtr<topoSetFaceZoneSource> clone() const autoPtr<topoSetFaceZoneSource> clone() const
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,6 +45,16 @@ Foam::topoSetPointSource::topoSetPointSource(const polyMesh& mesh)
{} {}
Foam::topoSetPointSource::topoSetPointSource
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh, dict)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetPointSource> Foam::autoPtr<Foam::topoSetPointSource>

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -89,9 +89,13 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from mesh
explicit topoSetPointSource(const polyMesh& mesh); explicit topoSetPointSource(const polyMesh& mesh);
//- Construct from mesh, use "verbose" entry if present
topoSetPointSource(const polyMesh& mesh, const dictionary& dict);
//- Clone (disallowed) //- Clone (disallowed)
autoPtr<topoSetPointSource> clone() const autoPtr<topoSetPointSource> clone() const
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,6 +45,16 @@ Foam::topoSetPointZoneSource::topoSetPointZoneSource(const polyMesh& mesh)
{} {}
Foam::topoSetPointZoneSource::topoSetPointZoneSource
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh, dict)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::topoSetPointZoneSource> Foam::autoPtr<Foam::topoSetPointZoneSource>

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,9 +92,13 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from mesh
explicit topoSetPointZoneSource(const polyMesh& mesh); explicit topoSetPointZoneSource(const polyMesh& mesh);
//- Construct from mesh, use "verbose" entry if present
topoSetPointZoneSource(const polyMesh& mesh, const dictionary& dict);
//- Clone (disallowed) //- Clone (disallowed)
autoPtr<topoSetPointZoneSource> clone() const autoPtr<topoSetPointZoneSource> clone() const
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,6 +27,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "topoSetSource.H" #include "topoSetSource.H"
#include "dictionary.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "bitSet.H" #include "bitSet.H"
#include "topoSet.H" #include "topoSet.H"
@ -228,11 +229,40 @@ void Foam::topoSetSource::addOrDelete
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoSetSource::topoSetSource(const polyMesh& mesh) Foam::topoSetSource::topoSetSource
(
const polyMesh& mesh,
bool verbose
)
: :
mesh_(mesh), mesh_(mesh),
verbose_(true) verbose_(verbose)
{} {}
Foam::topoSetSource::topoSetSource
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh)
{
verbose(dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::topoSetSource::verbose(const dictionary& dict)
{
bool flag(verbose_);
if (dict.readIfPresent("verbose", flag))
{
verbose_ = flag;
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,6 +56,7 @@ namespace Foam
{ {
// Forward Declarations // Forward Declarations
class dictionary;
class polyMesh; class polyMesh;
class bitSet; class bitSet;
class topoSet; class topoSet;
@ -151,7 +152,7 @@ protected:
//- Reference to the mesh //- Reference to the mesh
const polyMesh& mesh_; const polyMesh& mesh_;
//- Verbosity (default: true) //- Output verbosity (default: true)
bool verbose_; bool verbose_;
@ -294,8 +295,12 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from mesh, with preferred verbosity
explicit topoSetSource(const polyMesh& mesh); explicit topoSetSource(const polyMesh& mesh, bool verbose = true);
//- Construct from mesh, use "verbose" entry if present
topoSetSource(const polyMesh& mesh, const dictionary& dict);
//- Clone (disallowed) //- Clone (disallowed)
autoPtr<topoSetSource> clone() const autoPtr<topoSetSource> clone() const
@ -331,23 +336,29 @@ public:
// Member Functions // Member Functions
//- Reference to the mesh //- Reference to the mesh
const polyMesh& mesh() const const polyMesh& mesh() const noexcept
{ {
return mesh_; return mesh_;
} }
//- Return the current verbosity //- Get output verbosity
bool verbose() const bool verbose() const noexcept
{ {
return verbose_; return verbose_;
} }
//- Set the current verbosity //- Enable/disable verbose output
void verbose(bool on) // \return old value
bool verbose(bool on) noexcept
{ {
bool old(verbose_);
verbose_ = on; verbose_ = on;
return old;
} }
//- Use "verbose" entry (if present) to enable/disable verbose output
void verbose(const dictionary& dict);
// Member Functions // Member Functions