OBJsurfaceFormat.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-2017 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::OBJsurfaceFormat
29 
30 Description
31  Read/write Alias/Wavefront OBJ format.
32 
33  Does not handle negative face indices.
34 
35 SourceFiles
36  OBJsurfaceFormat.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef OBJsurfaceFormat_H
41 #define OBJsurfaceFormat_H
42 
43 #include "MeshedSurface.H"
44 #include "MeshedSurfaceProxy.H"
45 #include "UnsortedMeshedSurface.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace fileFormats
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class fileFormats::OBJsurfaceFormat Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class Face>
59 class OBJsurfaceFormat
60 :
61  public MeshedSurface<Face>
62 {
63 public:
64 
65  // Constructors
66 
67  //- Construct from file name
68  OBJsurfaceFormat(const fileName& filename);
69 
70 
71  //- Destructor
72  virtual ~OBJsurfaceFormat() = default;
73 
74 
75  // Static Member Functions
76 
77  //- Write surface mesh components by proxy
78  static void write
79  (
80  const fileName& filename,
81  const MeshedSurfaceProxy<Face>& surf,
82  const dictionary& options = dictionary::null
83  );
84 
85 
86  // Member Functions
87 
88  //- Read from file
89  virtual bool read(const fileName& filename);
90 
91  //- Write surface mesh to file
92  virtual void write
93  (
94  const fileName& name,
95  const dictionary& options = dictionary::null
96  ) const
97  {
98  write(name, MeshedSurfaceProxy<Face>(*this), options);
99  }
100 };
101 
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 } // End namespace fileFormats
106 } // End namespace Foam
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 #ifdef NoRepository
111  #include "OBJsurfaceFormat.C"
112 #endif
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #endif
117 
118 // ************************************************************************* //
MeshedSurfaceProxy.H
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::fileFormats::OBJsurfaceFormat::write
static void write(const fileName &filename, const MeshedSurfaceProxy< Face > &surf, const dictionary &options=dictionary::null)
Write surface mesh components by proxy.
Definition: OBJsurfaceFormat.C:221
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::OBJsurfaceFormat::OBJsurfaceFormat
OBJsurfaceFormat(const fileName &filename)
Construct from file name.
Definition: OBJsurfaceFormat.C:39
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
OBJsurfaceFormat.C
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fileFormats::OBJsurfaceFormat
Read/write Alias/Wavefront OBJ format.
Definition: OBJsurfaceFormat.H:58
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fileFormats::OBJsurfaceFormat::read
virtual bool read(const fileName &filename)
Read from file.
Definition: OBJsurfaceFormat.C:51
Foam::MeshedSurface
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: triSurfaceTools.H:80
Foam::fileFormats::OBJsurfaceFormat::~OBJsurfaceFormat
virtual ~OBJsurfaceFormat()=default
Destructor.
MeshedSurface.H