From 323149ad24de3bca6b0f1b491b9099898669b763 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 31 May 2024 12:42:52 +0100 Subject: [PATCH] COMP: stray 'inline' prefix, explicit constructor for UniformDimensionedField STYLE: getObjectPtr instead of const_cast version --- .../UniformDimensionedFields/UniformDimensionedField.H | 6 +++--- .../expressions/PatchFunction1/lookup/Lookup.C | 4 ++-- tutorials/mesh/blockMesh/pipe/system/controlDict | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H index c970ca0c41..58c9dbee75 100644 --- a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H +++ b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H @@ -100,8 +100,8 @@ public: //- Construct as copy UniformDimensionedField(const UniformDimensionedField&); - //- 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()); diff --git a/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C b/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C index 9187277e3e..322a4faf5b 100644 --- a/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C +++ b/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C @@ -53,7 +53,7 @@ Foam::Function1Types::Lookup::Lookup(const Lookup& rhs) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline Type Foam::Function1Types::Lookup::value(const scalar t) const +Type Foam::Function1Types::Lookup::value(const scalar t) const { const objectRegistry& db = function1Base::obr(); const auto& obj = @@ -64,7 +64,7 @@ inline Type Foam::Function1Types::Lookup::value(const scalar t) const template -inline Type Foam::Function1Types::Lookup::integrate +Type Foam::Function1Types::Lookup::integrate ( const scalar t1, const scalar t2 diff --git a/tutorials/mesh/blockMesh/pipe/system/controlDict b/tutorials/mesh/blockMesh/pipe/system/controlDict index 328116a5f1..8f5f925fa6 100644 --- a/tutorials/mesh/blockMesh/pipe/system/controlDict +++ b/tutorials/mesh/blockMesh/pipe/system/controlDict @@ -70,11 +70,12 @@ functions ( "banana", mesh().time().constant(), - mesh() + mesh().thisDb() ); - auto* ptr = const_cast(io.db()). - findObject(io.name()); + auto* ptr = + io.db().getObjectPtr(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 =