Function1s, Function2s: Remove unnecessary read methods and improve const-ness
This commit is contained in:
@ -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<class Type>
|
||||
void Foam::Function1s::Dimensioned<Type>::read
|
||||
Foam::Function1s::Dimensioned<Type>::Dimensioned
|
||||
(
|
||||
const word& name,
|
||||
const dimensionSet& xDimensions,
|
||||
const dimensionSet& dimensions,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<Type, Dimensioned<Type>>(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<Type>::read
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::Dimensioned<Type>::Dimensioned
|
||||
(
|
||||
const word& name,
|
||||
const dimensionSet& xDimensions,
|
||||
const dimensionSet& dimensions,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<Type, Dimensioned<Type>>(name),
|
||||
xUnits_(word::null, xDimensions, scalar(1)),
|
||||
units_(word::null, dimensions, scalar(1)),
|
||||
value_(nullptr)
|
||||
{
|
||||
read(name, dict);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::Dimensioned<Type>::Dimensioned(const Dimensioned<Type>& df1)
|
||||
:
|
||||
|
||||
@ -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<Function1<Type>> 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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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<Tuple2<Type, Type>> coeffs_;
|
||||
const List<Tuple2<Type, Type>> coeffs_;
|
||||
|
||||
//- Flag to indicate whether the function can be integrated
|
||||
bool integrable_;
|
||||
|
||||
@ -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<class Function1Type>
|
||||
void Foam::Function1s::Ramp<Function1Type>::read(const dictionary& dict)
|
||||
{
|
||||
start_ = dict.lookupOrDefault<scalar>("start", 0);
|
||||
duration_ = dict.lookup<scalar>("duration");
|
||||
}
|
||||
|
||||
|
||||
template<class Function1Type>
|
||||
Foam::Function1s::Ramp<Function1Type>::Ramp
|
||||
(
|
||||
@ -42,10 +34,10 @@ Foam::Function1s::Ramp<Function1Type>::Ramp
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<scalar, Function1Type>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
FieldFunction1<scalar, Function1Type>(name),
|
||||
start_(dict.lookupOrDefault<scalar>("start", 0)),
|
||||
duration_(dict.lookup<scalar>("duration"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<class Type>
|
||||
void Foam::Function1s::Scale<Type>::read(const dictionary& dict)
|
||||
{
|
||||
scale_ = Function1<scalar>::New("scale", dict);
|
||||
xScale_ =
|
||||
dict.found("xScale")
|
||||
? Function1<scalar>::New("xScale", dict)
|
||||
: autoPtr<Function1<scalar>>(new Constant<scalar>("xScale", 1));
|
||||
value_ = Function1<Type>::New("value", dict);
|
||||
|
||||
integrableScale_ = xScale_->constant() && scale_->constant();
|
||||
integrableValue_ = xScale_->constant() && value_->constant();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -69,10 +52,18 @@ Foam::Function1s::Scale<Type>::Scale
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<Type, Scale<Type>>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
FieldFunction1<Type, Scale<Type>>(name),
|
||||
scale_(Function1<scalar>::New("scale", dict)),
|
||||
xScale_
|
||||
(
|
||||
dict.found("xScale")
|
||||
? Function1<scalar>::New("xScale", dict)
|
||||
: autoPtr<Function1<scalar>>(new Constant<scalar>("xScale", 1))
|
||||
),
|
||||
value_(Function1<Type>::New("value", dict)),
|
||||
integrableScale_(xScale_->constant() && scale_->constant()),
|
||||
integrableValue_(xScale_->constant() && value_->constant())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -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<Function1<scalar>> scale_;
|
||||
const autoPtr<Function1<scalar>> scale_;
|
||||
|
||||
//- Argument scaling function
|
||||
autoPtr<Function1<scalar>> xScale_;
|
||||
const autoPtr<Function1<scalar>> xScale_;
|
||||
|
||||
//- Value function
|
||||
autoPtr<Function1<Type>> value_;
|
||||
const autoPtr<Function1<Type>> 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:
|
||||
|
||||
@ -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<class Type>
|
||||
void Foam::Function1s::Sine<Type>::read(const dictionary& dict)
|
||||
{
|
||||
amplitude_ = Function1<Type>::New("amplitude", dict);
|
||||
frequency_ = dict.lookup<scalar>("frequency");
|
||||
start_ = dict.lookupOrDefault<scalar>("start", 0);
|
||||
level_ = Function1<Type>::New("level", dict);
|
||||
|
||||
integrable_ = amplitude_->constant() && level_->constant();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -48,10 +34,13 @@ Foam::Function1s::Sine<Type>::Sine
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<Type, Sine<Type>>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
FieldFunction1<Type, Sine<Type>>(name),
|
||||
amplitude_(Function1<Type>::New("amplitude", dict)),
|
||||
frequency_(dict.lookup<scalar>("frequency")),
|
||||
start_(dict.lookupOrDefault<scalar>("start", 0)),
|
||||
level_(Function1<Type>::New("level", dict)),
|
||||
integrable_(amplitude_->constant() && level_->constant())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -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<Function1<Type>> amplitude_;
|
||||
const autoPtr<Function1<Type>> 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<Function1<Type>> level_;
|
||||
const autoPtr<Function1<Type>> 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:
|
||||
|
||||
@ -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<class Type>
|
||||
void Foam::Function1s::Square<Type>::read(const dictionary& dict)
|
||||
{
|
||||
amplitude_ = Function1<Type>::New("amplitude", dict);
|
||||
frequency_ = dict.lookup<scalar>("frequency");
|
||||
start_ = dict.lookupOrDefault<scalar>("start", 0);
|
||||
level_ = Function1<Type>::New("level", dict);
|
||||
markSpace_ = dict.lookupOrDefault<scalar>("markSpace", 1);
|
||||
|
||||
integrable_ = amplitude_->constant() && level_->constant();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -49,10 +34,14 @@ Foam::Function1s::Square<Type>::Square
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<Type, Square<Type>>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
FieldFunction1<Type, Square<Type>>(name),
|
||||
amplitude_(Function1<Type>::New("amplitude", dict)),
|
||||
frequency_(dict.lookup<scalar>("frequency")),
|
||||
start_(dict.lookupOrDefault<scalar>("start", 0)),
|
||||
level_(Function1<Type>::New("level", dict)),
|
||||
markSpace_(dict.lookupOrDefault<scalar>("markSpace", 1)),
|
||||
integrable_(amplitude_->constant() && level_->constant())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -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<Function1<Type>> amplitude_;
|
||||
const autoPtr<Function1<Type>> 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<Function1<Type>> level_;
|
||||
const autoPtr<Function1<Type>> 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:
|
||||
|
||||
@ -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<scalar>::New("rpm", dict).ptr()
|
||||
: Function1<scalar>::New("omega", dict).ptr()
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::Function1s::omega::write(Ostream& os) const
|
||||
{
|
||||
writeEntry(os, omega_());
|
||||
|
||||
@ -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<Function1<scalar>> omega_;
|
||||
const autoPtr<Function1<scalar>> 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;
|
||||
|
||||
|
||||
@ -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<scalar>("start", 0);
|
||||
duration_ = dict.lookup<scalar>("duration");
|
||||
}
|
||||
|
||||
|
||||
Foam::Function1s::squarePulse::squarePulse
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<scalar, squarePulse>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
FieldFunction1<scalar, squarePulse>(name),
|
||||
start_(dict.lookupOrDefault<scalar>("start", 0)),
|
||||
duration_(dict.lookup<scalar>("duration"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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<class Type>
|
||||
void Foam::Function2s::Scale<Type>::read(const dictionary& dict)
|
||||
{
|
||||
scale_ = Function2<scalar>::New("scale", dict);
|
||||
xScale_ =
|
||||
dict.found("xScale")
|
||||
? Function1<scalar>::New("xScale", dict)
|
||||
: autoPtr<Function1<scalar>>
|
||||
(
|
||||
new Function1s::Constant<scalar>("xScale", 1)
|
||||
);
|
||||
yScale_ =
|
||||
dict.found("yScale")
|
||||
? Function1<scalar>::New("yScale", dict)
|
||||
: autoPtr<Function1<scalar>>
|
||||
(
|
||||
new Function1s::Constant<scalar>("yScale", 1)
|
||||
);
|
||||
value_ = Function2<Type>::New("value", dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -58,10 +34,28 @@ Foam::Function2s::Scale<Type>::Scale
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction2<Type, Scale<Type>>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
FieldFunction2<Type, Scale<Type>>(name),
|
||||
scale_(Function2<scalar>::New("scale", dict)),
|
||||
xScale_
|
||||
(
|
||||
dict.found("xScale")
|
||||
? Function1<scalar>::New("xScale", dict)
|
||||
: autoPtr<Function1<scalar>>
|
||||
(
|
||||
new Function1s::Constant<scalar>("xScale", 1)
|
||||
)
|
||||
),
|
||||
yScale_
|
||||
(
|
||||
dict.found("yScale")
|
||||
? Function1<scalar>::New("yScale", dict)
|
||||
: autoPtr<Function1<scalar>>
|
||||
(
|
||||
new Function1s::Constant<scalar>("yScale", 1)
|
||||
)
|
||||
),
|
||||
value_(Function2<Type>::New("value", dict))
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -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<Function2<scalar>> scale_;
|
||||
const autoPtr<Function2<scalar>> scale_;
|
||||
|
||||
//- Argument scaling function
|
||||
autoPtr<Function1<scalar>> xScale_;
|
||||
const autoPtr<Function1<scalar>> xScale_;
|
||||
|
||||
//- Argument scaling function
|
||||
autoPtr<Function1<scalar>> yScale_;
|
||||
const autoPtr<Function1<scalar>> yScale_;
|
||||
|
||||
//- Value function
|
||||
autoPtr<Function2<Type>> value_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read the coefficients from the given dictionary
|
||||
void read(const dictionary& dict);
|
||||
const autoPtr<Function2<Type>> value_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<scalar>("exponent", 1.0/7.0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Function1s::turbulentBL::turbulentBL
|
||||
@ -52,10 +44,9 @@ Foam::Function1s::turbulentBL::turbulentBL
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldFunction1<scalar, turbulentBL>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
FieldFunction1<scalar, turbulentBL>(name),
|
||||
exponent_(dict.lookupOrDefault<scalar>("exponent", 1.0/7.0))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -36,15 +36,6 @@ namespace Function1s
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::Function1s::crankConnectingRodMotion::read(const dictionary& dict)
|
||||
{
|
||||
conRodLength_ = dict.lookup<scalar>("conRodLength");
|
||||
stroke_ = dict.lookup<scalar>("stroke");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Function1s::crankConnectingRodMotion::crankConnectingRodMotion
|
||||
@ -53,10 +44,10 @@ Foam::Function1s::crankConnectingRodMotion::crankConnectingRodMotion
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Function1<scalar>(name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
Function1<scalar>(name),
|
||||
conRodLength_(dict.lookup<scalar>("conRodLength")),
|
||||
stroke_(dict.lookup<scalar>("stroke"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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<Function1s::omega> omega_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user