Function1: Preferentially construct from separate unit conversion arguments
This commit is contained in:
@ -161,7 +161,8 @@ int main(int argc, char *argv[])
|
||||
Function1s::Table<scalar> pData
|
||||
(
|
||||
"pressure",
|
||||
{dimTime, dimPressure},
|
||||
dimTime,
|
||||
dimPressure,
|
||||
dict.subDict("pressureData")
|
||||
);
|
||||
|
||||
|
||||
@ -59,7 +59,8 @@ codeRead
|
||||
const Function1s::Table<scalar> initialDistribution
|
||||
(
|
||||
"initialDistribution",
|
||||
{dimLength, dimless},
|
||||
dimLength,
|
||||
dimless,
|
||||
dictionary
|
||||
(
|
||||
"format", "foam",
|
||||
|
||||
@ -27,6 +27,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::None<Type>::None(const word& name)
|
||||
:
|
||||
FieldFunction1<Type, None<Type>>(name),
|
||||
dictName_("unknown")
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::None<Type>::None
|
||||
(
|
||||
|
||||
@ -64,6 +64,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name
|
||||
None(const word& name);
|
||||
|
||||
//- Construct from name and dictionary
|
||||
None
|
||||
(
|
||||
|
||||
@ -95,8 +95,8 @@ void Foam::Function1s::Scale<Type>::write
|
||||
const unitConversions& units
|
||||
) const
|
||||
{
|
||||
writeEntry(os, {units.x, unitless}, scale_());
|
||||
writeEntry(os, {units.x, units.x}, xScale_());
|
||||
writeEntry(os, units.x, unitless, scale_());
|
||||
writeEntry(os, units.x, units.x, xScale_());
|
||||
writeEntry(os, units, value_());
|
||||
}
|
||||
|
||||
|
||||
@ -180,6 +180,19 @@ Foam::Function1s::Table<Type>::Table
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::Table<Type>::Table
|
||||
(
|
||||
const word& name,
|
||||
const unitConversion& xUnits,
|
||||
const unitConversion& valueUnits,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Table(name, {xUnits, valueUnits}, dict)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::Table<Type>::Table
|
||||
(
|
||||
|
||||
@ -188,6 +188,15 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from name and dictionary
|
||||
Table
|
||||
(
|
||||
const word& name,
|
||||
const unitConversion& xUnits,
|
||||
const unitConversion& valueUnits,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from name and Istream
|
||||
Table
|
||||
(
|
||||
|
||||
@ -27,6 +27,13 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::ZeroConstant<Type>::ZeroConstant(const word& name)
|
||||
:
|
||||
FieldFunction1<Type, ZeroConstant<Type>>(name)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Function1s::ZeroConstant<Type>::ZeroConstant
|
||||
(
|
||||
|
||||
@ -67,6 +67,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name
|
||||
ZeroConstant(const word& name);
|
||||
|
||||
//- Construct from name and dictionary
|
||||
ZeroConstant
|
||||
(
|
||||
|
||||
@ -27,6 +27,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Function2s::None<Type>::None(const word& name)
|
||||
:
|
||||
FieldFunction2<Type, None<Type>>(name),
|
||||
dictName_("unknown")
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Function2s::None<Type>::None
|
||||
(
|
||||
|
||||
@ -64,6 +64,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name
|
||||
None(const word& name);
|
||||
|
||||
//- Construct from name and dictionary
|
||||
None
|
||||
(
|
||||
|
||||
@ -86,9 +86,9 @@ void Foam::Function2s::Scale<Type>::write
|
||||
const unitConversions& units
|
||||
) const
|
||||
{
|
||||
writeEntry(os, {units.x, units.y, unitless}, scale_());
|
||||
writeEntry(os, {units.x, units.x}, xScale_());
|
||||
writeEntry(os, {units.y, units.y}, yScale_());
|
||||
writeEntry(os, units.x, units.y, unitless, scale_());
|
||||
writeEntry(os, units.x, units.x, xScale_());
|
||||
writeEntry(os, units.y, units.y, yScale_());
|
||||
writeEntry(os, units, value_());
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,13 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Function2s::ZeroConstant<Type>::ZeroConstant(const word& name)
|
||||
:
|
||||
FieldFunction2<Type, ZeroConstant<Type>>(name)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Function2s::ZeroConstant<Type>::ZeroConstant
|
||||
(
|
||||
|
||||
@ -67,6 +67,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name
|
||||
ZeroConstant(const word& name);
|
||||
|
||||
//- Construct from name and dictionary
|
||||
ZeroConstant
|
||||
(
|
||||
|
||||
@ -75,15 +75,7 @@ lumpedMassTemperatureFvPatchScalarField
|
||||
dimPower,
|
||||
dict
|
||||
)
|
||||
: autoPtr<Function1<scalar>>
|
||||
(
|
||||
new Function1s::ZeroConstant<scalar>
|
||||
(
|
||||
"Q",
|
||||
{db().time().userUnits(), dimPower},
|
||||
dict
|
||||
)
|
||||
)
|
||||
: autoPtr<Function1<scalar>>(new Function1s::ZeroConstant<scalar>("Q"))
|
||||
),
|
||||
V_(NaN)
|
||||
{
|
||||
|
||||
@ -237,7 +237,8 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate
|
||||
Function1s::Table<vector>
|
||||
(
|
||||
word::null,
|
||||
{mesh().time().userUnits(), dimLength},
|
||||
mesh().time().userUnits(),
|
||||
dimLength,
|
||||
dict
|
||||
).value(mesh().time().value());
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ Foam::saturationModels::function1Temperature::function1Temperature
|
||||
saturationTemperatureModel(),
|
||||
function_
|
||||
(
|
||||
Function1<scalar>::New("function", {dimPressure, dimTemperature}, dict)
|
||||
Function1<scalar>::New("function", dimPressure, dimTemperature, dict)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -50,14 +50,11 @@ Foam::autoPtr<Foam::Function1<Foam::scalar>> Foam::liquid::New
|
||||
{
|
||||
if (dict.isDict(name))
|
||||
{
|
||||
return Function1<scalar>::New(name, {dimTemperature, dims}, dict);
|
||||
return Function1<scalar>::New(name, dimTemperature, dims, dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
return autoPtr<Function1<scalar>>
|
||||
(
|
||||
new Function1s::None<scalar>(name, {dimTemperature, dims}, dict)
|
||||
);
|
||||
return autoPtr<Function1<scalar>>(new Function1s::None<scalar>(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ inline void Foam::liquidProperties::write
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
writeEntry(os, {dimTemperature, dims}, f);
|
||||
writeEntry(os, dimTemperature, dims, f);
|
||||
}
|
||||
|
||||
|
||||
@ -216,7 +216,7 @@ inline void Foam::liquidProperties::write
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
writeEntry(os, {dimPressure, dimTemperature, dims}, f);
|
||||
writeEntry(os, dimPressure, dimTemperature, dims, f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user