1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2010-2011 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/>.
28 A Field of objects of type \<T\> with automated input and output using
29 a compact storage. Behaves like IOField except when binary output in
30 case it writes a CompactListList.
32 Useful for fields of small subfields e.g. in lagrangian
37 \*---------------------------------------------------------------------------*/
39 #ifndef CompactIOField_H
40 #define CompactIOField_H
43 #include "regIOobject.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of friend functions and operators
51 template<class T, class BaseType> class CompactIOField;
53 template<class T, class BaseType> Istream& operator>>
56 CompactIOField<T, BaseType>&
59 template<class T, class BaseType> Ostream& operator<<
62 const CompactIOField<T, BaseType>&
65 /*---------------------------------------------------------------------------*\
66 Class CompactIOField Declaration
67 \*---------------------------------------------------------------------------*/
69 template<class T, class BaseType>
75 // Private Member Functions
77 //- Read according to header type
78 void readFromStream();
82 //- Runtime type information
83 TypeName("FieldField");
88 //- Construct from IOobject
89 CompactIOField(const IOobject&);
91 //- Construct from IOobject and size
92 CompactIOField(const IOobject&, const label);
94 //- Construct from IOobject and a Field
95 CompactIOField(const IOobject&, const Field<T>&);
97 //- Construct by transferring the Field contents
98 CompactIOField(const IOobject&, const Xfer<Field<T> >&);
103 virtual ~CompactIOField();
108 virtual bool writeObject
110 IOstream::streamFormat,
111 IOstream::versionNumber,
112 IOstream::compressionType
115 virtual bool writeData(Ostream&) const;
120 void operator=(const CompactIOField<T, BaseType>&);
122 void operator=(const Field<T>&);
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 } // End namespace Foam
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 # include "CompactIOField.C"
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 // ************************************************************************* //