From 323149ad24de3bca6b0f1b491b9099898669b763 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
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 c970ca0c413..58c9dbee750 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<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());
diff --git a/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C b/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C
index 9187277e3ee..322a4faf5bf 100644
--- a/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C
+++ b/src/finiteVolume/expressions/PatchFunction1/lookup/Lookup.C
@@ -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
diff --git a/tutorials/mesh/blockMesh/pipe/system/controlDict b/tutorials/mesh/blockMesh/pipe/system/controlDict
index 328116a5f1e..8f5f925fa62 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<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 =
-- 
GitLab