updated for empty specie list

This commit is contained in:
andy
2009-05-15 14:39:01 +01:00
parent 3f11699fce
commit 0fb2546a43

View File

@ -42,23 +42,17 @@ Foam::phaseProperties::phaseProperties(Istream& is)
dictionaryEntry phaseInfo(dictionary::null, is); dictionaryEntry phaseInfo(dictionary::null, is);
if (phaseInfo.size() == 0)
{
FatalErrorIn
(
"Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)"
) << "No phases identified. Please define each phase property as "
<< "a dictionary entry" << nl << exit(FatalError);
}
label nComponents = phaseInfo.size();
names_.setSize(nComponents);
Y_.setSize(nComponents);
phase_ = phaseTypeNames_[phaseInfo.keyword()]; phase_ = phaseTypeNames_[phaseInfo.keyword()];
stateLabel_ = phaseToStateLabel(phase_); stateLabel_ = phaseToStateLabel(phase_);
if (phaseInfo.size() > 0)
{
label nComponents = phaseInfo.size();
names_.setSize(nComponents, "unknownSpecie");
Y_.setSize(nComponents, 0.0);
globalIds_.setSize(nComponents, -1);
globalGasIds_.setSize(nComponents, -1);
label cmptI = 0; label cmptI = 0;
forAllConstIter(IDLList<entry>, phaseInfo, iter) forAllConstIter(IDLList<entry>, phaseInfo, iter)
{ {
@ -67,12 +61,9 @@ Foam::phaseProperties::phaseProperties(Istream& is)
cmptI++; cmptI++;
} }
// initialise global ids to -1
globalIds_.setSize(nComponents, -1);
globalGasIds_.setSize(nComponents, -1);
checkTotalMassFraction(); checkTotalMassFraction();
} }
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
@ -81,29 +72,22 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
{ {
is.check is.check
( (
"Foam::Istream& Foam::operator>>" "Foam::Istream& Foam::operator>>(Istream&, phaseProperties&)"
"(Foam::Istream&, Foam::phaseProperties&)"
); );
dictionaryEntry phaseInfo(dictionary::null, is); dictionaryEntry phaseInfo(dictionary::null, is);
if (phaseInfo.size() == 0) pp.phase_ = pp.phaseTypeNames_[phaseInfo.keyword()];
{ pp.stateLabel_ = pp.phaseToStateLabel(pp.phase_);
FatalErrorIn
(
"Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)"
) << "No phases identified. Please define each phase property as "
<< "a dictionary entry" << nl << exit(FatalError);
}
if (phaseInfo.size() > 0)
{
label nComponents = phaseInfo.size(); label nComponents = phaseInfo.size();
pp.names_.setSize(nComponents); pp.names_.setSize(nComponents, "unknownSpecie");
pp.Y_.setSize(nComponents); pp.Y_.setSize(nComponents, 0.0);
pp.globalIds_.setSize(nComponents, -1);
pp.phase_ = pp.phaseTypeNames_[phaseInfo.keyword()]; pp.globalGasIds_.setSize(nComponents, -1);
pp.stateLabel_ = pp.phaseToStateLabel(pp.phase_);
label cmptI = 0; label cmptI = 0;
forAllConstIter(IDLList<entry>, phaseInfo, iter) forAllConstIter(IDLList<entry>, phaseInfo, iter)
@ -113,11 +97,8 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
cmptI++; cmptI++;
} }
// initialise global ids to -1
pp.globalIds_.setSize(nComponents, -1);
pp.globalGasIds_.setSize(nComponents, -1);
pp.checkTotalMassFraction(); pp.checkTotalMassFraction();
}
return is; return is;
} }
@ -127,11 +108,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp)
{ {
os.check os.check
( (
"Foam::Ostream& Foam::operator<<" "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
"("
"Foam::Ostream&, "
"const Foam::phaseProperties&"
")"
); );
os << pp.phaseTypeNames_[pp.phase_] << nl << token::BEGIN_BLOCK << nl os << pp.phaseTypeNames_[pp.phase_] << nl << token::BEGIN_BLOCK << nl
@ -147,11 +124,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp)
os.check os.check
( (
"Foam::Ostream& Foam::operator<<" "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
"("
"Foam::Ostream&, "
"const Foam::phaseProperties&"
")"
); );
return os; return os;