VTKsurfaceFormat.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fileFormats::VTKsurfaceFormat
29 
30 Description
31  Read/write VTK legacy format (ASCII) for surfaces.
32 
33  The output is never sorted by zone.
34 
35  Output stream options: ignored (dictionary options only)
36 
37  \heading Format options
38  \table
39  Property | Description | Required | Default
40  format | ascii or binary format | no | ascii
41  precision | Write precision in ascii | no | same as IOstream
42  \endtable
43 
44 SourceFiles
45  VTKsurfaceFormat.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef VTKsurfaceFormat_H
50 #define VTKsurfaceFormat_H
51 
52 #include "MeshedSurface.H"
53 #include "MeshedSurfaceProxy.H"
54 #include "UnsortedMeshedSurface.H"
55 #include "VTKsurfaceFormatCore.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 namespace fileFormats
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class fileFormats::VTKsurfaceFormat Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class Face>
69 class VTKsurfaceFormat
70 :
71  public MeshedSurface<Face>,
72  public VTKsurfaceFormatCore
73 {
74  // Private Member Functions
75 
76  //- Write polygons
77  static void writePolys
78  (
79  vtk::formatter& format,
80  const UList<Face>& faces
81  );
82 
83 
84 public:
85 
86  // Constructors
87 
88  //- Construct from file name
89  VTKsurfaceFormat(const fileName& filename);
90 
91 
92  //- Destructor
93  virtual ~VTKsurfaceFormat() = default;
94 
95 
96  // Static Functions
97 
98  //- Write surface mesh components by proxy
99  static void write
100  (
101  const fileName& filename,
102  const MeshedSurfaceProxy<Face>& surf,
103  IOstreamOption /*ignored*/ = IOstreamOption(),
104  const dictionary& options = dictionary::null
105  );
106 
107  //- Write UnsortedMeshedSurface, the output remains unsorted
108  static void write
109  (
110  const fileName& fileName,
111  const UnsortedMeshedSurface<Face>& surf,
112  IOstreamOption /*ignored*/ = IOstreamOption(),
113  const dictionary& options = dictionary::null
114  );
115 
116 
117  // Member Functions
118 
119  //- Read from file
120  virtual bool read(const fileName& filename);
121 
122  //- Write meshed surface to file
123  virtual void write
124  (
125  const fileName& name,
126  IOstreamOption streamOpt = IOstreamOption(),
127  const dictionary& options = dictionary::null
128  ) const
129  {
130  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
131  }
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace fileFormats
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #ifdef NoRepository
143  #include "VTKsurfaceFormat.C"
144 #endif
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
Foam::fileFormats::VTKsurfaceFormat::~VTKsurfaceFormat
virtual ~VTKsurfaceFormat()=default
Destructor.
MeshedSurfaceProxy.H
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
VTKsurfaceFormat.C
Foam::fileFormats::VTKsurfaceFormat::VTKsurfaceFormat
VTKsurfaceFormat(const fileName &filename)
Construct from file name.
Definition: VTKsurfaceFormat.C:77
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
UnsortedMeshedSurface.H
format
word format(conversionProperties.get< word >("format"))
Foam::UnsortedMeshedSurface
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
Definition: MeshedSurface.H:83
Foam::fileFormats::VTKsurfaceFormat::read
virtual bool read(const fileName &filename)
Read from file.
Definition: VTKsurfaceFormat.C:89
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fileFormats::VTKsurfaceFormatCore
Internal class used by the VTKsurfaceFormat Format is LEGACY_ASCII.
Definition: VTKsurfaceFormatCore.H:77
VTKsurfaceFormatCore.H
Foam::UList< Face >
Foam::fileFormats::VTKsurfaceFormat
Read/write VTK legacy format (ASCII) for surfaces.
Definition: VTKsurfaceFormat.H:83
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::MeshedSurface
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: triSurfaceTools.H:80
Foam::fileFormats::VTKsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, IOstreamOption=IOstreamOption(), const dictionary &options=dictionary::null)
Write surface mesh components by proxy.
Definition: VTKsurfaceFormat.C:247
MeshedSurface.H
Foam::vtk::formatter
Abstract class for a VTK output stream formatter.
Definition: foamVtkFormatter.H:68