phasePropertiesIO.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "phaseProperties.H"
00028 #include "dictionaryEntry.H"
00029
00030
00031
00032 Foam::phaseProperties::phaseProperties(Istream& is)
00033 :
00034 phase_(UNKNOWN),
00035 stateLabel_("(unknown)"),
00036 names_(0),
00037 Y_(0),
00038 globalIds_(0),
00039 globalCarrierIds_(0)
00040 {
00041 is.check("Foam::phaseProperties::phaseProperties(Istream& is)");
00042
00043 dictionaryEntry phaseInfo(dictionary::null, is);
00044
00045 phase_ = phaseTypeNames_[phaseInfo.keyword()];
00046 stateLabel_ = phaseToStateLabel(phase_);
00047
00048 if (phaseInfo.size() > 0)
00049 {
00050 label nComponents = phaseInfo.size();
00051 names_.setSize(nComponents, "unknownSpecie");
00052 Y_.setSize(nComponents, 0.0);
00053 globalIds_.setSize(nComponents, -1);
00054 globalCarrierIds_.setSize(nComponents, -1);
00055
00056 label cmptI = 0;
00057 forAllConstIter(IDLList<entry>, phaseInfo, iter)
00058 {
00059 names_[cmptI] = iter().keyword();
00060 Y_[cmptI] = readScalar(phaseInfo.lookup(names_[cmptI]));
00061 cmptI++;
00062 }
00063
00064 checkTotalMassFraction();
00065 }
00066 }
00067
00068
00069
00070
00071 Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
00072 {
00073 is.check
00074 (
00075 "Foam::Istream& Foam::operator>>(Istream&, phaseProperties&)"
00076 );
00077
00078 dictionaryEntry phaseInfo(dictionary::null, is);
00079
00080 pp.phase_ = pp.phaseTypeNames_[phaseInfo.keyword()];
00081 pp.stateLabel_ = pp.phaseToStateLabel(pp.phase_);
00082
00083 if (phaseInfo.size() > 0)
00084 {
00085 label nComponents = phaseInfo.size();
00086
00087 pp.names_.setSize(nComponents, "unknownSpecie");
00088 pp.Y_.setSize(nComponents, 0.0);
00089 pp.globalIds_.setSize(nComponents, -1);
00090 pp.globalCarrierIds_.setSize(nComponents, -1);
00091
00092 label cmptI = 0;
00093 forAllConstIter(IDLList<entry>, phaseInfo, iter)
00094 {
00095 pp.names_[cmptI] = iter().keyword();
00096 pp.Y_[cmptI] = readScalar(phaseInfo.lookup(pp.names_[cmptI]));
00097 cmptI++;
00098 }
00099
00100 pp.checkTotalMassFraction();
00101 }
00102
00103 return is;
00104 }
00105
00106
00107 Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp)
00108 {
00109 os.check
00110 (
00111 "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
00112 );
00113
00114 os << pp.phaseTypeNames_[pp.phase_] << nl << token::BEGIN_BLOCK << nl
00115 << incrIndent;
00116
00117 forAll(pp.names_, cmptI)
00118 {
00119 os.writeKeyword(pp.names_[cmptI]) << pp.Y_[cmptI]
00120 << token::END_STATEMENT << nl;
00121 }
00122
00123 os << decrIndent << token::END_BLOCK << nl;
00124
00125 os.check
00126 (
00127 "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
00128 );
00129
00130 return os;
00131 }
00132
00133
00134
Copyright © 2000-2009 OpenCFD Ltd