IOField.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::IOField
29 
30 Description
31  A primitive field of type <T> with automated input and output.
32 
33 SourceFiles
34  IOField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef IOField_H
39 #define IOField_H
40 
41 #include "regIOobject.H"
42 #include "Field.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class IOField Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Type>
54 class IOField
55 :
56  public regIOobject,
57  public Field<Type>
58 {
59 public:
60 
61  TypeName("Field");
62 
63 
64  // Constructors
65 
66  //- Default copy construct
67  IOField(const IOField&) = default;
68 
69  //- Construct from IOobject
70  explicit IOField(const IOobject& io);
71 
72  //- Construct from IOobject; does local processor require reading?
73  IOField(const IOobject& io, const bool valid);
74 
75  //- Construct from IOobject and size (does not set values)
76  IOField(const IOobject& io, const label size);
77 
78  //- Construct from IOobject and a List/Field content
79  IOField(const IOobject& io, const UList<Type>& content);
80 
81  //- Construct by transferring the Field content
82  IOField(const IOobject& io, Field<Type>&& content);
83 
84  //- Construct by copying/moving tmp content
85  IOField(const IOobject& io, const tmp<Field<Type>>& tfld);
86 
87 
88  //- Destructor
89  virtual ~IOField() = default;
90 
91 
92  // Member Functions
93 
94  bool writeData(Ostream& os) const;
95 
96 
97  // Member Operators
98 
99  //- Copy assignment of entries
100  void operator=(const IOField<Type>& rhs);
101 
102  //- Copy or move assignment of entries
103  using Field<Type>::operator=;
104 };
105 
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 } // End namespace Foam
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #ifdef NoRepository
114  #include "IOField.C"
115 #endif
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 #endif
120 
121 // ************************************************************************* //
regIOobject.H
Foam::IOField::IOField
IOField(const IOField &)=default
Default copy construct.
Foam::Field::operator
friend Ostream & operator(Ostream &, const Field< Type > &)
Foam::IOField::TypeName
TypeName("Field")
Field.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
IOField.C
Foam::IOField::~IOField
virtual ~IOField()=default
Destructor.
Foam::IOField::writeData
bool writeData(Ostream &os) const
Definition: IOField.C:208
Foam::IOField::operator=
void operator=(const IOField< Type > &rhs)
Copy assignment of entries.
Definition: IOField.C:217