write.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) 2025 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::zoneGenerators::write
26 
27 Description
28  A zoneGenerator which writes all existing zones from the mesh
29 
30 Usage
31  \table
32  Property | Description | Required | Default value
33  type | Type: write | yes |
34  zoneType | Type of zone | no | all the zone types
35  \endtable
36 
37  Examples:
38  To write all the zones that are changing:
39  \verbatim
40  writeAllZones
41  {
42  type write;
43  }
44  \endverbatim
45  or to write only the cellZones:
46  \verbatim
47  writeCellZones
48  {
49  type write;
50  zoneType cell;
51  }
52  \endverbatim
53  When called from the top-level of the createZonesDict or zonesGenerator
54  files which is the most likely use the simpler syntax to write all the zones
55  that are changing can be used:
56  \verbatim
57  write;
58  \endverbatim
59  or to write only the cellZones:
60  \verbatim
61  write
62  {
63  zoneType cell;
64  }
65  \endverbatim
66 
67 See also
68  zoneGenerators::remove
69  zoneGenerators::clear
70 
71 SourceFiles
72  write.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef write_zoneGenerator_H
77 #define write_zoneGenerator_H
78 
79 #include "zoneGeneratorList.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 namespace zoneGenerators
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class write Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class write
93 :
94  public zoneGenerator
95 {
96  // Private Member Data
97 
98  //- The type of zone to write (optional)
99  zoneTypesAll zoneType_;
100 
101  //- timeIndex of the last write
102  mutable label timeIndex_;
103 
104 
105  // Private Member Functions
106 
107  template<class ZoneListType>
108  void writeZoneType(const ZoneListType& zones) const;
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("write");
115 
116 
117  // Constructors
118 
119  //- Construct from dictionary
120  write
121  (
122  const word& name,
123  const polyMesh& mesh,
124  const dictionary& dict
125  );
126 
127 
128  //- Destructor
129  virtual ~write();
130 
131 
132  // Member Functions
133 
134  virtual zoneSet generate() const;
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace zoneGenerators
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for handling words, derived from string.
Definition: word.H:62
const word & name() const
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: write.C:94
write(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: write.C:69
TypeName("write")
Runtime type information.
virtual ~write()
Destructor.
Definition: write.C:88
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
Namespace for OpenFOAM.
zoneTypesAll
Enumeration defining the zone types with an option for all the types.
Definition: zoneSet.H:77
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict