From 312b019f50931b40cf955551c7db15d0164df62f Mon Sep 17 00:00:00 2001 From: Andrew Heather <a.heather@opencfd.co.uk> Date: Wed, 11 Nov 2015 12:25:52 +0000 Subject: [PATCH] ENH: Constant DataEntry - added construct from components --- .../functions/DataEntry/Constant/Constant.C | 16 +++++++++++++++- .../functions/DataEntry/Constant/Constant.H | 12 ++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C index e4f60195a84..87a78b64cb7 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,6 +55,20 @@ Foam::Constant<Type>::Constant(const word& entryName, const dictionary& dict) } +template<class Type> +Foam::Constant<Type>::Constant +( + const word& entryName, + const Type& value, + const dimensionSet& dimensions +) +: + DataEntry<Type>(entryName), + value_(value), + dimensions_(dimensions) +{} + + template<class Type> Foam::Constant<Type>::Constant(const Constant<Type>& cnst) : diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H index 0c251fec033..024eca67259 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,7 +86,15 @@ public: // Constructors - //- Construct from entry name and Istream + //- Construct from components + Constant + ( + const word& entryName, + const Type& value, + const dimensionSet& dimensions = dimless + ); + + //- Construct from entry name and dictionary Constant(const word& entryName, const dictionary& dict); //- Copy constructor -- GitLab