writeLocalObjects.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) 2016 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 private:
114 
115  // Private Member Functions
116 
117  //- Disallow default bitwise copy construct
119 
120  //- Disallow default bitwise assignment
121  void operator=(const writeLocalObjects&);
122 
123 
124 public:
125 
126  // Constructors
127 
128  //- Construct from objectRegistry and inheriting function object
130  (
131  const objectRegistry& obr,
132  const Switch& logRef
133  );
134 
135 
136  //- Destructor
137  virtual ~writeLocalObjects();
138 
139 
140  // Member Functions
141 
142  //- Return const access to the local object names
143  const wordList& localObjectNames() const;
144 
145  //- Read the list of objects to be written
146  virtual bool read(const dictionary&);
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace functionObjects
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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.
Definition: Switch.H:60
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.
Registry of regIOobjects.
Namespace for OpenFOAM.