rawIOField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::rawIOField
28 
29 Description
30  Like IOField but falls back to raw IFstream if no header found.
31  Optionally reads average value. For use in MappedFile container.
32 
33 SourceFiles
34  rawIOField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef rawIOField_H
39 #define rawIOField_H
40 
41 #include "IOField.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class rawIOField Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
53 class rawIOField
54 :
55  public regIOobject,
56  public Field<Type>
57 {
58  // Private Data
59 
60  //- The average of the field (Zero if not used)
61  Type average_;
62 
63 
64 public:
65 
66  TypeName("rawField");
67 
68 
69  // Constructors
70 
71  //- Default copy construct
72  rawIOField(const rawIOField&) = default;
73 
74  //- Construct from IOobject
75  explicit rawIOField(const IOobject& io, const bool readAverage);
76 
77 
78  //- Destructor
79  virtual ~rawIOField() = default;
80 
81 
82  // Member Functions
83 
84  const Type& average() const
85  {
86  return average_;
87  }
88 
89  bool writeData(Ostream& os) const;
90 
91 
92  // Member Operators
93 
94  //- Copy or move assignment of entries
95  using Field<Type>::operator=;
96 };
97 
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 } // End namespace Foam
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 #ifdef NoRepository
106  #include "rawIOField.C"
107 #endif
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 #endif
112 
113 // ************************************************************************* //
Foam::rawIOField::TypeName
TypeName("rawField")
rawIOField.C
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::rawIOField::rawIOField
rawIOField(const rawIOField &)=default
Default copy construct.
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::rawIOField
Like IOField but falls back to raw IFstream if no header found. Optionally reads average value....
Definition: rawIOField.H:52
Foam::rawIOField::writeData
bool writeData(Ostream &os) const
Pure virtual writeData function.
Definition: rawIOField.C:136
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::rawIOField::average
const Type & average() const
Definition: rawIOField.H:83
IOField.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::rawIOField::~rawIOField
virtual ~rawIOField()=default
Destructor.