FreeFOAM The Cross-Platform CFD Toolkit
fieldValue.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 | Copyright (C) 2009-2011 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  Foam::fieldValue
26 
27 Description
28  Base class for field value -based function objects.
29 
30 SourceFiles
31  fieldValue.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef fieldValue_H
36 #define fieldValue_H
37 
38 #include <OpenFOAM/Switch.H>
39 #include <OpenFOAM/pointFieldFwd.H>
40 #include <OpenFOAM/OFstream.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class dictionary;
49 class objectRegistry;
50 class fvMesh;
51 class mapPolyMesh;
52 
53 /*---------------------------------------------------------------------------*\
54  Class fieldValue Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 {
59 
60 protected:
61 
62  // Protected data
63 
64  //- Name of this fieldValue object
66 
67  //- Database this class is registered to
69 
70  //- Active flag
71  bool active_;
72 
73  //- Switch to send output to Info as well as to file
75 
76  //- Name of source object
78 
79  //- List of field names to operate on
81 
82  //- Output field values flag
84 
85  //- Output file pointer
87 
88 
89  // Functions to be over-ridden from IOoutputFilter class
90 
91  //- Make the output file
92  virtual void makeFile();
93 
94  //- Write the output file header
95  virtual void writeFileHeader() = 0;
96 
97  //- Update mesh
98  virtual void updateMesh(const mapPolyMesh&);
99 
100  //- Move points
101  virtual void movePoints(const Field<point>&);
102 
103 
104 public:
105 
106  //- Run-time type information
107  TypeName("fieldValue");
108 
109 
110  //- Construct from components
111  fieldValue
112  (
113  const word& name,
114  const objectRegistry& obr,
115  const dictionary& dict,
116  const bool loadFromFiles = false
117  );
118 
119 
120  //- Destructor
121  virtual ~fieldValue();
122 
123 
124  // Public member functions
125 
126  // Access
127 
128  //- Return the name of the geometric source
129  inline const word& name() const;
130 
131  //- Return the reference to the object registry
132  inline const objectRegistry& obr() const;
133 
134  //- Return the active flag
135  inline bool active() const;
136 
137  //- Return the switch to send output to Info as well as to file
138  inline const Switch& log() const;
139 
140  //- Return the source name
141  inline const word& sourceName() const;
142 
143  //- Return the list of field names
144  inline const wordList& fields() const;
145 
146  //- Return the output field values flag
147  inline const Switch& valueOutput() const;
148 
149  //- Helper function to return the reference to the mesh
150  inline const fvMesh& mesh() const;
151 
152 
153  // Function object functions
154 
155  //- Read from dictionary
156  virtual void read(const dictionary& dict);
157 
158  //- Write to screen/file
159  virtual void write();
160 
161  //- Execute
162  virtual void execute();
163 
164  //- Execute the at the final time-loop, currently does nothing
165  virtual void end();
166 
167  //- Comnbine fields from all processor domains into single field
168  template<class Type>
170  (
171  const Field<Type>& field
172  ) const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #include "fieldValueI.H"
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #ifdef NoRepository
187  #include "fieldValueTemplates.C"
188 #endif
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************ vim: set sw=4 sts=4 et: ************************ //