1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "VectorSpace.H"
28 #include "IOstreams.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 // Construct from Istream
40 template<class Form, class Cmpt, int nCmpt>
41 VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
46 // Read beginning of VectorSpace<Cmpt>
47 is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
49 for (int i=0; i<nCmpt; i++)
54 // Read end of VectorSpace<Cmpt>
55 is.readEnd("VectorSpace<Form, Cmpt, nCmpt>");
57 // Check state of Istream
58 is.check("VectorSpace<Form, Cmpt, nCmpt>::VectorSpace(Istream& is)");
62 //- Return a string representation
63 template<class Form, class Cmpt, int nCmpt>
66 const VectorSpace<Form, Cmpt, nCmpt>& vs
69 std::ostringstream osBuffer;
73 for (int i=0; i<nCmpt-1; i++)
75 osBuffer << vs.v_[i] << ',';
78 osBuffer << vs.v_[nCmpt-1] << ')';
80 return osBuffer.str();
84 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
86 template<class Form, class Cmpt, int nCmpt>
90 VectorSpace<Form, Cmpt, nCmpt>& vs
93 // Read beginning of VectorSpace<Cmpt, nCmpt>
94 is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
96 for (int i=0; i<nCmpt; i++)
101 // Read end of VectorSpace<Cmpt, nCmpt>
102 is.readEnd("VectorSpace<Form, Cmpt, nCmpt>");
104 // Check state of Istream
105 is.check("operator>>(Istream&, VectorSpace<Form, Cmpt, nCmpt>&)");
111 template<class Form, class Cmpt, int nCmpt>
115 const VectorSpace<Form, Cmpt, nCmpt>& vs
118 os << token::BEGIN_LIST;
120 for (int i=0; i<nCmpt-1; i++)
122 os << vs.v_[i] << token::SPACE;
125 os << vs.v_[nCmpt-1] << token::END_LIST;
127 // Check state of Ostream
128 os.check("operator<<(Ostream&, const VectorSpace<Form, Cmpt, nCmpt>&)");
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace Foam
138 // ************************************************************************* //