functionObjectBase.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) 2015-2019 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::functionObjects::runTimePostPro::functionObjectBase
28 
29 Description
30  Base class for function object visualisation
31 
32  Dictionary controls
33  \table
34  Property | Description | Required | Default
35  functionObject | The data source | yes |
36  clearObjects | Remove file after use | no | no
37  liveObject | Prefer simulation data source | no | true
38  \endtable
39 
40  The "live" keyword indiates that from within the simulation (in memory)
41  is preferred over data from disk (for example).
42 
43 SourceFiles
44  functionObjectBase.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef functionObjects_runTimePostPro_functionObjectBase_H
49 #define functionObjects_runTimePostPro_functionObjectBase_H
50 
51 #include "fieldVisualisationBase.H"
52 #include "stateFunctionObject.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 namespace functionObjects
59 {
60 namespace runTimePostPro
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class functionObjectBase Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class functionObjectBase
68 :
69  public fieldVisualisationBase
70 {
71 protected:
72 
73  // Protected Data
74 
75  //- Reference to the state
76  const stateFunctionObject& state_;
77 
78  //- The function object name that provides the source data
80 
81  //- Flag to indicate "live" (simulation) data source should be used
82  bool liveObject_;
83 
84  //- Flag to indicate that source data should be cleared after use
85  bool clearObjects_;
86 
87 
88  // Protected Member Functions
89 
90  //- Retrieve the filename used to create the scene object
91  //- using information stored via the stateFunctionObject.
92  //
93  // \param keyword is normally "file"
94  // \param subDictName is the sub-dictionary name, which is often
95  // the fieldName when one file is used per field.
96  //
97  // Eg,
98  // \verbatim
99  // T
100  // {
101  // file "<case>/relpath/T_object.vtk";
102  // }
103  // defaultCloud
104  // {
105  // file "<case>/relpath/cloud_0001.vtp";
106  // fields (T U);
107  // }
108  // \endverbatim
110  (
111  const word& keyword,
112  const word& subDictName
113  ) const;
114 
115  //- Remove file used to create the scene object.
116  // Same naming semantics as getFileName.
117  //
118  // \note does not change the stateFunctionObject
119  bool removeFile(const word& keyword, const word& subDictName);
120 
121 
122  //- No copy construct
123  functionObjectBase(const functionObjectBase&) = delete;
124 
125  //- No copy assignment
126  void operator=(const functionObjectBase&) = delete;
127 
128 
129 public:
130 
131  // Constructors
132 
133  //- Construct from dictionary
135  (
136  const stateFunctionObject& state,
137  const dictionary& dict,
139  );
140 
141 
142  //- Destructor
143  virtual ~functionObjectBase() = default;
144 
145 
146  // Member Functions
147 
148  //- Clear files used to create the object(s)
149  virtual bool clear();
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace runTimePostPro
156 } // End namespace functionObjects
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::functionObjects::runTimePostPro::functionObjectBase::~functionObjectBase
virtual ~functionObjectBase()=default
Destructor.
Foam::functionObjects::stateFunctionObject
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: stateFunctionObject.H:67
Foam::functionObjects::runTimePostPro::functionObjectBase::getFileName
fileName getFileName(const word &keyword, const word &subDictName) const
Definition: functionObjectBase.C:34
Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectName_
word functionObjectName_
The function object name that provides the source data.
Definition: functionObjectBase.H:98
Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
functionObjectBase(const functionObjectBase &)=delete
No copy construct.
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:56
Foam::functionObjects::runTimePostPro::functionObjectBase
Base class for function object visualisation.
Definition: functionObjectBase.H:86
Foam::functionObjects::runTimePostPro::functionObjectBase::clear
virtual bool clear()
Clear files used to create the object(s)
Definition: functionObjectBase.C:88
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::functionObjects::runTimePostPro::functionObjectBase::removeFile
bool removeFile(const word &keyword, const word &subDictName)
Remove file used to create the scene object.
Definition: functionObjectBase.C:53
Foam::functionObjects::runTimePostPro::functionObjectBase::clearObjects_
bool clearObjects_
Flag to indicate that source data should be cleared after use.
Definition: functionObjectBase.H:104
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::runTimePostPro::functionObjectBase::operator=
void operator=(const functionObjectBase &)=delete
No copy assignment.
fieldVisualisationBase.H
Foam::functionObjects::runTimePostPro::fieldVisualisationBase
Base class for scene objects.
Definition: fieldVisualisationBase.H:125
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::colours
const HashPtrTable< Function1< vector > > & colours() const
Return the colours.
Definition: fieldVisualisationBase.C:794
Foam::HashPtrTable
A HashTable of pointers to objects of type <T>.
Definition: HashPtrTable.H:54
stateFunctionObject.H
Foam::functionObjects::runTimePostPro::functionObjectBase::liveObject_
bool liveObject_
Flag to indicate "live" (simulation) data source should be used.
Definition: functionObjectBase.H:101
Foam::functionObjects::runTimePostPro::functionObjectBase::state_
const stateFunctionObject & state_
Reference to the state.
Definition: functionObjectBase.H:95