VectorSpace.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 "VectorSpace.H"
00028 #include "IOstreams.H"
00029
00030 #include <sstream>
00031
00032
00033
00034
00035 template<class Form, class Cmpt, int nCmpt>
00036 Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
00037 (
00038 Istream& is
00039 )
00040 {
00041
00042 is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
00043
00044 for (int i=0; i<nCmpt; i++)
00045 {
00046 is >> v_[i];
00047 }
00048
00049
00050 is.readEnd("VectorSpace<Form, Cmpt, nCmpt>");
00051
00052
00053 is.check("VectorSpace<Form, Cmpt, nCmpt>::VectorSpace(Istream&)");
00054 }
00055
00056
00057
00058 template<class Form, class Cmpt, int nCmpt>
00059 Foam::word
00060 Foam::name
00061 (
00062 const VectorSpace<Form, Cmpt, nCmpt>& vs
00063 )
00064 {
00065 std::ostringstream buf;
00066
00067 buf << '(';
00068
00069 for (int i=0; i<nCmpt-1; i++)
00070 {
00071 buf << vs.v_[i] << ',';
00072 }
00073
00074 buf << vs.v_[nCmpt-1] << ')';
00075
00076 return buf.str();
00077 }
00078
00079
00080
00081
00082 template<class Form, class Cmpt, int nCmpt>
00083 Foam::Istream& Foam::operator>>
00084 (
00085 Istream& is,
00086 VectorSpace<Form, Cmpt, nCmpt>& vs
00087 )
00088 {
00089
00090 is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
00091
00092 for (int i=0; i<nCmpt; i++)
00093 {
00094 is >> vs.v_[i];
00095 }
00096
00097
00098 is.readEnd("VectorSpace<Form, Cmpt, nCmpt>");
00099
00100
00101 is.check("operator>>(Istream&, VectorSpace<Form, Cmpt, nCmpt>&)");
00102
00103 return is;
00104 }
00105
00106
00107 template<class Form, class Cmpt, int nCmpt>
00108 Foam::Ostream& Foam::operator<<
00109 (
00110 Ostream& os,
00111 const VectorSpace<Form, Cmpt, nCmpt>& vs
00112 )
00113 {
00114 os << token::BEGIN_LIST;
00115
00116 for (int i=0; i<nCmpt-1; i++)
00117 {
00118 os << vs.v_[i] << token::SPACE;
00119 }
00120
00121 os << vs.v_[nCmpt-1] << token::END_LIST;
00122
00123
00124 os.check("operator<<(Ostream&, const VectorSpace<Form, Cmpt, nCmpt>&)");
00125
00126 return os;
00127 }
00128
00129
00130
Copyright © 2000-2009 OpenCFD Ltd