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 | Copyright (C) 2011-2012 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  //- Disallow default bitwise copy construct
71 
72  //- Disallow default bitwise assignment
73  void operator=(const OBJedgeFormat&);
74 
75 
76 public:
77 
78  // Constructors
79 
80  //- Construct from file name
81  OBJedgeFormat(const fileName&);
82 
83 
84  // Selectors
85 
86  //- Read file and return surface
87  static autoPtr<edgeMesh> New(const fileName& name)
88  {
89  return autoPtr<edgeMesh>
90  (
91  new OBJedgeFormat(name)
92  );
93  }
94 
95 
96  //- Destructor
97  virtual ~OBJedgeFormat()
98  {}
99 
100 
101  // Member Functions
102 
103  //- Write surface mesh components by proxy
104  static void write(const fileName&, const edgeMesh&);
105 
106  //- Read from file
107  virtual bool read(const fileName&);
108 
109  //- Write object file
110  virtual void write(const fileName& name) const
111  {
112  write(name, *this);
113  }
114 };
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace fileFormats
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
A line primitive.
Definition: line.H:56
A class for handling file names.
Definition: fileName.H:69
virtual bool read(const fileName &)
Read from file.
Definition: OBJedgeFormat.C:97
static void write(const fileName &, const edgeMesh &)
Write surface mesh components by proxy.
virtual ~OBJedgeFormat()
Destructor.
Definition: OBJedgeFormat.H:96
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return surface.
Definition: OBJedgeFormat.H:86
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
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Namespace for OpenFOAM.