TRIsurfaceFormat.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::TRIsurfaceFormat
29 
30 Description
31  Provide a means of reading/writing .tri format.
32 
33  Output stream options:
34  - ASCII only
35  - compression on/off
36 
37  Output dictionary options: ignored
38 
39 Note
40  For efficiency, the zones are sorted before creating the faces.
41  The class is thus derived from MeshedSurface.
42 
43 SourceFiles
44  TRIsurfaceFormat.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef TRIsurfaceFormat_H
49 #define TRIsurfaceFormat_H
50 
51 #include "MeshedSurface.H"
52 #include "MeshedSurfaceProxy.H"
53 #include "UnsortedMeshedSurface.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 namespace fileFormats
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class fileFormats::TRIsurfaceFormat Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class Face>
67 class TRIsurfaceFormat
68 :
69  public MeshedSurface<Face>
70 {
71  // Private Member Functions
72 
73  static inline void writeShell
74  (
75  Ostream& os,
76  const UList<point>& pts,
77  const Face& f,
78  const label zoneI
79  );
80 
81 
82 public:
83 
84  // Constructors
85 
86  //- Construct from file name
87  TRIsurfaceFormat(const fileName& filename);
88 
89 
90  //- Destructor
91  virtual ~TRIsurfaceFormat() = default;
92 
93 
94  // Static Functions
95 
96  //- Write surface mesh components by proxy
97  static void write
98  (
99  const fileName& filename,
100  const MeshedSurfaceProxy<Face>& surf,
101  IOstreamOption streamOpt = IOstreamOption(),
102  const dictionary& /*unused*/ = dictionary::null
103  );
104 
105  //- Write UnsortedMeshedSurface, the output remains unsorted
106  static void write
107  (
108  const fileName& filename,
109  const UnsortedMeshedSurface<Face>& surf,
110  IOstreamOption streamOpt = IOstreamOption(),
111  const dictionary& /*unused*/ = dictionary::null
112  );
113 
114 
115  // Member Functions
116 
117  //- Read from file
118  virtual bool read(const fileName& filename);
119 
120  //- Write surface mesh to file
121  virtual void write
122  (
123  const fileName& name,
124  IOstreamOption streamOpt = IOstreamOption(),
125  const dictionary& options = dictionary::null
126  ) const
127  {
128  write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
129  }
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace fileFormats
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #ifdef NoRepository
141  #include "TRIsurfaceFormat.C"
142 #endif
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
MeshedSurfaceProxy.H
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::fileFormats::TRIsurfaceFormat::TRIsurfaceFormat
TRIsurfaceFormat(const fileName &filename)
Construct from file name.
Definition: TRIsurfaceFormat.C:68
Foam::fileFormats::TRIsurfaceFormat::read
virtual bool read(const fileName &filename)
Read from file.
Definition: TRIsurfaceFormat.C:80
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:385
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::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fileFormats::TRIsurfaceFormat
Provide a means of reading/writing .tri format.
Definition: TRIsurfaceFormat.H:66
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:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
f
labelList f(nPoints)
Foam::fileFormats::TRIsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, IOstreamOption streamOpt=IOstreamOption(), const dictionary &=dictionary::null)
Write surface mesh components by proxy.
Definition: TRIsurfaceFormat.C:157
TRIsurfaceFormat.C
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fileFormats::TRIsurfaceFormat::~TRIsurfaceFormat
virtual ~TRIsurfaceFormat()=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