edgeMeshFormat.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-2024 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::edgeMeshFormat
26 
27 Description
28  Provide a means of reading/writing the single-file OpenFOAM edge format.
29 
30  Note:
31  This class provides more methods than the regular edge format interface.
32 
33 SourceFiles
34  edgeMeshFormat.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef edgeMeshFormat_H
39 #define edgeMeshFormat_H
40 
41 #include "edgeMesh.H"
42 #include "Ostream.H"
43 #include "OFstream.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace fileFormats
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class edgeMeshFormat Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class edgeMeshFormat
57 :
58  public edgeMesh
59 {
60 public:
61 
62  // Constructors
63 
64  //- Construct from file name
65  edgeMeshFormat(const fileName&);
66 
67  //- Disallow default bitwise copy construction
68  edgeMeshFormat(const edgeMeshFormat&) = delete;
69 
70 
71  // Selectors
72 
73  //- Read file and return edgeMesh
74  static autoPtr<edgeMesh> New(const fileName& name)
75  {
76  return autoPtr<edgeMesh>
77  (
78  new edgeMeshFormat(name)
79  );
80  }
81 
82 
83  //- Destructor
84  virtual ~edgeMeshFormat()
85  {}
86 
87 
88  // Member Functions
89 
90  //- Read edgeMesh components from stream
91  static bool read
92  (
93  Istream&,
94  pointField&,
95  edgeList&
96  );
97 
98  //- Write edgeMesh components to stream
99  static Ostream& write
100  (
101  Ostream&,
102  const pointField&,
103  const edgeList&
104  );
105 
106  //- Write edgeMesh with a mimicked IOobject header
107  static void write(const fileName&, const edgeMesh&);
108 
109  //- Read from file
110  virtual bool read(const fileName&);
111 
112  //- Write object
113  virtual void write(const fileName& name) const
114  {
115  write(name, *this);
116  }
117 
118 
119  // Member Operators
120 
121  //- Disallow default bitwise assignment
122  void operator=(const edgeMeshFormat&) = delete;
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace fileFormats
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
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:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Points connected by edges.
Definition: edgeMesh.H:72
Provide a means of reading/writing the single-file OpenFOAM edge format.
void operator=(const edgeMeshFormat &)=delete
Disallow default bitwise assignment.
static bool read(Istream &, pointField &, edgeList &)
Read edgeMesh components from stream.
static Ostream & write(Ostream &, const pointField &, const edgeList &)
Write edgeMesh components to stream.
virtual ~edgeMeshFormat()
Destructor.
edgeMeshFormat(const fileName &)
Construct from file name.
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return edgeMesh.
A class for handling file names.
Definition: fileName.H:82
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39