VTPsurfaceFormat.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) 2017-2018 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::VTPsurfaceFormat
28 
29 Description
30  Write surfaces in VTP (xml) format.
31  The default format is INLINE_BASE64
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 | binary
39  precision | Write precision in ascii | no | same as IOstream
40  \endtable
41 
42 SourceFiles
43  VTPsurfaceFormat.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef VTPsurfaceFormat_H
48 #define VTPsurfaceFormat_H
49 
50 #include "MeshedSurface.H"
51 #include "MeshedSurfaceProxy.H"
52 #include "UnsortedMeshedSurface.H"
53 #include "VTPsurfaceFormatCore.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 namespace fileFormats
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class fileFormats::VTPsurfaceFormat Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class Face>
67 class VTPsurfaceFormat
68 :
69  public MeshedSurface<Face>,
70  public VTPsurfaceFormatCore
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 null
87  VTPsurfaceFormat() = default;
88 
89 
90  //- Destructor
91  virtual ~VTPsurfaceFormat() = 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  //- Write meshed surface to a file
116  virtual void write
117  (
118  const fileName& name,
119  const dictionary& options = dictionary::null
120  ) const
121  {
122  write(name, MeshedSurfaceProxy<Face>(*this), options);
123  }
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace fileFormats
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #ifdef NoRepository
135  #include "VTPsurfaceFormat.C"
136 #endif
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
MeshedSurfaceProxy.H
Foam::fileFormats::VTPsurfaceFormat
Write surfaces in VTP (xml) format. The default format is INLINE_BASE64.
Definition: VTPsurfaceFormat.H:81
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
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
Foam::fileFormats::VTPsurfaceFormatCore
Internal class used by the VTPsurfaceFormat. The default format is INLINE_BASE64.
Definition: VTPsurfaceFormatCore.H:77
format
word format(conversionProperties.get< word >("format"))
Foam::fileFormats::VTPsurfaceFormat::VTPsurfaceFormat
VTPsurfaceFormat()=default
Construct null.
Foam::fileFormats::VTPsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, const dictionary &options=dictionary::null)
Write surface mesh components by proxy.
Definition: VTPsurfaceFormat.C:96
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::VTPsurfaceFormat::~VTPsurfaceFormat
virtual ~VTPsurfaceFormat()=default
Destructor.
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
VTPsurfaceFormatCore.H
Foam::UList< Face >
Foam::MeshedSurface
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: triSurfaceTools.H:80
VTPsurfaceFormat.C
MeshedSurface.H
Foam::vtk::formatter
Abstract class for a VTK output stream formatter.
Definition: foamVtkFormatter.H:68