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-2022 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::movePoints(mesh);
136 }
137 
138 
139 template<class OutputFilter>
141 (
142  const polyTopoChangeMap& map
143 )
144 {
145  read();
146  OutputFilter::topoChange(map);
147 }
148 
149 
150 template<class OutputFilter>
152 (
153  const polyMeshMap& map
154 )
155 {
156  read();
157  OutputFilter::mapMesh(map);
158 }
159 
160 
161 // ************************************************************************* //
virtual ~IOOutputFilter()
Destructor.
virtual void movePoints(const polyMesh &mesh)
Update topology using the given map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool write(const bool write=true) const
Inherit write from regIOobject.
virtual const word & name() const
Return name.
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
IOOutputFilter(const word &outputFilterName, const IOobject &ioDict, const bool loadFromFile=false)
Construct from an IOobject for IOdictionary.
virtual bool read()
Read output filter properties.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
readOption
Enumeration defining the read options.
Definition: IOobject.H:117
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
A class for handling file names.
Definition: fileName.H:82
Registry of regIOobjects.
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual bool read()
Read object.
A class for handling words, derived from string.
Definition: word.H:62
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
int system(const std::string &command)
Execute the specified command.
Definition: POSIX.C:1230
bool read(const char *, int32_t &)
Definition: int32IO.C:85