COMP: stray 'inline' prefix, explicit constructor for UniformDimensionedField

STYLE: getObjectPtr instead of const_cast version
This commit is contained in:
Mark Olesen 2024-05-31 12:42:52 +01:00
parent e9cf0fba05
commit 323149ad24
3 changed files with 10 additions and 9 deletions

View File

@ -100,8 +100,8 @@ public:
//- Construct as copy
UniformDimensionedField(const UniformDimensionedField<Type>&);
//- Construct from Istream
UniformDimensionedField(const IOobject& io);
//- Construct from IOobject. Either reads or sets dimensionless zero
explicit UniformDimensionedField(const IOobject& io);
//- Destructor
@ -129,7 +129,7 @@ public:
}
//- Return complete path + object name if the file exists
// either in the case/processor or case otherwise null
//- either in the case/processor or case otherwise null
virtual fileName filePath() const
{
return globalFilePath(type());

View File

@ -53,7 +53,7 @@ Foam::Function1Types::Lookup<Type>::Lookup(const Lookup<Type>& rhs)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline Type Foam::Function1Types::Lookup<Type>::value(const scalar t) const
Type Foam::Function1Types::Lookup<Type>::value(const scalar t) const
{
const objectRegistry& db = function1Base::obr();
const auto& obj =
@ -64,7 +64,7 @@ inline Type Foam::Function1Types::Lookup<Type>::value(const scalar t) const
template<class Type>
inline Type Foam::Function1Types::Lookup<Type>::integrate
Type Foam::Function1Types::Lookup<Type>::integrate
(
const scalar t1,
const scalar t2

View File

@ -70,11 +70,12 @@ functions
(
"banana",
mesh().time().constant(),
mesh()
mesh().thisDb()
);
auto* ptr = const_cast<objectRegistry&>(io.db()).
findObject<uniformDimensionedScalarField>(io.name());
auto* ptr =
io.db().getObjectPtr<uniformDimensionedScalarField>(io.name());
if (!ptr)
{
Info<< "Registering relaxation factor " << io.name() << endl;
@ -95,7 +96,7 @@ functions
(
"banana",
mesh().time().constant(),
mesh()
mesh().thisDb()
);
auto& val =