From f19c9098d994268741f056755cf66c7b10ec4333 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 21 Nov 2012 10:01:11 +0000 Subject: [PATCH] ENH: Added file missed during commit db21cc4 --- .../fieldValues/fieldValue/fieldValueNew.C | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C new file mode 100644 index 0000000000..f418ad0215 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fieldValue.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr Foam::fieldValue::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles, + const bool output +) +{ + const word modelType(dict.lookup("type")); + + if (output) + { + Info<< "Selecting " << typeName << " " << modelType << endl; + } + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "fieldValue::New" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "Unknown " << typeName << " type " + << modelType << nl << nl + << "Valid " << typeName << " types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr + ( + cstrIter() + ( + name, + obr, + dict, + loadFromFiles + ) + ); +} + + +// ************************************************************************* //