From e1cb1a379d89b44d0765eebc7d435326391aba07 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 14 Apr 2009 14:05:47 +0100 Subject: [PATCH] better error messages --- .../phaseProperties/phasePropertiesIO.C | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C index 776a9b4d57..3858f69b12 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C @@ -42,11 +42,13 @@ Foam::phaseProperties::phaseProperties(Istream& is) dictionaryEntry phaseInfo(dictionary::null, is); - if (!phaseInfo.isDict()) + if (phaseInfo.size() == 0) { - FatalErrorIn("Foam::phaseProperties::phaseProperties(Istream& is)") - << "Phase properties should be given in dictionary entries" - << nl << exit(FatalError); + 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(); @@ -85,16 +87,17 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp) dictionaryEntry phaseInfo(dictionary::null, is); - if (!phaseInfo.isDict()) + if (phaseInfo.size() == 0) { FatalErrorIn ( "Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)" - ) << "Phase properties should be given in dictionary entries" - << nl << exit(FatalError); + ) << "No phases identified. Please define each phase property as " + << "a dictionary entry" << nl << exit(FatalError); } label nComponents = phaseInfo.size(); + pp.names_.setSize(nComponents); pp.Y_.setSize(nComponents);