diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index e6934f5c71..11219e9d23 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -967,7 +967,6 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const { - label nextPatchStart = mesh().nInternalFaces(); const polyBoundaryMesh& bm = *this; bool hasError = false; @@ -976,20 +975,6 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const forAll(bm, patchi) { - if (bm[patchi].start() != nextPatchStart && !hasError) - { - hasError = true; - - Info<< " ****Problem with boundary patch " << patchi - << " named " << bm[patchi].name() - << " of type " << bm[patchi].type() - << ". The patch should start on face no " << nextPatchStart - << " and the patch specifies " << bm[patchi].start() - << "." << endl - << "Possibly consecutive patches have this same problem." - << " Suppressing future warnings." << endl; - } - if (!patchNames.insert(bm[patchi].name()) && !hasError) { hasError = true; @@ -1000,8 +985,6 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const << "." << endl << "Suppressing future warnings." << endl; } - - nextPatchStart += bm[patchi].size(); } reduce(hasError, orOp()); diff --git a/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.C b/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.C index fa62929350..d43d54d1fc 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.C +++ b/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,14 +113,22 @@ inline void lookupUnitsIfPresent } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -void Foam::Function1s::Dimensioned::read +Foam::Function1s::Dimensioned::Dimensioned ( const word& name, + const dimensionSet& xDimensions, + const dimensionSet& dimensions, const dictionary& dict ) +: + FieldFunction1>(name), + xUnits_(word::null, xDimensions, scalar(1)), + units_(word::null, dimensions, scalar(1)), + value_(nullptr) { // If the function is a dictionary (preferred) then read straightforwardly if (dict.isDict(name)) @@ -191,26 +199,6 @@ void Foam::Function1s::Dimensioned::read } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::Function1s::Dimensioned::Dimensioned -( - const word& name, - const dimensionSet& xDimensions, - const dimensionSet& dimensions, - const dictionary& dict -) -: - FieldFunction1>(name), - xUnits_(word::null, xDimensions, scalar(1)), - units_(word::null, dimensions, scalar(1)), - value_(nullptr) -{ - read(name, dict); -} - - template Foam::Function1s::Dimensioned::Dimensioned(const Dimensioned& df1) : diff --git a/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.H b/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.H index 983d90472b..38d0104198 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.H +++ b/src/OpenFOAM/primitives/functions/Function1/Dimensioned/DimensionedFunction1.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,14 +100,6 @@ class Dimensioned autoPtr> value_; - // Private Member Functions - - //- Read the coefficients from the given dictionary. Note that this is - // the outer dictionary, not the coefficients dictionary, as is the - // case for most/all other Function1-s. - void read(const word& name, const dictionary& dict); - - public: // Runtime type information diff --git a/src/OpenFOAM/primitives/functions/Function1/None/None.H b/src/OpenFOAM/primitives/functions/Function1/None/None.H index 592e6e905a..bfb5fa9342 100644 --- a/src/OpenFOAM/primitives/functions/Function1/None/None.H +++ b/src/OpenFOAM/primitives/functions/Function1/None/None.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,7 @@ class None // Private member data //- Name of dictionary from which this function is instantiated - fileName dictName_; + const fileName dictName_; public: diff --git a/src/OpenFOAM/primitives/functions/Function1/Polynomial1/Polynomial1.H b/src/OpenFOAM/primitives/functions/Function1/Polynomial1/Polynomial1.H index 1d90377ad6..bd343c1e88 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Polynomial1/Polynomial1.H +++ b/src/OpenFOAM/primitives/functions/Function1/Polynomial1/Polynomial1.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,7 +68,7 @@ class Polynomial // Private Data //- Polynomial coefficients - list of prefactor, exponent - List> coeffs_; + const List> coeffs_; //- Flag to indicate whether the function can be integrated bool integrable_; diff --git a/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.C b/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.C index 9738b0fd7e..16482417bf 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.C +++ b/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,14 +27,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -void Foam::Function1s::Ramp::read(const dictionary& dict) -{ - start_ = dict.lookupOrDefault("start", 0); - duration_ = dict.lookup("duration"); -} - - template Foam::Function1s::Ramp::Ramp ( @@ -42,10 +34,10 @@ Foam::Function1s::Ramp::Ramp const dictionary& dict ) : - FieldFunction1(name) -{ - read(dict); -} + FieldFunction1(name), + start_(dict.lookupOrDefault("start", 0)), + duration_(dict.lookup("duration")) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.H b/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.H index e176c5e2a3..b194892ebf 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.H +++ b/src/OpenFOAM/primitives/functions/Function1/Ramp/Ramp.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -108,10 +108,10 @@ protected: // Protected data //- Start-time of the ramp function - scalar start_; + const scalar start_; //- Duration of the ramp function - scalar duration_; + const scalar duration_; //- Return the end-time of the ramp function inline scalar end() const @@ -134,14 +134,6 @@ protected: } -private: - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); - - public: // Constructors diff --git a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C index a55dded1fb..43380748c3 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C +++ b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,23 +25,6 @@ License #include "Scale.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void Foam::Function1s::Scale::read(const dictionary& dict) -{ - scale_ = Function1::New("scale", dict); - xScale_ = - dict.found("xScale") - ? Function1::New("xScale", dict) - : autoPtr>(new Constant("xScale", 1)); - value_ = Function1::New("value", dict); - - integrableScale_ = xScale_->constant() && scale_->constant(); - integrableValue_ = xScale_->constant() && value_->constant(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -69,10 +52,18 @@ Foam::Function1s::Scale::Scale const dictionary& dict ) : - FieldFunction1>(name) -{ - read(dict); -} + FieldFunction1>(name), + scale_(Function1::New("scale", dict)), + xScale_ + ( + dict.found("xScale") + ? Function1::New("xScale", dict) + : autoPtr>(new Constant("xScale", 1)) + ), + value_(Function1::New("value", dict)), + integrableScale_(xScale_->constant() && scale_->constant()), + integrableValue_(xScale_->constant() && value_->constant()) +{} template diff --git a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H index 77c89b72a4..116d821202 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H +++ b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -141,25 +141,19 @@ class Scale // Private Data //- Scalar scaling function - autoPtr> scale_; + const autoPtr> scale_; //- Argument scaling function - autoPtr> xScale_; + const autoPtr> xScale_; //- Value function - autoPtr> value_; + const autoPtr> value_; //- Is this function integrable? - bool integrableScale_; + const bool integrableScale_; //- Is this function integrable? - bool integrableValue_; - - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); + const bool integrableValue_; public: diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C index 2fcf26397b..a5499fbd29 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,20 +25,6 @@ License #include "Sine.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void Foam::Function1s::Sine::read(const dictionary& dict) -{ - amplitude_ = Function1::New("amplitude", dict); - frequency_ = dict.lookup("frequency"); - start_ = dict.lookupOrDefault("start", 0); - level_ = Function1::New("level", dict); - - integrable_ = amplitude_->constant() && level_->constant(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -48,10 +34,13 @@ Foam::Function1s::Sine::Sine const dictionary& dict ) : - FieldFunction1>(name) -{ - read(dict); -} + FieldFunction1>(name), + amplitude_(Function1::New("amplitude", dict)), + frequency_(dict.lookup("frequency")), + start_(dict.lookupOrDefault("start", 0)), + level_(Function1::New("level", dict)), + integrable_(amplitude_->constant() && level_->constant()) +{} template diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H index aab9008ce0..72dfa3b783 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -94,25 +94,19 @@ class Sine // Private Data //- Amplitude of the sine function - autoPtr> amplitude_; + const autoPtr> amplitude_; //- Frequency of the sine function - scalar frequency_; + const scalar frequency_; //- Argument offset - scalar start_; + const scalar start_; //- Level to which the sine function is added - autoPtr> level_; + const autoPtr> level_; //- Is this function integrable? - bool integrable_; - - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); + const bool integrable_; public: diff --git a/src/OpenFOAM/primitives/functions/Function1/Square/Square.C b/src/OpenFOAM/primitives/functions/Function1/Square/Square.C index 27ec268f44..721872572c 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Square/Square.C +++ b/src/OpenFOAM/primitives/functions/Function1/Square/Square.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,21 +25,6 @@ License #include "Square.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void Foam::Function1s::Square::read(const dictionary& dict) -{ - amplitude_ = Function1::New("amplitude", dict); - frequency_ = dict.lookup("frequency"); - start_ = dict.lookupOrDefault("start", 0); - level_ = Function1::New("level", dict); - markSpace_ = dict.lookupOrDefault("markSpace", 1); - - integrable_ = amplitude_->constant() && level_->constant(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -49,10 +34,14 @@ Foam::Function1s::Square::Square const dictionary& dict ) : - FieldFunction1>(name) -{ - read(dict); -} + FieldFunction1>(name), + amplitude_(Function1::New("amplitude", dict)), + frequency_(dict.lookup("frequency")), + start_(dict.lookupOrDefault("start", 0)), + level_(Function1::New("level", dict)), + markSpace_(dict.lookupOrDefault("markSpace", 1)), + integrable_(amplitude_->constant() && level_->constant()) +{} template diff --git a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H index 71cb5bf2bd..b6bc8bee76 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H +++ b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,30 +100,24 @@ class Square // Private Data //- Scalar amplitude of the square function - autoPtr> amplitude_; + const autoPtr> amplitude_; //- Frequency of the square function - scalar frequency_; + const scalar frequency_; //- Argument offset - scalar start_; + const scalar start_; //- Level to which the square function is added - autoPtr> level_; + const autoPtr> level_; //- Mark/space ratio of the square function; the fraction of one period // in which the function value is at the higher of the two possible // values. - scalar markSpace_; + const scalar markSpace_; //- Is this function integrable? - bool integrable_; - - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); + const bool integrable_; public: diff --git a/src/OpenFOAM/primitives/functions/Function1/omega/omega.C b/src/OpenFOAM/primitives/functions/Function1/omega/omega.C index 0b80d846ee..b44781e8f8 100644 --- a/src/OpenFOAM/primitives/functions/Function1/omega/omega.C +++ b/src/OpenFOAM/primitives/functions/Function1/omega/omega.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,13 +28,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::Function1s::omega::omega() -: - rpm_(false), - omegaFactor_(1) -{} - - Foam::Function1s::omega::omega(const dictionary& dict) : rpm_(dict.found("rpm")), @@ -58,22 +51,6 @@ Foam::Function1s::omega::omega(const omega& o) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::Function1s::omega::read(const dictionary& dict) -{ - rpm_ = dict.found("rpm"); - omegaFactor_ = rpm_ ? constant::mathematical::pi/30.0 : 1; - - omega_.reset - ( - rpm_ - ? Function1::New("rpm", dict).ptr() - : Function1::New("omega", dict).ptr() - ); - - return true; -} - - void Foam::Function1s::omega::write(Ostream& os) const { writeEntry(os, omega_()); diff --git a/src/OpenFOAM/primitives/functions/Function1/omega/omega.H b/src/OpenFOAM/primitives/functions/Function1/omega/omega.H index 0c9fcf0615..fede1c675d 100644 --- a/src/OpenFOAM/primitives/functions/Function1/omega/omega.H +++ b/src/OpenFOAM/primitives/functions/Function1/omega/omega.H @@ -110,22 +110,19 @@ class omega // Private Data //- True if the input specification is rpm rather than omega - bool rpm_; + const bool rpm_; //- 1 for omega, pi/30 for rpm - scalar omegaFactor_; + const scalar omegaFactor_; //- The omega function - autoPtr> omega_; + const autoPtr> omega_; public: // Constructors - //- Construct null - omega(); - //- Construct from dictionary omega(const dictionary& dict); @@ -135,9 +132,6 @@ public: // Member Functions - //- Update omega function from given dictionary - bool read(const dictionary& dict); - //- Return value for time t inline scalar value(const scalar t) const; diff --git a/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.C b/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.C index b762decb35..1268096f97 100644 --- a/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.C +++ b/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,23 +38,16 @@ namespace Function1s // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -void Foam::Function1s::squarePulse::read(const dictionary& dict) -{ - start_ = dict.lookupOrDefault("start", 0); - duration_ = dict.lookup("duration"); -} - - Foam::Function1s::squarePulse::squarePulse ( const word& name, const dictionary& dict ) : - FieldFunction1(name) -{ - read(dict); -} + FieldFunction1(name), + start_(dict.lookupOrDefault("start", 0)), + duration_(dict.lookup("duration")) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.H b/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.H index a98b140fdf..2db4fc7fca 100644 --- a/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.H +++ b/src/OpenFOAM/primitives/functions/Function1/squarePulse/squarePulse.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,15 +86,10 @@ class squarePulse // Private data //- Start-time of the ramp function - scalar start_; + const scalar start_; //- Duration of the ramp function - scalar duration_; - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); + const scalar duration_; public: diff --git a/src/OpenFOAM/primitives/functions/Function2/None/None2.H b/src/OpenFOAM/primitives/functions/Function2/None/None2.H index 131512c658..a2a856b236 100644 --- a/src/OpenFOAM/primitives/functions/Function2/None/None2.H +++ b/src/OpenFOAM/primitives/functions/Function2/None/None2.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,7 @@ class None // Private member data //- Name of dictionary from which this function is instantiated - fileName dictName_; + const fileName dictName_; public: diff --git a/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.C b/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.C index 3fc8c432b3..50252d1dd6 100644 --- a/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.C +++ b/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,30 +25,6 @@ License #include "Scale2.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void Foam::Function2s::Scale::read(const dictionary& dict) -{ - scale_ = Function2::New("scale", dict); - xScale_ = - dict.found("xScale") - ? Function1::New("xScale", dict) - : autoPtr> - ( - new Function1s::Constant("xScale", 1) - ); - yScale_ = - dict.found("yScale") - ? Function1::New("yScale", dict) - : autoPtr> - ( - new Function1s::Constant("yScale", 1) - ); - value_ = Function2::New("value", dict); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -58,10 +34,28 @@ Foam::Function2s::Scale::Scale const dictionary& dict ) : - FieldFunction2>(name) -{ - read(dict); -} + FieldFunction2>(name), + scale_(Function2::New("scale", dict)), + xScale_ + ( + dict.found("xScale") + ? Function1::New("xScale", dict) + : autoPtr> + ( + new Function1s::Constant("xScale", 1) + ) + ), + yScale_ + ( + dict.found("yScale") + ? Function1::New("yScale", dict) + : autoPtr> + ( + new Function1s::Constant("yScale", 1) + ) + ), + value_(Function2::New("value", dict)) +{} template diff --git a/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.H b/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.H index 1631d2212e..49dd1ba5cb 100644 --- a/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.H +++ b/src/OpenFOAM/primitives/functions/Function2/Scale/Scale2.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,22 +63,16 @@ class Scale // Private Data //- Scalar scaling function - autoPtr> scale_; + const autoPtr> scale_; //- Argument scaling function - autoPtr> xScale_; + const autoPtr> xScale_; //- Argument scaling function - autoPtr> yScale_; + const autoPtr> yScale_; //- Value function - autoPtr> value_; - - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); + const autoPtr> value_; public: diff --git a/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H b/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H index 3ed8061b63..ba9d3ff9fe 100644 --- a/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H +++ b/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.C index e428edee88..5bc321d8c3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,14 +36,6 @@ namespace Function1s } -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -void Foam::Function1s::turbulentBL::read(const dictionary& dict) -{ - exponent_ = dict.lookupOrDefault("exponent", 1.0/7.0); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::Function1s::turbulentBL::turbulentBL @@ -52,10 +44,9 @@ Foam::Function1s::turbulentBL::turbulentBL const dictionary& dict ) : - FieldFunction1(name) -{ - read(dict); -} + FieldFunction1(name), + exponent_(dict.lookupOrDefault("exponent", 1.0/7.0)) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.H b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.H index 9fe44d35f1..a7a30cfe34 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/turbulentBL/turbulentBL.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,13 +75,7 @@ class turbulentBL // Private data //- Exponent of the pow function - scalar exponent_; - - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); + const scalar exponent_; public: diff --git a/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.C b/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.C index c2bbec6eb0..9eb6f186d9 100644 --- a/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.C +++ b/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.C @@ -36,15 +36,6 @@ namespace Function1s } -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -void Foam::Function1s::crankConnectingRodMotion::read(const dictionary& dict) -{ - conRodLength_ = dict.lookup("conRodLength"); - stroke_ = dict.lookup("stroke"); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::Function1s::crankConnectingRodMotion::crankConnectingRodMotion @@ -53,10 +44,10 @@ Foam::Function1s::crankConnectingRodMotion::crankConnectingRodMotion const dictionary& dict ) : - Function1(name) -{ - read(dict); -} + Function1(name), + conRodLength_(dict.lookup("conRodLength")), + stroke_(dict.lookup("stroke")) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.H b/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.H index a72acc1306..1336f5d2d3 100644 --- a/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.H +++ b/src/fvMeshMovers/multiValveEngine/crankConnectingRodMotion/crankConnectingRodMotion.H @@ -73,16 +73,10 @@ class crankConnectingRodMotion // Private data //- Connecting-rod length - scalar conRodLength_; + const scalar conRodLength_; //- Stroke - scalar stroke_; - - - // Private Member Functions - - //- Read the coefficients from the given dictionary - void read(const dictionary& dict); + const scalar stroke_; public: diff --git a/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C b/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C index cbb16a77c5..161fa64b2b 100644 --- a/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C +++ b/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ Foam::solidBodyMotionFunctions::rotatingMotion::rotatingMotion solidBodyMotionFunction(SBMFCoeffs, runTime), origin_(SBMFCoeffs_.lookup("origin")), axis_(SBMFCoeffs_.lookup("axis")), - omega_(SBMFCoeffs_) + omega_(new Function1s::omega(SBMFCoeffs_)) {} @@ -75,7 +75,7 @@ Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const const scalar t = time_.value(); // Rotation around axis - const scalar angle = omega_.integral(0, t); + const scalar angle = omega_->integral(0, t); const quaternion R(axis_, angle); const septernion TR(septernion(-origin_)*R*septernion(origin_)); @@ -93,7 +93,7 @@ bool Foam::solidBodyMotionFunctions::rotatingMotion::read { solidBodyMotionFunction::read(SBMFCoeffs); - omega_.read(SBMFCoeffs); + omega_.reset(new Function1s::omega(SBMFCoeffs)); return true; } diff --git a/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.H b/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.H index bc8a9ee6c5..7ab102250f 100644 --- a/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.H +++ b/src/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -66,7 +66,7 @@ class rotatingMotion const vector axis_; //- Angular velocity (rad/sec) - Function1s::omega omega_; + autoPtr omega_; public: diff --git a/src/thermophysicalModels/specie/thermophysicalFunctions/APIdiffCoef/APIdiffCoef.H b/src/thermophysicalModels/specie/thermophysicalFunctions/APIdiffCoef/APIdiffCoef.H index 95683d8c6a..b48d483dbb 100644 --- a/src/thermophysicalModels/specie/thermophysicalFunctions/APIdiffCoef/APIdiffCoef.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/APIdiffCoef/APIdiffCoef.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,10 +58,10 @@ class APIdiffCoef // Private Data // API vapour mass diffusivity function coefficients - scalar a_, b_, wf_, wa_; + const scalar a_, b_, wf_, wa_; // Helper variables - scalar alpha_, beta_; + const scalar alpha_, beta_; public: