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 #include "phaseProperties.H"
00027 #include <OpenFOAM/dictionaryEntry.H>
00028
00029
00030
00031 Foam::phaseProperties::phaseProperties(Istream& is)
00032 :
00033 phase_(UNKNOWN),
00034 stateLabel_("(unknown)"),
00035 names_(0),
00036 Y_(0),
00037 globalIds_(0),
00038 globalCarrierIds_(0)
00039 {
00040 is.check("Foam::phaseProperties::phaseProperties(Istream& is)");
00041
00042 dictionaryEntry phaseInfo(dictionary::null, is);
00043
00044 phase_ = phaseTypeNames_[phaseInfo.keyword()];
00045 stateLabel_ = phaseToStateLabel(phase_);
00046
00047 if (phaseInfo.size() > 0)
00048 {
00049 label nComponents = phaseInfo.size();
00050 names_.setSize(nComponents, "unknownSpecie");
00051 Y_.setSize(nComponents, 0.0);
00052 globalIds_.setSize(nComponents, -1);
00053 globalCarrierIds_.setSize(nComponents, -1);
00054
00055 label cmptI = 0;
00056 forAllConstIter(IDLList<entry>, phaseInfo, iter)
00057 {
00058 names_[cmptI] = iter().keyword();
00059 Y_[cmptI] = readScalar(phaseInfo.lookup(names_[cmptI]));
00060 cmptI++;
00061 }
00062
00063 checkTotalMassFraction();
00064 }
00065 }
00066
00067
00068
00069
00070 Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
00071 {
00072 is.check
00073 (
00074 "Foam::Istream& Foam::operator>>(Istream&, phaseProperties&)"
00075 );
00076
00077 dictionaryEntry phaseInfo(dictionary::null, is);
00078
00079 pp.phase_ = pp.phaseTypeNames_[phaseInfo.keyword()];
00080 pp.stateLabel_ = pp.phaseToStateLabel(pp.phase_);
00081
00082 if (phaseInfo.size() > 0)
00083 {
00084 label nComponents = phaseInfo.size();
00085
00086 pp.names_.setSize(nComponents, "unknownSpecie");
00087 pp.Y_.setSize(nComponents, 0.0);
00088 pp.globalIds_.setSize(nComponents, -1);
00089 pp.globalCarrierIds_.setSize(nComponents, -1);
00090
00091 label cmptI = 0;
00092 forAllConstIter(IDLList<entry>, phaseInfo, iter)
00093 {
00094 pp.names_[cmptI] = iter().keyword();
00095 pp.Y_[cmptI] = readScalar(phaseInfo.lookup(pp.names_[cmptI]));
00096 cmptI++;
00097 }
00098
00099 pp.checkTotalMassFraction();
00100 }
00101
00102 return is;
00103 }
00104
00105
00106 Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp)
00107 {
00108 os.check
00109 (
00110 "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
00111 );
00112
00113 os << pp.phaseTypeNames_[pp.phase_] << nl << token::BEGIN_BLOCK << nl
00114 << incrIndent;
00115
00116 forAll(pp.names_, cmptI)
00117 {
00118 os.writeKeyword(pp.names_[cmptI]) << pp.Y_[cmptI]
00119 << token::END_STATEMENT << nl;
00120 }
00121
00122 os << decrIndent << token::END_BLOCK << nl;
00123
00124 os.check
00125 (
00126 "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
00127 );
00128
00129 return os;
00130 }
00131
00132
00133