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-2022 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 protected:
61 
62  // Protected Member Functions
63 
64  //- Write header information
65  static void writeHeader
66  (
67  Ostream&,
68  const pointField&,
69  const edgeList&
70  );
71 
72 
73 public:
74 
75  // Constructors
76 
77  //- Construct from file name
78  edgeMeshFormat(const fileName&);
79 
80  //- Disallow default bitwise copy construction
81  edgeMeshFormat(const edgeMeshFormat&) = delete;
82 
83 
84  // Selectors
85 
86  //- Read file and return edgeMesh
87  static autoPtr<edgeMesh> New(const fileName& name)
88  {
89  return autoPtr<edgeMesh>
90  (
91  new edgeMeshFormat(name)
92  );
93  }
94 
95 
96  //- Destructor
97  virtual ~edgeMeshFormat()
98  {}
99 
100 
101  // Member Functions
102 
103  //- Read edgeMesh components from stream
104  static bool read
105  (
106  Istream&,
107  pointField&,
108  edgeList&
109  );
110 
111  //- Write edgeMesh components to stream
112  static Ostream& write
113  (
114  Ostream&,
115  const pointField&,
116  const edgeList&
117  );
118 
119  //- Write edgeMesh with a mimicked IOobject header
120  static void write(const fileName&, const edgeMesh&);
121 
122  //- Read from file
123  virtual bool read(const fileName&);
124 
125  //- Write object
126  virtual void write(const fileName& name) const
127  {
128  write(name, *this);
129  }
130 
131 
132  // Member Operators
133 
134  //- Disallow default bitwise assignment
135  void operator=(const edgeMeshFormat&) = delete;
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace fileFormats
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
static bool read(Istream &, pointField &, edgeList &)
Read edgeMesh components from stream.
A class for handling file names.
Definition: fileName.H:79
edgeMeshFormat(const fileName &)
Construct from file name.
void operator=(const edgeMeshFormat &)=delete
Disallow default bitwise assignment.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Provide a means of reading/writing the single-file OpenFOAM edge format.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Points connected by edges.
Definition: edgeMesh.H:69
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
virtual ~edgeMeshFormat()
Destructor.
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return edgeMesh.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
static void writeHeader(Ostream &, const pointField &, const edgeList &)
Write header information.
Namespace for OpenFOAM.
static Ostream & write(Ostream &, const pointField &, const edgeList &)
Write edgeMesh components to stream.