IOOutputFilter.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) 2011-2015 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::IOOutputFilter
26 
27 Description
28  IOdictionary wrapper around OutputFilter to allow them to read from
29  their associated dictionaries.
30 
31 Note
32  The IOobject or the objectRegistry will normally have to be
33  derived from a fvMesh for a subsequent cast (within OutputFilter)
34  to work correctly.
35 
36 SourceFiles
37  IOOutputFilter.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef IOOutputFilter_H
42 #define IOOutputFilter_H
43 
44 #include "IOdictionary.H"
45 #include "pointFieldFwd.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of classes
53 class mapPolyMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class IOOutputFilter Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class OutputFilter>
60 class IOOutputFilter
61 :
62  public IOdictionary,
63  public OutputFilter
64 {
65  // Private Member Functions
66 
67  // Disallow default bitwise copy construct and assignment
69  void operator=(const IOOutputFilter&);
70 
71 
72 public:
73 
74  // Constructors
75 
76  //- Construct from an IOobject for IOdictionary
77  // Allow the possibility to load fields from files
79  (
80  const word& outputFilterName,
81  const IOobject& ioDict,
82  const bool loadFromFile = false
83  );
84 
85  //- Construct for given objectRegistry and dictionary
86  // Allow dictionary to be optional
87  // Allow the possibility to load fields from files
89  (
90  const word& outputFilterName,
91  const objectRegistry&,
92  const word& dictName = OutputFilter::typeName() + "Dict",
94  const bool loadFromFile = false
95  );
96 
97  //- Construct for given objectRegistry and dictionary
98  // Dictionary read from full path.
99  // Allow the possibility to load fields from files
101  (
102  const word& outputFilterName,
103  const objectRegistry&,
104  const fileName& dictName,
106  const bool loadFromFile = false
107  );
108 
109 
110  //- Destructor
111  virtual ~IOOutputFilter();
112 
113 
114  // Member Functions
115 
116  //- Return name
117  virtual const word& name() const
118  {
119  return IOdictionary::name();
120  }
121 
122  //- Inherit read from OutputFilter
123  using OutputFilter::read;
124 
125  //- Read output filter properties
126  virtual bool read();
127 
128  //- Inherit write from regIOobject
129  using regIOobject::write;
130 
131  //- Sample and write
132  virtual void write();
133 
134  //- Update for changes of mesh
135  virtual void updateMesh(const mapPolyMesh& mpm)
136  {
137  read();
138  OutputFilter::updateMesh(mpm);
139  }
140 
141  //- Update for changes of mesh
142  virtual void movePoints(const polyMesh& mesh)
143  {
144  read();
145  OutputFilter::movePoints(mesh);
146  }
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #ifdef NoRepository
157 # include "IOOutputFilter.C"
158 #endif
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
IOdictionary wrapper around OutputFilter to allow them to read from their associated dictionaries...
virtual void write()
Sample and write.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
A class for handling words, derived from string.
Definition: word.H:59
dynamicFvMesh & mesh
const word & name() const
Name function is needed to disambiguate those inherited.
Definition: IOdictionary.C:183
Namespace for OpenFOAM.
virtual bool write() const
Write using setting from DB.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
readOption
Enumeration defining the read options.
Definition: IOobject.H:106
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
virtual ~IOOutputFilter()
Destructor.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Registry of regIOobjects.
A class for handling file names.
Definition: fileName.H:69
bool read(const char *, int32_t &)
Definition: int32IO.C:87
const word dictName() const
Return the local dictionary name (final part of scoped name)
Definition: dictionary.H:115
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
virtual bool read()
Read output filter properties.
virtual const word & name() const
Return name.