dimensionSetIO.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 "dimensionSet.H"
00028 #include "IOstreams.H"
00029
00030
00031
00032 Foam::dimensionSet::dimensionSet(Istream& is)
00033 {
00034 is >> *this;
00035 }
00036
00037
00038
00039
00040 Foam::Istream& Foam::operator>>(Istream& is, dimensionSet& dset)
00041 {
00042
00043 if (token(is) != token::BEGIN_SQR)
00044 {
00045 Info<< "expected a " << token::BEGIN_SQR << " in dimensionSet"
00046 << endl << "in stream " << is.info() << endl;
00047 }
00048
00049
00050 for (int Dimension=0; Dimension<dimensionSet::CURRENT; Dimension++)
00051 {
00052 is >> dset.exponents_[Dimension];
00053 }
00054
00055
00056 token nextToken(is);
00057
00058
00059
00060
00061 if (nextToken.isNumber())
00062 {
00063 dset.exponents_[dimensionSet::CURRENT] = nextToken.number();
00064 is >> dset.exponents_[dimensionSet::LUMINOUS_INTENSITY];
00065 is >> nextToken;
00066 }
00067 else
00068 {
00069 dset.exponents_[dimensionSet::CURRENT] = 0;
00070 dset.exponents_[dimensionSet::LUMINOUS_INTENSITY] = 0;
00071 }
00072
00073
00074 if (nextToken != token::END_SQR)
00075 {
00076 Info<< "expected a " << token::END_SQR << " in dimensionSet"
00077 << endl << "in stream " << is.info() << endl;
00078 }
00079
00080
00081 is.check("Istream& operator>>(Istream&, dimensionSet&)");
00082
00083 return is;
00084 }
00085
00086
00087 Foam::Ostream& Foam::operator<<(Ostream& os, const dimensionSet& dset)
00088 {
00089 os << token::BEGIN_SQR;
00090
00091 for (int Dimension=0; Dimension<dimensionSet::nDimensions-1; Dimension++)
00092 {
00093 os << dset.exponents_[Dimension] << token::SPACE;
00094 }
00095 os << dset.exponents_[dimensionSet::nDimensions-1] << token::END_SQR;
00096
00097
00098 os.check("Ostream& operator<<(Ostream&, const dimensionSet&)");
00099
00100 return os;
00101 }
00102
00103
00104
Copyright © 2000-2009 OpenCFD Ltd