writeLocalObjects.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
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::functionObjects::writeLocalObjects
26 
27 Description
28  FunctionObject base class for managing a list of objects on behalf of the
29  inheriting function object, on when those should be written to disk.
30 
31  FunctionObjects that inherit this class will receive the additional
32  dictionary option \c objects which allows selecting which fields of the
33  inherited function should be written to disk when \c write() is called.
34  When \c objects is omitted, it will write all objects and when that list is
35  empty, it will not write any of the inheriting function object's managed
36  objects.
37 
38  Example of function object specification:
39  \verbatim
40  <functionObjectName>
41  {
42  ...
43  objects (obj1 obj2);
44  ...
45  }
46  \endverbatim
47 
48 Usage
49  \table
50  Property | Description | Required | Default value
51  objects | List of objects to be written | no | ".*"
52  \endtable
53 
54  Note: Regular expressions can also be used in \c objects.
55 
56 See also
57  Foam::functionObject
58  Foam::functionObjects::writeObjectsBase
59 
60 SourceFiles
61  writeLocalObjects.C
62 
63 \*---------------------------------------------------------------------------*/
64 
65 #ifndef functionObjects_writeLocalObjects_H
66 #define functionObjects_writeLocalObjects_H
67 
68 #include "wordList.H"
69 #include "writeObjectsBase.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 // Forward declaration of classes
77 class objectRegistry;
78 class regIOobject;
79 class Switch;
80 
81 namespace functionObjects
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class writeLocalObjects Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 class writeLocalObjects
89 :
90  public writeObjectsBase
91 {
92 
93 protected:
94 
95  // Protected data
96 
97  //- Object names that are handled on behalf of the inheritor
99 
100 
101  // Protected Member Functions
102 
103  //- Reset the list of local object names from a single word
104  void resetLocalObjectName(const word& name);
105 
106  //- Reset the list of local object names from a wordList
107  void resetLocalObjectNames(const wordList& names);
108 
109  //- Get the list of field names to be written
110  virtual wordList objectNames();
111 
112 
113 public:
114 
115  // Constructors
116 
117  //- Construct from objectRegistry and inheriting function object
119  (
120  const objectRegistry& obr,
121  const Switch& logRef
122  );
123 
124  //- Disallow default bitwise copy construction
125  writeLocalObjects(const writeLocalObjects&) = delete;
126 
127 
128  //- Destructor
129  virtual ~writeLocalObjects();
130 
131 
132  // Member Functions
133 
134  //- Return const access to the local object names
135  const wordList& localObjectNames() const;
136 
137  //- Read the list of objects to be written
138  virtual bool read(const dictionary&);
139 
140 
141  // Member Operators
142 
143  //- Disallow default bitwise assignment
144  void operator=(const writeLocalObjects&) = delete;
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace functionObjects
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
void resetLocalObjectName(const word &name)
Reset the list of local object names from a single word.
virtual wordList objectNames()
Get the list of field names to be written.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
writeLocalObjects(const objectRegistry &obr, const Switch &logRef)
Construct from objectRegistry and inheriting function object.
wordList localObjectNames_
Object names that are handled on behalf of the inheritor.
A class for handling words, derived from string.
Definition: word.H:59
const wordList & localObjectNames() const
Return const access to the local object names.
void resetLocalObjectNames(const wordList &names)
Reset the list of local object names from a wordList.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
FunctionObject base class for managing a list of objects on behalf of the inheriting function object...
virtual bool read(const dictionary &)
Read the list of objects to be written.
void operator=(const writeLocalObjects &)=delete
Disallow default bitwise assignment.
Registry of regIOobjects.
Namespace for OpenFOAM.