1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "VectorSpace.H"
27 #include "IOstreams.H"
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 // Construct from Istream
34 template<class Form, class Cmpt, int nCmpt>
35 Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
40 // Read beginning of VectorSpace<Cmpt>
41 is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
43 for (int i=0; i<nCmpt; i++)
48 // Read end of VectorSpace<Cmpt>
49 is.readEnd("VectorSpace<Form, Cmpt, nCmpt>");
51 // Check state of Istream
52 is.check("VectorSpace<Form, Cmpt, nCmpt>::VectorSpace(Istream&)");
56 // Return a string representation
57 template<class Form, class Cmpt, int nCmpt>
60 const VectorSpace<Form, Cmpt, nCmpt>& vs
63 std::ostringstream buf;
67 for (int i=0; i<nCmpt-1; i++)
69 buf << vs.v_[i] << ',';
72 buf << vs.v_[nCmpt-1] << ')';
78 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
80 template<class Form, class Cmpt, int nCmpt>
81 Foam::Istream& Foam::operator>>
84 VectorSpace<Form, Cmpt, nCmpt>& vs
87 // Read beginning of VectorSpace<Cmpt, nCmpt>
88 is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
90 for (int i=0; i<nCmpt; i++)
95 // Read end of VectorSpace<Cmpt, nCmpt>
96 is.readEnd("VectorSpace<Form, Cmpt, nCmpt>");
98 // Check state of Istream
99 is.check("operator>>(Istream&, VectorSpace<Form, Cmpt, nCmpt>&)");
105 template<class Form, class Cmpt, int nCmpt>
106 Foam::Ostream& Foam::operator<<
109 const VectorSpace<Form, Cmpt, nCmpt>& vs
112 os << token::BEGIN_LIST;
114 for (int i=0; i<nCmpt-1; i++)
116 os << vs.v_[i] << token::SPACE;
119 os << vs.v_[nCmpt-1] << token::END_LIST;
121 // Check state of Ostream
122 os.check("operator<<(Ostream&, const VectorSpace<Form, Cmpt, nCmpt>&)");
128 // ************************************************************************* //