1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 const char* const pTraits<Scalar>::typeName = "scalar";
34 const Scalar pTraits<Scalar>::zero = 0.0;
35 const Scalar pTraits<Scalar>::one = 1.0;
36 const Scalar pTraits<Scalar>::min = -ScalarVGREAT;
37 const Scalar pTraits<Scalar>::max = ScalarVGREAT;
39 const char* pTraits<Scalar>::componentNames[] = { "x" };
41 pTraits<Scalar>::pTraits(const Scalar& p)
47 pTraits<Scalar>::pTraits(Istream& is)
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 word name(const Scalar val)
57 std::ostringstream buf;
63 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
65 Scalar readScalar(Istream& is)
74 Istream& operator>>(Istream& is, Scalar& s)
91 FatalIOErrorIn("operator>>(Istream&, Scalar&)", is)
92 << "wrong token type - expected Scalar, found " << t.info()
93 << exit(FatalIOError);
98 // Check state of Istream
99 is.check("Istream& operator>>(Istream&, Scalar&)");
105 Ostream& operator<<(Ostream& os, const Scalar s)
108 os.check("Ostream& operator<<(Ostream&, const Scalar&)");
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 } // End namespace Foam
117 // ************************************************************************* //