ENH: Added I/O for ExplicitSource

This commit is contained in:
andy
2011-11-02 14:02:50 +00:00
parent 557b67011a
commit 9cf75a6569
3 changed files with 23 additions and 20 deletions

View File

@ -59,7 +59,7 @@ Foam::ExplicitSetValue<Type>::ExplicitSetValue
basicSource(name, modelType, dict, mesh),
fieldData_()
{
setFieldData(coeffs_.subDict("fieldData"));
read(dict);
}

View File

@ -96,6 +96,12 @@ void Foam::ExplicitSource<Type>::setFieldData(const dictionary& dict)
dict.lookup(iter().keyword()) >> fieldData_[i].second();
i++;
}
// Set volume normalisation
if (volumeMode_ == vmAbsolute)
{
VDash_ = V_;
}
}
@ -106,22 +112,16 @@ Foam::ExplicitSource<Type>::ExplicitSource
(
const word& name,
const word& modelType,
const dictionary& coeffs,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, modelType, coeffs, mesh),
volumeMode_(wordToVolumeModeType(coeffs_.lookup("volumeMode"))),
basicSource(name, modelType, dict, mesh),
volumeMode_(vmAbsolute),
VDash_(1.0),
fieldData_()
{
setFieldData(coeffs_.subDict("fieldData"));
// Set volume normalisation
if (volumeMode_ == vmAbsolute)
{
VDash_ = V_;
}
read(dict);
}

View File

@ -30,22 +30,25 @@ License
template<class Type>
void Foam::ExplicitSource<Type>::writeData(Ostream& os) const
{
notImplemented
(
"void Foam::ExplicitSource<Type>::read(Ostream&) const"
);
os << indent << name_ << endl;
dict_.write(os);
}
template<class Type>
bool Foam::ExplicitSource<Type>::read(const dictionary& dict)
{
notImplemented
(
"bool Foam::ExplicitSource<Type>::read(const dictionary&)"
);
if (basicSource::read(dict))
{
setFieldData(coeffs_.subDict("fieldData"));
volumeMode_ = wordToVolumeModeType(coeffs_.lookup("volumeMode"));
return false;
return true;
}
else
{
return false;
}
}