1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 #include "DimensionedField.H"
27 #include "IOstreams.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 template<class Type, class GeoMesh>
33 void Foam::DimensionedField<Type, GeoMesh>::readField
35 const dictionary& fieldDict,
36 const word& fieldDictEntry
39 dimensions_.reset(dimensionSet(fieldDict.lookup("dimensions")));
41 Field<Type> f(fieldDictEntry, fieldDict, GeoMesh::size(mesh_));
46 template<class Type, class GeoMesh>
47 void Foam::DimensionedField<Type, GeoMesh>::readIfPresent
49 const word& fieldDictEntry
54 (this->readOpt() == IOobject::READ_IF_PRESENT && this->headerOk())
55 || this->readOpt() == IOobject::MUST_READ
56 || this->readOpt() == IOobject::MUST_READ_IF_MODIFIED
59 readField(dictionary(readStream(typeName)), fieldDictEntry);
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66 template<class Type, class GeoMesh>
67 Foam::DimensionedField<Type, GeoMesh>::DimensionedField
71 const word& fieldDictEntry
79 readField(dictionary(readStream(typeName)), fieldDictEntry);
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 template<class Type, class GeoMesh>
86 bool Foam::DimensionedField<Type, GeoMesh>::writeData
89 const word& fieldDictEntry
92 os.writeKeyword("dimensions") << dimensions() << token::END_STATEMENT
95 Field<Type>::writeEntry(fieldDictEntry, os);
97 // Check state of Ostream
100 "bool DimensionedField<Type, GeoMesh>::writeData"
101 "(Ostream& os, const word& fieldDictEntry) const"
108 template<class Type, class GeoMesh>
109 bool Foam::DimensionedField<Type, GeoMesh>::writeData(Ostream& os) const
111 return writeData(os, "value");
115 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
117 template<class Type, class GeoMesh>
118 Foam::Ostream& Foam::operator<<
121 const DimensionedField<Type, GeoMesh>& df
130 template<class Type, class GeoMesh>
131 Foam::Ostream& Foam::operator<<
134 const tmp<DimensionedField<Type, GeoMesh> >& tdf
144 // ************************************************************************* //