FLMAsurfaceFormat.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2024 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fileFormats::FLMAsurfaceFormat
28 
29 Description
30  Provide a means of writing AVL/FIRE FLMA format.
31 
32  Output stream options:
33  - ASCII only
34  - compression : ignored
35 
36  Output dictionary options: ignored
37 
38 Note
39  The internal logic is still a bit odd (2020-02) since compressed files
40  must have a \b .flmaz ending.
41  To be revisited in the future.
42 
43 SourceFiles
44  FLMAsurfaceFormat.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef Foam_FLMAsurfaceFormat_H
49 #define Foam_FLMAsurfaceFormat_H
50 
51 #include "MeshedSurface.H"
52 #include "MeshedSurfaceProxy.H"
53 #include "FIRECore.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 namespace fileFormats
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class fileFormats::FLMAsurfaceFormat Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class Face>
68 :
69  public MeshedSurface<Face>,
70  public FIRECore
71 {
72  // Private Member Functions
73 
74  static inline void writeShell(OSstream& os, const Face& f);
75  static inline void writeType(OSstream& os, const Face& f);
76 
77 
78 protected:
79 
80  // Protected Member Functions
81 
82  //- Write surface mesh components (by proxy)
83  static void write
84  (
85  OSstream& os,
86  const MeshedSurfaceProxy<Face>& surf
87  );
88 
89  //- Write surface mesh components (by proxy) with/without compression
90  static void write
91  (
93  const fileName& filename,
94  const MeshedSurfaceProxy<Face>& surf
95  );
96 
97 
98 public:
99 
100  // Constructors
101 
102  //- Default construct
103  FLMAsurfaceFormat() = default;
104 
105 
106  //- Destructor
107  virtual ~FLMAsurfaceFormat() = default;
108 
109 
110  // Static Functions
111 
112  //- Write surface mesh components (by proxy)
113  static void write
114  (
115  const fileName& filename,
116  const MeshedSurfaceProxy<Face>& surf,
117  IOstreamOption /*ignored*/ = IOstreamOption(),
118  const dictionary& /*unused*/ = dictionary::null
119  );
120 
121 
122  // Member Functions
123 
124  //- Write surface mesh to file (by proxy)
125  virtual void write
126  (
127  const fileName& name,
128  IOstreamOption streamOpt = IOstreamOption(),
129  const dictionary& options = dictionary::null
130  ) const override
131  {
132  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
133  }
134 
135  //- Write surface mesh to file (by proxy)
136  virtual void write
137  (
138  const fileName& name,
139  const word& fileType, /* ignored */
140  IOstreamOption streamOpt = IOstreamOption(),
141  const dictionary& options = dictionary::null
142  ) const override
143  {
144  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
145  }
146 };
147 
148 
149 /*---------------------------------------------------------------------------*\
150  Class FLMAZsurfaceFormat Declaration
151 \*---------------------------------------------------------------------------*/
152 
153 template<class Face>
154 class FLMAZsurfaceFormat
155 :
156  public FLMAsurfaceFormat<Face>
157 {
158 public:
159 
160  // Constructors
161 
162  //- Default construct
163  FLMAZsurfaceFormat() = default;
164 
165 
166  //- Destructor
167  virtual ~FLMAZsurfaceFormat() = default;
168 
169 
170  // Static Functions
171 
172  //- Write surface mesh components (by proxy)
173  static void write
174  (
175  const fileName& filename,
176  const MeshedSurfaceProxy<Face>& surf,
177  IOstreamOption /*ignored*/ = IOstreamOption(),
178  const dictionary& /*unused*/ = dictionary::null
179  );
180 
181 
182  // Member Functions
183 
184  //- Write surface mesh as flmaz file (by proxy)
185  virtual void write
186  (
187  const fileName& name,
188  IOstreamOption streamOpt = IOstreamOption(),
189  const dictionary& options = dictionary::null
190  ) const override
191  {
192  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
193  }
194 
195  //- Write surface mesh as flmaz file (by proxy)
196  virtual void write
197  (
198  const fileName& name,
199  const word& fileType, /* ignored */
200  IOstreamOption streamOpt = IOstreamOption(),
201  const dictionary& options = dictionary::null
202  ) const override
203  {
204  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
205  }
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace fileFormats
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #ifdef NoRepository
217 # include "FLMAsurfaceFormat.C"
218 #endif
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:50
A class for handling file names.
Definition: fileName.H:72
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
A simple container for options an IOstream can normally have.
FLMAsurfaceFormat()=default
Default construct.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
virtual ~FLMAsurfaceFormat()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:486
FLMAZsurfaceFormat()=default
Default construct.
OBJstream os(runTime.globalPath()/outputName)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
Definition: MeshedSurface.H:75
labelList f(nPoints)
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, IOstreamOption=IOstreamOption(), const dictionary &=dictionary::null)
Write surface mesh components (by proxy)
virtual ~FLMAZsurfaceFormat()=default
Destructor.
Provide a means of writing AVL/FIRE FLMA format.
Core routines used when reading/writing AVL/FIRE files.
Definition: FIRECore.H:55
static void write(OSstream &os, const MeshedSurfaceProxy< Face > &surf)
Write surface mesh components (by proxy)
Namespace for OpenFOAM.