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