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 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 Note
34  For efficiency, the zones are sorted before creating the faces.
35  The class is thus derived from MeshedSurface.
36 
37 SourceFiles
38  TRIsurfaceFormat.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef TRIsurfaceFormat_H
43 #define TRIsurfaceFormat_H
44 
45 #include "MeshedSurface.H"
46 #include "MeshedSurfaceProxy.H"
47 #include "UnsortedMeshedSurface.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 namespace fileFormats
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class fileFormats::TRIsurfaceFormat Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class Face>
61 class TRIsurfaceFormat
62 :
63  public MeshedSurface<Face>
64 {
65  // Private Member Functions
66 
67  static inline void writeShell
68  (
69  Ostream& os,
70  const UList<point>& pts,
71  const Face& f,
72  const label zoneI
73  );
74 
75 
76 public:
77 
78  // Constructors
79 
80  //- Construct from file name
81  TRIsurfaceFormat(const fileName& filename);
82 
83 
84  //- Destructor
85  virtual ~TRIsurfaceFormat() = default;
86 
87 
88  // Static Member Functions
89 
90  //- Write surface mesh components by proxy
91  static void write
92  (
93  const fileName& filename,
94  const MeshedSurfaceProxy<Face>& surf,
95  const dictionary& options = dictionary::null
96  );
97 
98  //- Write UnsortedMeshedSurface, the output remains unsorted
99  static void write
100  (
101  const fileName& filename,
102  const UnsortedMeshedSurface<Face>& surf,
103  const dictionary& options = dictionary::null
104  );
105 
106 
107  // Member Functions
108 
109  //- Read from file
110  virtual bool read(const fileName& filename);
111 
112  //- Write surface mesh to file
113  virtual void write
114  (
115  const fileName& name,
116  const dictionary& options = dictionary::null
117  ) const
118  {
119  write(name, MeshedSurfaceProxy<Face>(*this), options);
120  }
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace fileFormats
127 } // End namespace Foam
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #ifdef NoRepository
132  #include "TRIsurfaceFormat.C"
133 #endif
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #endif
138 
139 // ************************************************************************* //
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: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::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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::TRIsurfaceFormat
Provide a means of reading/writing .tri format.
Definition: TRIsurfaceFormat.H:60
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)
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::fileFormats::TRIsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, const dictionary &options=dictionary::null)
Write surface mesh components by proxy.
Definition: TRIsurfaceFormat.C:156
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