runTimePostProcessing.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) 2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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::runTimePostProcessing
26 
27 Group
28  grpGraphicsFunctionObjects
29 
30 Description
31  Function object to generate images during run-time.
32 
33  The functionality makes use of the VTK libraries (see http://www.vtk.org)
34  which provide a broad set of functionality for scene composition and
35  manipulation.
36 
37  Images are generated using a combination of function object output, and
38  additional data e.gg triangulated surfaces and text. Current capabilities
39  include support for:
40  - Camera
41  - Objects
42  - Points
43  - Lines
44  - Surfaces
45  - Scalar bars
46  - Annotations
47  - Selection of colour maps
48  Scene configuration is performed using standard OpenFOAM dictionaries, using
49  the main headings of: output=, camera, colours, points, lines,
50  surfaces and text.
51 
52 SourceFiles
53  runTimePostProcessing.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef runTimePostProcessing_H
58 #define runTimePostProcessing_H
59 
60 #include "functionObjectState.H"
61 #include "objectRegistry.H"
62 #include "mapPolyMesh.H"
63 #include "PtrList.H"
64 #include "scene.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 class vtkRenderer;
69 class vtkRenderWindow;
70 
71 namespace Foam
72 {
73 
74 class dictionary;
75 class pointData;
76 class pathline;
77 class surface;
78 class text;
79 
80 /*---------------------------------------------------------------------------*\
81  Class runTimePostProcessing Declaration
82 \*---------------------------------------------------------------------------*/
83 
85 :
86  public functionObjectState
87 {
88 private:
89 
90  // Private data
91 
92  // Output
93  struct outputType
94  {
97  label height_;
98  };
99 
100  //- Output instance
102 
103  //- Scene manager
104  scene scene_;
105 
106  //- List of points
108 
109  //- List of lines
111 
112  //- List of surfaces
114 
115  //- List of text
117 
118 
119  // Private Member Functions
120 
121  //- Helper function to read scene objects
122  template<class Type>
123  void readObjects
124  (
125  const dictionary& dict,
126  PtrList<Type>& objects
127  ) const;
128 
129 
130 protected:
131 
132  // Protected data
133 
134  //- Reference to the database
135  const objectRegistry& obr_;
136 
137  //- on/off switch
138  bool active_;
139 
140 
141 public:
142 
143  //- Runtime type information
144  TypeName("runTimePostProcessing");
145 
146 
147  // Constructors
148 
149  //- Construct from dictionary
151  (
152  const word& name,
153  const objectRegistry&,
154  const dictionary&,
155  const bool loadFromFiles = false
156  );
157 
158  //- Desructor
159  virtual ~runTimePostProcessing();
160 
161 
162  // Member Functions
163 
164  virtual const objectRegistry& obr() const
165  {
166  return obr_;
167  }
168 
169  //- Read the field min/max data
170  virtual void read(const dictionary&);
171 
172  //- Execute, currently does nothing
173  virtual void execute();
174 
175  //- Execute at the final time-loop, currently does nothing
176  virtual void end();
177 
178  //- Called when time was set at the end of the Time::operator++
179  virtual void timeSet();
180 
181  //- Write
182  virtual void write();
183 
184  //- Update for changes of mesh
185  virtual void updateMesh(const mapPolyMesh&)
186  {}
187 
188  //- Update for changes of mesh
189  virtual void movePoints(const polyMesh&)
190  {}
191 };
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #ifdef NoRepository
202 #endif
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Foam::runTimePostProcessing::outputType
Definition: runTimePostProcessing.H:92
Foam::runTimePostProcessing::outputType::height_
label height_
Definition: runTimePostProcessing.H:96
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::functionObjectState
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: functionObjectState.H:54
Foam::runTimePostProcessing::TypeName
TypeName("runTimePostProcessing")
Runtime type information.
mapPolyMesh.H
Foam::runTimePostProcessing::output_
outputType output_
Output instance.
Definition: runTimePostProcessing.H:100
functionObjectState.H
objectRegistry.H
Foam::runTimePostProcessing::~runTimePostProcessing
virtual ~runTimePostProcessing()
Desructor.
Definition: runTimePostProcessing.C:77
Foam::runTimePostProcessing::active_
bool active_
on/off switch
Definition: runTimePostProcessing.H:137
Foam::runTimePostProcessing
Function object to generate images during run-time.
Definition: runTimePostProcessing.H:83
Foam::runTimePostProcessing::outputType::name_
word name_
Definition: runTimePostProcessing.H:94
scene.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::runTimePostProcessing::execute
virtual void execute()
Execute, currently does nothing.
Definition: runTimePostProcessing.C:115
Foam::runTimePostProcessing::points_
PtrList< pointData > points_
List of points.
Definition: runTimePostProcessing.H:106
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::runTimePostProcessing::surfaces_
PtrList< surface > surfaces_
List of surfaces.
Definition: runTimePostProcessing.H:112
Foam::runTimePostProcessing::outputType::width_
label width_
Definition: runTimePostProcessing.H:95
Foam::runTimePostProcessing::lines_
PtrList< pathline > lines_
List of lines.
Definition: runTimePostProcessing.H:109
Foam::runTimePostProcessing::write
virtual void write()
Write.
Definition: runTimePostProcessing.C:133
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::runTimePostProcessing::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: runTimePostProcessing.H:184
Foam::runTimePostProcessing::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: runTimePostProcessing.C:127
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::runTimePostProcessing::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: runTimePostProcessing.C:121
Foam::runTimePostProcessing::text_
PtrList< text > text_
List of text.
Definition: runTimePostProcessing.H:115
Foam::runTimePostProcessing::obr
virtual const objectRegistry & obr() const
Definition: runTimePostProcessing.H:163
Foam::runTimePostProcessing::runTimePostProcessing
runTimePostProcessing(const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false)
Construct from dictionary.
Definition: runTimePostProcessing.C:55
Foam::runTimePostProcessing::read
virtual void read(const dictionary &)
Read the field min/max data.
Definition: runTimePostProcessing.C:83
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
PtrList.H
Foam::scene
Definition: scene.H:61
Foam::runTimePostProcessing::scene_
scene scene_
Scene manager.
Definition: runTimePostProcessing.H:103
Foam::runTimePostProcessing::readObjects
void readObjects(const dictionary &dict, PtrList< Type > &objects) const
Helper function to read scene objects.
Definition: runTimePostProcessingTemplates.C:30
Foam::runTimePostProcessing::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: runTimePostProcessing.H:188
runTimePostProcessingTemplates.C
Foam::functionObjectState::name
const word & name() const
Return the name.
Definition: functionObjectState.C:58
Foam::runTimePostProcessing::obr_
const objectRegistry & obr_
Reference to the database.
Definition: runTimePostProcessing.H:134