OBJedgeFormat.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-2017 OpenFOAM Foundation
9  Copyright (C) 2021-2024 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::OBJedgeFormat
29 
30 Description
31  Provide a means of reading/writing Alias/Wavefront OBJ format.
32 
33  Does not handle negative vertex indices.
34 
35 SourceFiles
36  OBJedgeFormat.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef Foam_OBJedgeFormat_H
41 #define Foam_OBJedgeFormat_H
42 
43 #include "edgeMesh.H"
44 #include "Fstream.H"
45 #include "Ostream.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace fileFormats
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class OBJedgeFormat Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class OBJedgeFormat
59 :
60  public edgeMesh
61 {
62 public:
63 
64  // Constructors
65 
66  //- Construct from file name
67  explicit OBJedgeFormat(const fileName& filename);
68 
69 
70  // Selectors
71 
72  //- Read file and return surface
73  static autoPtr<edgeMesh> New(const fileName& name)
74  {
76  }
77 
78 
79  //- Destructor
80  virtual ~OBJedgeFormat() = default;
81 
82 
83  // Static Functions
84 
85  //- Write edge mesh to file in OBJ format
86  static void write
87  (
88  const fileName& filename,
89  const edgeMesh& mesh,
90  IOstreamOption /*ignored*/ = IOstreamOption(),
91  const dictionary& options = dictionary::null
92  );
93 
94 
95  // Member Functions
96 
97  //- Read from file
98  virtual bool read(const fileName& filename) override;
99 
100  //- Write to file
101  virtual void write
102  (
103  const fileName& name,
104  IOstreamOption streamOpt = IOstreamOption(),
105  const dictionary& options = dictionary::null
106  ) const override
107  {
108  write(name, *this, streamOpt, options);
109  }
110 
111  //- Write to file
112  virtual void write
113  (
114  const fileName& name,
115  const word& fileType, /* ignored */
116  IOstreamOption streamOpt = IOstreamOption(),
117  const dictionary& options = dictionary::null
118  ) const override
119  {
120  write(name, *this, streamOpt, options);
121  }
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace fileFormats
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
virtual ~OBJedgeFormat()=default
Destructor.
A class for handling file names.
Definition: fileName.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
OBJedgeFormat(const fileName &filename)
Construct from file name.
Definition: OBJedgeFormat.C:79
static void write(const fileName &filename, const edgeMesh &mesh, IOstreamOption=IOstreamOption(), const dictionary &options=dictionary::null)
Write edge mesh to file in OBJ format.
A simple container for options an IOstream can normally have.
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return surface.
Definition: OBJedgeFormat.H:72
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:486
Mesh data needed to do the Finite Area discretisation.
Definition: edgeFaMesh.H:47
Provide a means of reading/writing Alias/Wavefront OBJ format.
Definition: OBJedgeFormat.H:53
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual bool read(const fileName &filename) override
Read from file.
Definition: OBJedgeFormat.C:89
Namespace for OpenFOAM.