Loading...
Searching...
No Matches
readFields.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-2016 OpenFOAM Foundation
9 Copyright (C) 2015-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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 L2020icense 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
27Class
28 Foam::functionObjects::readFields
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Reads fields from the time directories and adds them to the mesh database
35 for further post-processing.
36
37 Operands:
38 \table
39 Operand | Type | Location
40 input | vol<Type>Field | <time>/inputField
41 output file | - | -
42 output field | vol<Type>Field | Mesh database
43 \endtable
44
45 where \c Type can be one of:
46 \c Scalar, \c Vector, \c SphericalTensor, \c SymmTensor, or \c Tensor.
47
48Usage
49 Minimal example by using \c system/controlDict.functions:
50 \verbatim
51 readFieldsFO
52 {
53 // Mandatory entries
54 type readFields;
55 libs (fieldFunctionObjects);
56 fields (<wordList>); // (<field1> <field2> ... <fieldN>);
57
58 // Optional entries
59 readOnStart <bool>;;
60
61 // Inherited entries
62 ...
63 }
64 \endverbatim
65
66 where the entries mean:
67 \table
68 Property | Description | Type | Reqd | Deflt
69 type | Type name: readFields | word | yes | -
70 libs | Library name: fieldFunctionObjects | word | yes | -
71 fields | Names of the operand fields | wordList | yes | -
72 readOnStart | Flag to start reading on start-up | bool | no | true
73 \endtable
74
75 The inherited entries are elaborated in:
76 - \link functionObject.H \endlink
77
78SourceFiles
79 readFields.C
80 readFieldsTemplates.C
81
82\*---------------------------------------------------------------------------*/
83
84#ifndef Foam_functionObjects_readFields_H
85#define Foam_functionObjects_readFields_H
86
88#include "volFieldsFwd.H"
89#include "surfaceFieldsFwd.H"
90
91// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92
93namespace Foam
94{
95namespace functionObjects
96{
97
98/*---------------------------------------------------------------------------*\
99 Class readFields Declaration
100\*---------------------------------------------------------------------------*/
101
102class readFields
103:
105{
106protected:
107
108 // Protected Data
109
110 //- Read immediately on construction (default: true)
111 bool readOnStart_;
112
113 //- Fields to load
115
116
117 // Protected Member Functions
118
119 //- Attempt load from io, store on database if successful
120 template<class FieldType>
121 bool loadAndStore(const IOobject& io);
122
123 //- Forward to loadAndStore for supported types
124 template<class Type>
125 bool loadField(const IOobject& io);
126
127
128public:
129
130 //- Runtime type information
131 TypeName("readFields");
132
133
134 // Constructors
135
136 //- Construct for given objectRegistry and dictionary.
137 // Allow the possibility to load fields from files
139 (
140 const word& name,
141 const Time& runTime,
142 const dictionary& dict
143 );
144
145 //- No copy construct
146 readFields(const readFields&) = delete;
147
148 //- No copy assignment
149 void operator=(const readFields&) = delete;
150
151
152 //- Destructor
153 virtual ~readFields() = default;
155
156 // Member Functions
157
158 //- Read the function-object dictionary
159 virtual bool read(const dictionary& dict);
160
161 //- Execute the function-object operations
162 virtual bool execute();
163
164 //- Write the function-object results
165 virtual bool write();
166};
167
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171} // End namespace functionObjects
172} // End namespace Foam
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#ifdef NoRepository
177 #include "readFieldsTemplates.C"
178#endif
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182#endif
183
184// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Reads fields from the time directories and adds them to the mesh database for further post-processing...
Definition readFields.H:146
bool readOnStart_
Read immediately on construction (default: true).
Definition readFields.H:154
virtual ~readFields()=default
Destructor.
void operator=(const readFields &)=delete
No copy assignment.
TypeName("readFields")
Runtime type information.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition readFields.C:61
readFields(const word &name, const Time &runTime, const dictionary &dict)
Construct for given objectRegistry and dictionary.
Definition readFields.C:40
wordList fieldSet_
Fields to load.
Definition readFields.H:159
readFields(const readFields &)=delete
No copy construct.
bool loadAndStore(const IOobject &io)
Attempt load from io, store on database if successful.
virtual bool execute()
Execute the function-object operations.
Definition readFields.C:71
virtual bool write()
Write the function-object results.
Definition readFields.C:135
bool loadField(const IOobject &io)
Forward to loadAndStore for supported types.
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
const auto & io
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
Forwards and collection of common volume field types.