GTSsurfaceFormat.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::GTSsurfaceFormat
29 
30 Description
31  Read/write GTS format.
32 
33  The output is never sorted by zone and is only written if it consists
34  entirely of triangles.
35 
36  Output stream options:
37  - ASCII only
38  - compression on/off
39 
40  Output dictionary options: ignored
41 
42 SourceFiles
43  GTSsurfaceFormat.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef GTSsurfaceFormat_H
48 #define GTSsurfaceFormat_H
49 
50 #include "MeshedSurface.H"
51 #include "MeshedSurfaceProxy.H"
52 #include "UnsortedMeshedSurface.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 namespace fileFormats
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class fileFormats::GTSsurfaceFormat Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Face>
66 class GTSsurfaceFormat
67 :
68  public UnsortedMeshedSurface<Face>
69 {
70  // Private Member Functions
71 
72  //- Check and raise FatalError if output is not triangulated
73  // Triangulating on-the-fly is otherwise too annoying
74  static bool checkIfTriangulated(const UList<Face>& faceLst);
75 
76 
77 public:
78 
79  // Constructors
80 
81  //- Construct from file name
82  GTSsurfaceFormat(const fileName& filename);
83 
84 
85  //- Destructor
86  virtual ~GTSsurfaceFormat() = default;
87 
88 
89  // Static Functions
90 
91  //- Write MeshedSurface
92  static void write
93  (
94  const fileName& filename,
95  const MeshedSurface<Face>& surf,
96  IOstreamOption streamOpt = IOstreamOption(),
97  const dictionary& /*unused*/ = dictionary::null
98  );
99 
100  //- Write UnsortedMeshedSurface, the output remains unsorted
101  static void write
102  (
103  const fileName& filename,
104  const UnsortedMeshedSurface<Face>& surf,
105  IOstreamOption streamOpt = IOstreamOption(),
106  const dictionary& /*unused*/ = dictionary::null
107  );
108 
109 
110  // Member Functions
111 
112  //- Read from file
113  virtual bool read(const fileName& filename);
114 
115  //- Write surface mesh to file
116  virtual void write
117  (
118  const fileName& name,
119  IOstreamOption streamOpt = IOstreamOption(),
120  const dictionary& options = dictionary::null
121  ) const
122  {
123  write(name, *this, streamOpt, options);
124  }
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace fileFormats
131 } // End namespace Foam
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #ifdef NoRepository
136  #include "GTSsurfaceFormat.C"
137 #endif
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
MeshedSurfaceProxy.H
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::fileFormats::GTSsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurface< Face > &surf, IOstreamOption streamOpt=IOstreamOption(), const dictionary &=dictionary::null)
Write MeshedSurface.
Definition: GTSsurfaceFormat.C:250
Foam::fileFormats::GTSsurfaceFormat::read
virtual bool read(const fileName &filename)
Read from file.
Definition: GTSsurfaceFormat.C:85
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:392
UnsortedMeshedSurface.H
Foam::UnsortedMeshedSurface
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
Definition: MeshedSurface.H:83
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
GTSsurfaceFormat.C
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::GTSsurfaceFormat::GTSsurfaceFormat
GTSsurfaceFormat(const fileName &filename)
Construct from file name.
Definition: GTSsurfaceFormat.C:73
Foam::fileFormats::GTSsurfaceFormat
Read/write GTS format.
Definition: GTSsurfaceFormat.H:65
Foam::UList< Face >
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::fileFormats::GTSsurfaceFormat::~GTSsurfaceFormat
virtual ~GTSsurfaceFormat()=default
Destructor.
Foam::MeshedSurface
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: triSurfaceTools.H:80
MeshedSurface.H