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-2018 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  \heading Output Options
36  \table
37  Property | Description | Required | Default
38  format | ascii or binary format | no | ascii
39  precision | Write precision in ascii | no | same as IOstream
40  \endtable
41 
42 SourceFiles
43  VTKsurfaceFormat.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef VTKsurfaceFormat_H
48 #define VTKsurfaceFormat_H
49 
50 #include "MeshedSurface.H"
51 #include "MeshedSurfaceProxy.H"
52 #include "UnsortedMeshedSurface.H"
53 #include "VTKsurfaceFormatCore.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 namespace fileFormats
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class fileFormats::VTKsurfaceFormat Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class Face>
67 class VTKsurfaceFormat
68 :
69  public MeshedSurface<Face>,
70  public VTKsurfaceFormatCore
71 {
72  // Private Member Functions
73 
74  //- Write polygons
75  static void writePolys
76  (
77  vtk::formatter& format,
78  const UList<Face>& faces
79  );
80 
81 
82 public:
83 
84  // Constructors
85 
86  //- Construct from file name
87  VTKsurfaceFormat(const fileName& filename);
88 
89 
90  //- Destructor
91  virtual ~VTKsurfaceFormat() = default;
92 
93 
94  // Static Member Functions
95 
96  //- Write surface mesh components by proxy
97  static void write
98  (
99  const fileName& filename,
100  const MeshedSurfaceProxy<Face>& surf,
101  const dictionary& options = dictionary::null
102  );
103 
104  //- Write UnsortedMeshedSurface, the output remains unsorted
105  static void write
106  (
107  const fileName& fileName,
108  const UnsortedMeshedSurface<Face>& surf,
109  const dictionary& options = dictionary::null
110  );
111 
112 
113  // Member Functions
114 
115  //- Read from file
116  virtual bool read(const fileName& filename);
117 
118  //- Write meshed surface to file
119  virtual void write
120  (
121  const fileName& name,
122  const dictionary& options = dictionary::null
123  ) const
124  {
125  write(name, MeshedSurfaceProxy<Face>(*this), options);
126  }
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace fileFormats
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #ifdef NoRepository
138  #include "VTKsurfaceFormat.C"
139 #endif
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
Foam::fileFormats::VTKsurfaceFormat::~VTKsurfaceFormat
virtual ~VTKsurfaceFormat()=default
Destructor.
MeshedSurfaceProxy.H
Foam::fileFormats::VTKsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, const dictionary &options=dictionary::null)
Write surface mesh components by proxy.
Definition: VTKsurfaceFormat.C:243
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
VTKsurfaceFormat.C
Foam::fileFormats::VTKsurfaceFormat::VTKsurfaceFormat
VTKsurfaceFormat(const fileName &filename)
Construct from file name.
Definition: VTKsurfaceFormat.C:76
Foam::MeshedSurfaceProxy
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
Definition: MeshedSurface.H:78
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:385
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:79
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fileFormats::VTKsurfaceFormat::read
virtual bool read(const fileName &filename)
Read from file.
Definition: VTKsurfaceFormat.C:88
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
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:81
Foam::MeshedSurface
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: triSurfaceTools.H:80
MeshedSurface.H
Foam::vtk::formatter
Abstract class for a VTK output stream formatter.
Definition: foamVtkFormatter.H:68