diff --git a/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H b/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H index 01b4294ca7..5c00ed1a2c 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H +++ b/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -148,6 +148,12 @@ public: Sine(rhs) {} + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp>(new Cosine(*this)); + } + //- Destructor virtual ~Cosine() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H index af56fac6d9..121165fa05 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -71,8 +71,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1_H -#define Function1_H +#ifndef Foam_Function1_H +#define Foam_Function1_H #include "function1Base.H" #include "Field.H" @@ -241,10 +241,7 @@ public: // Member Functions //- Is value constant (i.e. independent of x) - virtual bool constant() const - { - return false; - } + virtual bool constant() const { return false; } // Evaluation diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H b/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H index 42b0efdcb7..7b5fbb1149 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef function1Base_H -#define function1Base_H +#ifndef Foam_function1Base_H +#define Foam_function1Base_H #include "dictionary.H" #include "objectRegistry.H" diff --git a/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H b/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H index 4fee1ef60d..c7edfc49fe 100644 --- a/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H +++ b/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H @@ -201,6 +201,12 @@ public: //- Copy construct explicit InputValueMapper(const InputValueMapper& rhs); + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp>(new InputValueMapper(*this)); + } + //- Destructor virtual ~InputValueMapper() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H b/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H index f73f3446a9..64ffd6e428 100644 --- a/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H +++ b/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H @@ -69,8 +69,8 @@ public: // Generated Methods - //- Default copy constructor - None(const None& rhs) = default; + //- Default copy construct + None(const None&) = default; //- No copy assignment void operator=(const None&) = delete; diff --git a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H index 2981578177..84d496afb2 100644 --- a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H +++ b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -69,6 +69,9 @@ public: // Generated Methods + //- Default copy construct + OneConstant(const OneConstant&) = default; + //- No copy assignment void operator=(const OneConstant&) = delete; @@ -107,10 +110,16 @@ public: virtual inline bool constant() const { return true; } //- Return constant value - virtual inline Type value(const scalar) const; + virtual inline Type value(const scalar) const + { + return pTraits::one; + } //- Integrate between two values - virtual inline Type integrate(const scalar x1, const scalar x2) const; + virtual inline Type integrate(const scalar x1, const scalar x2) const + { + return (x2 - x1)*pTraits::one; + } //- Return value as a function of (scalar) independent variable virtual tmp> value(const scalarField& x) const; @@ -134,8 +143,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "OneConstantI.H" - #ifdef NoRepository #include "OneConstant.C" #endif diff --git a/src/OpenFOAM/primitives/functions/Function1/One/OneConstantI.H b/src/OpenFOAM/primitives/functions/Function1/One/OneConstantI.H deleted file mode 100644 index 70f5d7868b..0000000000 --- a/src/OpenFOAM/primitives/functions/Function1/One/OneConstantI.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2017 OpenFOAM Foundation -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "OneConstant.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -inline Type Foam::Function1Types::OneConstant::value(const scalar x) const -{ - return pTraits::one; -} - - -template -inline Type Foam::Function1Types::OneConstant::integrate -( - const scalar x1, - const scalar x2 -) const -{ - return (x2 - x1)*pTraits::one; -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H index e600882dce..fe3c7ff0a6 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H +++ b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H @@ -133,6 +133,12 @@ public: //- Copy construct explicit Scale(const Scale& rhs); + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp>(new Scale(*this)); + } + //- Destructor virtual ~Scale() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H index 3414cbfd6b..58f255cba3 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -192,6 +192,12 @@ public: //- Copy construct explicit Sine(const Sine& rhs); + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp>(new Sine(*this)); + } + //- Destructor virtual ~Sine() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H index 660839359f..0aa61cf6c5 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H +++ b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H @@ -155,6 +155,12 @@ public: //- Copy construct explicit Square(const Square& rhs); + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp>(new Square(*this)); + } + //- Destructor virtual ~Square() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H index 2edc75a261..1b17a7a355 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H +++ b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -69,8 +69,8 @@ public: // Generated Methods - //- Copy construct - Uniform(const Uniform&) = default; + //- Default copy construct + Uniform(const Uniform&) = default; //- No copy assignment void operator=(const Uniform&) = delete; @@ -88,6 +88,12 @@ public: : Constant(entryName, dict, obrPtr) {} + + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp>(new Uniform(*this)); + } }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C index 63cfa2a71f..811baa8ff6 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C +++ b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H index de270d0b71..3437ffc4a1 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H +++ b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,6 +78,9 @@ public: // Generated Methods + //- Default copy construct + ZeroConstant(const ZeroConstant&) = default; + //- No copy assignment void operator=(const ZeroConstant&) = delete; @@ -99,6 +102,12 @@ public: const objectRegistry* obrPtr = nullptr ); + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp>(new ZeroConstant(*this)); + } + //- Destructor virtual ~ZeroConstant() = default; @@ -110,10 +119,16 @@ public: virtual inline bool constant() const { return true; } //- Return constant value - virtual inline Type value(const scalar) const; + virtual inline Type value(const scalar) const + { + return pTraits::zero; + } //- Integrate between two values - virtual inline Type integrate(const scalar x1, const scalar x2) const; + virtual inline Type integrate(const scalar x1, const scalar x2) const + { + return pTraits::zero; + } //- Write as primitive (inline) format virtual void writeData(Ostream& os) const; @@ -127,8 +142,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "ZeroConstantI.H" - #ifdef NoRepository #include "ZeroConstant.C" #endif diff --git a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstantI.H b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstantI.H deleted file mode 100644 index cb7a0d3fd1..0000000000 --- a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstantI.H +++ /dev/null @@ -1,53 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2017 OpenFOAM Foundation -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "ZeroConstant.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -inline Type Foam::Function1Types::ZeroConstant::value -( - const scalar x -) const -{ - return pTraits::zero; -} - - -template -inline Type Foam::Function1Types::ZeroConstant::integrate -( - const scalar x1, - const scalar x2 -) const -{ - return pTraits::zero; -} - - -// ************************************************************************* // diff --git a/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H b/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H index 56a7994c46..936b4512ce 100644 --- a/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H +++ b/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H @@ -43,8 +43,8 @@ SeeAlso \*---------------------------------------------------------------------------*/ -#ifndef PatchFunction1_H -#define PatchFunction1_H +#ifndef Foam_PatchFunction1_H +#define Foam_PatchFunction1_H #include "patchFunction1Base.H" #include "coordinateScaling.H" diff --git a/src/meshTools/PatchFunction1/PatchFunction1/patchFunction1Base.H b/src/meshTools/PatchFunction1/PatchFunction1/patchFunction1Base.H index 6efc2589d5..49d30f4b31 100644 --- a/src/meshTools/PatchFunction1/PatchFunction1/patchFunction1Base.H +++ b/src/meshTools/PatchFunction1/PatchFunction1/patchFunction1Base.H @@ -39,8 +39,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef patchFunction1Base_H -#define patchFunction1Base_H +#ifndef Foam_patchFunction1Base_H +#define Foam_patchFunction1Base_H #include "dictionary.H" #include "polyPatch.H"