Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fileFormats::OBJedgeFormat
29
30Description
31 Provide a means of reading/writing Alias/Wavefront OBJ format.
32
33 Does not handle negative vertex indices.
34
35SourceFiles
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
49namespace Foam
50{
51namespace fileFormats
52{
54/*---------------------------------------------------------------------------*\
55 Class OBJedgeFormat Declaration
56\*---------------------------------------------------------------------------*/
57
58class OBJedgeFormat
59:
60 public edgeMesh
61{
62public:
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;
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);
122};
123
124
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127} // End namespace fileFormats
128} // End namespace Foam
129
130// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132#endif
133
134// ************************************************************************* //
A simple container for options an IOstream can normally have.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > NewFrom(Args &&... args)
Construct autoPtr from derived type with forwarding arguments.
Definition autoPtr.H:193
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition dictionary.H:487
edgeMesh(const faMesh &mesh)
Construct finite-area edge mesh faMesh reference.
Definition edgeFaMesh.H:58
OBJedgeFormat(const fileName &filename)
Construct from file name.
virtual ~OBJedgeFormat()=default
Destructor.
virtual bool read(const fileName &filename) override
Read from file.
virtual void write(const fileName &name, const word &fileType, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write to file.
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return surface.
virtual void write(const fileName &name, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write to file.
A class for handling file names.
Definition fileName.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Namespace to isolate specifics for file formats, and some common utilities.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
runTime write()