ENH Templated and re-worked explicitSetValue field source

This commit is contained in:
andy
2011-11-01 16:50:27 +00:00
parent 175e8bf27e
commit 368dbd2dba
9 changed files with 178 additions and 259 deletions

View File

@ -30,7 +30,6 @@ License
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::wordList Foam::ExplicitSource<Type>::
volumeModeTypeNames_
@ -85,6 +84,21 @@ Foam::word Foam::ExplicitSource<Type>::volumeModeTypeToWord
}
template<class Type>
void Foam::ExplicitSource<Type>::setFieldData(const dictionary& dict)
{
fieldData_.setSize(dict.toc().size());
label i = 0;
forAllConstIter(dictionary, dict, iter)
{
fieldData_[i].first() = iter().keyword();
dict.lookup(iter().keyword()) >> fieldData_[i].second();
i++;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -101,15 +115,7 @@ Foam::ExplicitSource<Type>::ExplicitSource
VDash_(1.0),
fieldData_()
{
const dictionary& fieldDict(coeffs_.subDict("fieldData"));
fieldData_.setSize(fieldDict.toc().size());
label i = 0;
forAllConstIter(dictionary, fieldDict, iter)
{
fieldData_[i].first() = iter().keyword();
fieldDict.lookup(iter().keyword()) >> fieldData_[i].second();
i++;
}
setFieldData(coeffs_.subDict("fieldData"));
// Set volume normalisation
if (volumeMode_ == vmAbsolute)

View File

@ -134,6 +134,9 @@ protected:
//- Helper function to convert from a volumeModeType to a word
word volumeModeTypeToWord(const volumeModeType& vtType) const;
//- Set the local field data
void setFieldData(const dictionary& dict);
public:

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef makeBasicSource_H
#define makeBasicSource_H
#include "basicSource.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeBasicSource(Source, Type) \
\
defineTemplateTypeNameAndDebugWithName \
( \
Source<Type>, \
#Type#Source, \
0 \
); \
\
basicSource::adddictionaryConstructorToTable<Source<Type> > \
add##Source##Type##dictionary##ConstructorTobasicSourceTable_
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //