Loading...
Searching...
No Matches
edgeMeshFormat.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::edgeMeshFormat
29
30Description
31 Provide a means of reading/writing the single-file OpenFOAM edge format.
32
33Note
34 This class provides more methods than the regular edge format interface.
35
36SourceFiles
37 edgeMeshFormat.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_edgeMeshFormat_H
42#define Foam_edgeMeshFormat_H
43
44#include "edgeMesh.H"
45#include "Ostream.H"
46#include "OFstream.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52namespace fileFormats
53{
55/*---------------------------------------------------------------------------*\
56 Class edgeMeshFormat Declaration
57\*---------------------------------------------------------------------------*/
58
60:
61 public edgeMesh
62{
63protected:
64
65 // Protected Member Functions
66
67 //- Write header information
68 static void writeHeader
69 (
70 Ostream&,
71 const pointField&,
72 const edgeList&
73 );
74
75
76public:
77
78 // Constructors
79
80 //- Construct from file name
81 explicit edgeMeshFormat(const fileName& filename);
82
83
84 // Selectors
85
86 //- Read file and return edgeMesh
87 static autoPtr<edgeMesh> New(const fileName& name)
92
93 //- Destructor
94 virtual ~edgeMeshFormat() = default;
95
96
97 // Static Member Functions
98
99 //- Read edgeMesh components from stream
100 static bool read
101 (
102 Istream&,
103 pointField&,
104 edgeList&
105 );
106
107 //- Write edgeMesh components to stream
108 static Ostream& write
109 (
110 Ostream&,
111 const pointField&,
112 const edgeList&
113 );
114
115 //- Write edge mesh to file with a mimicked IOobject header
116 static void write
117 (
118 const fileName& filename,
119 const edgeMesh& mesh,
120 IOstreamOption streamOpt = IOstreamOption(),
121 const dictionary& options = dictionary::null
122 );
123
124
125 // Member Functions
126
127 //- Read from file
128 virtual bool read(const fileName& filename) override;
129
130 //- Write edge mesh to file
131 virtual void write
132 (
133 const fileName& name,
134 IOstreamOption streamOpt = IOstreamOption(),
135 const dictionary& options = dictionary::null
136 ) const override
137 {
138 write(name, *this, streamOpt, options);
139 }
140
141 //- Write edge mesh to file
142 virtual void write
143 (
145 const word& fileType, /* ignored */
146 IOstreamOption streamOpt = IOstreamOption(),
147 const dictionary& options = dictionary::null
148 ) const override
149 {
150 write(name, *this, streamOpt, options);
151 }
152};
153
154
155// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156
157} // End namespace fileFormats
158} // End namespace Foam
159
160// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161
162#endif
163
164// ************************************************************************* //
A simple container for options an IOstream can normally have.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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
static void writeHeader(Ostream &, const pointField &, const edgeList &)
Write header information.
static bool read(Istream &, pointField &, edgeList &)
Read edgeMesh components from stream.
virtual void write(const fileName &name, const word &fileType, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write edge mesh to file.
virtual ~edgeMeshFormat()=default
Destructor.
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return edgeMesh.
virtual void write(const fileName &name, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write edge mesh to file.
edgeMeshFormat(const fileName &filename)
Construct from file name.
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.
List< edge > edgeList
List of edge.
Definition edgeList.H:32
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
vectorField pointField
pointField is a vectorField.
runTime write()