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-2020 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 FLMAsurfaceFormat_H
49 #define 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 as flma file
125  virtual void write
126  (
127  const fileName& name,
128  IOstreamOption streamOpt = IOstreamOption(),
129  const dictionary& options = dictionary::null
130  ) const
131  {
132  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
133  }
134 };
135 
136 
137 /*---------------------------------------------------------------------------*\
138  Class FLMAZsurfaceFormat Declaration
139 \*---------------------------------------------------------------------------*/
140 
141 template<class Face>
142 class FLMAZsurfaceFormat
143 :
144  public FLMAsurfaceFormat<Face>
145 {
146 public:
147 
148  // Constructors
149 
150  //- Default construct
151  FLMAZsurfaceFormat() = default;
152 
153 
154  //- Destructor
155  virtual ~FLMAZsurfaceFormat() = default;
156 
157 
158  // Static Functions
159 
160  //- Write surface mesh components by proxy
161  static void write
162  (
163  const fileName& filename,
164  const MeshedSurfaceProxy<Face>& surf,
165  IOstreamOption /*ignored*/ = IOstreamOption(),
166  const dictionary& /*unused*/ = dictionary::null
167  );
168 
169 
170  // Member Functions
171 
172  //- Write surface mesh as flmaz file
173  virtual void write
174  (
175  const fileName& name,
176  IOstreamOption streamOpt = IOstreamOption(),
177  const dictionary& options = dictionary::null
178  ) const
179  {
180  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
181  }
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace fileFormats
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #ifdef NoRepository
193 # include "FLMAsurfaceFormat.C"
194 #endif
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
Foam::fileFormats::FLMAZsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, IOstreamOption=IOstreamOption(), const dictionary &=dictionary::null)
Write surface mesh components by proxy.
Definition: FLMAsurfaceFormat.C:352
MeshedSurfaceProxy.H
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::fileFormats::FLMAZsurfaceFormat::~FLMAZsurfaceFormat
virtual ~FLMAZsurfaceFormat()=default
Destructor.
Foam::fileFormats::FLMAsurfaceFormat
Provide a means of writing AVL/FIRE FLMA format.
Definition: FLMAsurfaceFormat.H:66
FIRECore.H
Foam::MeshedSurfaceProxy
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
Definition: MeshedSurface.H:82
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:392
FLMAsurfaceFormat.C
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::fileFormats::FLMAsurfaceFormat::write
static void write(OSstream &os, const MeshedSurfaceProxy< Face > &surf)
Write surface mesh components by proxy.
Definition: FLMAsurfaceFormat.C:156
Foam::OSstream
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:54
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fileFormats::FLMAsurfaceFormat::FLMAsurfaceFormat
FLMAsurfaceFormat()=default
Default construct.
f
labelList f(nPoints)
Foam::fileFormats::FIRECore
Core routines used when reading/writing AVL/FIRE files.
Definition: FIRECore.H:60
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::IOstreamOption::compressionType
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Definition: IOstreamOption.H:77
Foam::fileFormats::FLMAsurfaceFormat::~FLMAsurfaceFormat
virtual ~FLMAsurfaceFormat()=default
Destructor.
Foam::MeshedSurface
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: triSurfaceTools.H:80
Foam::fileFormats::FLMAZsurfaceFormat::FLMAZsurfaceFormat
FLMAZsurfaceFormat()=default
Default construct.
Foam::fileFormats::FLMAZsurfaceFormat
Definition: FLMAsurfaceFormat.H:141
MeshedSurface.H