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-2018 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  // Private Member Functions
61 
62  //- Disallow default bitwise copy construct
64 
65  //- Disallow default bitwise assignment
66  void operator=(const edgeMeshFormat&);
67 
68 
69 protected:
70 
71  // Protected Member Functions
72 
73  //- Write header information
74  static void writeHeader
75  (
76  Ostream&,
77  const pointField&,
78  const edgeList&
79  );
80 
81 
82 public:
83 
84  // Constructors
85 
86  //- Construct from file name
87  edgeMeshFormat(const fileName&);
88 
89 
90  // Selectors
91 
92  //- Read file and return edgeMesh
93  static autoPtr<edgeMesh> New(const fileName& name)
94  {
95  return autoPtr<edgeMesh>
96  (
97  new edgeMeshFormat(name)
98  );
99  }
100 
101 
102  //- Destructor
103  virtual ~edgeMeshFormat()
104  {}
105 
106 
107  // Member Functions
108 
109  //- Read edgeMesh components from stream
110  static bool read
111  (
112  Istream&,
113  pointField&,
114  edgeList&
115  );
116 
117  //- Write edgeMesh components to stream
118  static Ostream& write
119  (
120  Ostream&,
121  const pointField&,
122  const edgeList&
123  );
124 
125  //- Write edgeMesh with a mimicked IOobject header
126  static void write(const fileName&, const edgeMesh&);
127 
128  //- Read from file
129  virtual bool read(const fileName&);
130 
131  //- Write object
132  virtual void write(const fileName& name) const
133  {
134  write(name, *this);
135  }
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:69
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:53
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.