mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH Templated and re-worked explicitSetValue field source
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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:
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user