All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IOOutputFilter.C
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) 2011-2019 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 \*---------------------------------------------------------------------------*/
25 
26 #include "IOOutputFilter.H"
27 #include "Time.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class OutputFilter>
33 (
34  const word& outputFilterName,
35  const IOobject& ioDict,
36  const bool readFromFiles
37 )
38 :
39  IOdictionary(ioDict),
40  OutputFilter(outputFilterName, ioDict.db(), *this, readFromFiles)
41 {}
42 
43 
44 template<class OutputFilter>
46 (
47  const word& outputFilterName,
48  const objectRegistry& obr,
49  const word& dictName,
50  const IOobject::readOption rOpt,
51  const bool readFromFiles
52 )
53 :
55  (
56  IOobject
57  (
58  dictName,
59  obr.time().system(),
60  obr,
61  rOpt,
62  IOobject::NO_WRITE
63  )
64  ),
65  OutputFilter(outputFilterName, obr, *this, readFromFiles)
66 {}
67 
68 
69 template<class OutputFilter>
71 (
72  const word& outputFilterName,
73  const objectRegistry& obr,
74  const fileName& dictName,
75  const IOobject::readOption rOpt,
76  const bool readFromFiles
77 )
78 :
80  (
81  IOobject
82  (
83  dictName,
84  obr,
85  rOpt,
86  IOobject::NO_WRITE
87  )
88  ),
89  OutputFilter(outputFilterName, obr, *this, readFromFiles)
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
95 template<class OutputFilter>
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
102 template<class OutputFilter>
104 {
105  return IOdictionary::name();
106 }
107 
108 
109 template<class OutputFilter>
111 {
112  if (regIOobject::read())
113  {
114  OutputFilter::read(*this);
115  return true;
116  }
117  else
118  {
119  return false;
120  }
121 }
122 
123 
124 template<class OutputFilter>
126 {
127  return OutputFilter::write(write);
128 }
129 
130 
131 template<class OutputFilter>
133 {
134  read();
135  OutputFilter::updateMesh(mpm);
136 }
137 
138 
139 template<class OutputFilter>
141 {
142  read();
143  OutputFilter::movePoints(mesh);
144 }
145 
146 
147 // ************************************************************************* //
virtual bool read()
Read output filter properties.
A class for handling file names.
Definition: fileName.H:79
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
virtual bool write(const bool write=true)
Sample and write.
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
readOption
Enumeration defining the read options.
Definition: IOobject.H:110
IOOutputFilter(const word &outputFilterName, const IOobject &ioDict, const bool loadFromFile=false)
Construct from an IOobject for IOdictionary.
virtual const word & name() const
Return name.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
const word & system() const
Return system name.
Definition: TimePaths.H:114
const Time & time() const
Return time.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Registry of regIOobjects.
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:322
virtual ~IOOutputFilter()
Destructor.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92