OBJedgeFormat.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fileFormats::OBJedgeFormat
26 
27 Description
28  Provide a means of reading/writing Alias/Wavefront OBJ format.
29 
30  Does not handle negative vertex indices.
31 
32 SourceFiles
33  OBJedgeFormat.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef OBJedgeFormat_H
38 #define OBJedgeFormat_H
39 
40 #include "edgeMesh.H"
41 #include "IFstream.H"
42 #include "Ostream.H"
43 #include "OFstream.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace fileFormats
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class OBJedgeFormat Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class OBJedgeFormat
57 :
58  public edgeMesh
59 {
60  // Private Member Functions
61 
62  void readVertices
63  (
64  const string& line,
65  string::size_type& endNum,
66  DynamicList<label>& dynVertices
67  );
68 
69 
70 public:
71 
72  // Constructors
73 
74  //- Construct from file name
75  OBJedgeFormat(const fileName&);
76 
77  //- Disallow default bitwise copy construction
78  OBJedgeFormat(const OBJedgeFormat&) = delete;
79 
80 
81  // Selectors
82 
83  //- Read file and return surface
84  static autoPtr<edgeMesh> New(const fileName& name)
85  {
86  return autoPtr<edgeMesh>
87  (
88  new OBJedgeFormat(name)
89  );
90  }
91 
92 
93  //- Destructor
94  virtual ~OBJedgeFormat()
95  {}
96 
97 
98  // Member Functions
99 
100  //- Write surface mesh components by proxy
101  static void write(const fileName&, const edgeMesh&);
102 
103  //- Read from file
104  virtual bool read(const fileName&);
105 
106  //- Write object file
107  virtual void write(const fileName& name) const
108  {
109  write(name, *this);
110  }
111 
112 
113  // Member Operators
114 
115  //- Disallow default bitwise assignment
116  void operator=(const OBJedgeFormat&) = delete;
117 };
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace fileFormats
123 } // End namespace Foam
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 #endif
128 
129 // ************************************************************************* //
A line primitive.
Definition: line.H:56
A class for handling file names.
Definition: fileName.H:79
virtual bool read(const fileName &)
Read from file.
Definition: OBJedgeFormat.C:97
void operator=(const OBJedgeFormat &)=delete
Disallow default bitwise assignment.
static void write(const fileName &, const edgeMesh &)
Write surface mesh components by proxy.
virtual ~OBJedgeFormat()
Destructor.
Definition: OBJedgeFormat.H:93
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return surface.
Definition: OBJedgeFormat.H:83
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
graph_traits< Graph >::vertices_size_type size_type
Definition: SloanRenumber.C:73
Points connected by edges.
Definition: edgeMesh.H:69
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Provide a means of reading/writing Alias/Wavefront OBJ format.
Definition: OBJedgeFormat.H:55
OBJedgeFormat(const fileName &)
Construct from file name.
Definition: OBJedgeFormat.C:37
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Namespace for OpenFOAM.