functionObjectBase.C
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 \*---------------------------------------------------------------------------*/
27 
28 #include "functionObjectBase.H"
29 
30 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
31 
34 (
35  const word& keyword,
36  const word& subDictName
37 ) const
38 {
40  state_.getObjectDict(functionObjectName_, subDictName, dict);
41 
42  fileName f;
43  if (dict.readIfPresent<fileName>(keyword, f))
44  {
45  f.expand();
46  }
47 
48  return f;
49 }
50 
51 
53 (
54  const word& keyword,
55  const word& subDictName
56 )
57 {
58  // Foam::rm() ignores empty names etc.
59 
60  if (Pstream::master())
61  {
62  return Foam::rm(getFileName(keyword, subDictName));
63  }
64 
65  return false;
66 }
67 
68 
69 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
70 
72 (
73  const stateFunctionObject& state,
74  const dictionary& dict,
75  const HashPtrTable<Function1<vector>>& colours
76 )
77 :
78  fieldVisualisationBase(dict, colours),
79  state_(state),
80  functionObjectName_(dict.get<word>("functionObject")),
81  liveObject_(dict.getOrDefault("liveObject", true)),
82  clearObjects_(dict.getOrDefault("clearObjects", false))
83 {}
84 
85 
86 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
87 
89 {
90  return clearObjects_;
91 }
92 
93 
94 // ************************************************************************* //
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::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::rm
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Definition: MSwindows.C:994
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::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::functionObjects::runTimePostPro::fieldVisualisationBase
Base class for scene objects.
Definition: fieldVisualisationBase.H:125
Foam::HashPtrTable
A HashTable of pointers to objects of type <T>.
Definition: HashPtrTable.H:54
f
labelList f(nPoints)
functionObjectBase.H