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 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::fileFormats::edgeMeshFormat
29 
30 Description
31  Provide a means of reading/writing the single-file OpenFOAM edge format.
32 
33 Note
34  This class provides more methods than the regular edge format interface.
35 
36 SourceFiles
37  edgeMeshFormat.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef edgeMeshFormat_H
42 #define edgeMeshFormat_H
43 
44 #include "edgeMesh.H"
45 #include "Ostream.H"
46 #include "OFstream.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 namespace fileFormats
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class edgeMeshFormat Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class edgeMeshFormat
60 :
61  public edgeMesh
62 {
63  // Private Member Functions
64 
65  //- No copy construct
66  edgeMeshFormat(const edgeMeshFormat&) = delete;
67 
68  //- No copy assignment
69  void operator=(const edgeMeshFormat&) = delete;
70 
71 
72 protected:
73 
74  // Protected Member Functions
75 
76  //- Write header information
77  static void writeHeader
78  (
79  Ostream&,
80  const pointField&,
81  const edgeList&
82  );
83 
84 
85 public:
86 
87  // Constructors
88 
89  //- Construct from file name
90  explicit edgeMeshFormat(const fileName&);
91 
92 
93  // Selectors
94 
95  //- Read file and return edgeMesh
96  static autoPtr<edgeMesh> New(const fileName& name)
97  {
99  }
100 
101 
102  //- Destructor
103  virtual ~edgeMeshFormat() = default;
104 
105 
106  // Static Member Functions
107 
108  //- Read edgeMesh components from stream
109  static bool read
110  (
111  Istream&,
112  pointField&,
113  edgeList&
114  );
115 
116  //- Write edgeMesh components to stream
117  static Ostream& write
118  (
119  Ostream&,
120  const pointField&,
121  const edgeList&
122  );
123 
124  //- Write edge mesh to file with a mimicked IOobject header
125  static void write
126  (
127  const fileName& filename,
128  const edgeMesh& mesh,
129  IOstreamOption streamOpt = IOstreamOption(),
130  const dictionary& options = dictionary::null
131  );
132 
133 
134  // Member Functions
135 
136  //- Read from file
137  virtual bool read(const fileName& name);
138 
139  //- Write edge mesh to file
140  virtual void write
141  (
142  const fileName& name,
143  IOstreamOption streamOpt = IOstreamOption(),
144  const dictionary& options = dictionary::null
145  ) const
146  {
147  write(name, *this, streamOpt, options);
148  }
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace fileFormats
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::fileFormats::edgeMeshFormat
Provide a means of reading/writing the single-file OpenFOAM edge format.
Definition: edgeMeshFormat.H:58
Foam::fileFormats::edgeMeshFormat::New
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return edgeMesh.
Definition: edgeMeshFormat.H:95
OFstream.H
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:392
Foam::Field< vector >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
edgeMesh.H
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::fileFormats::edgeMeshFormat::write
static Ostream & write(Ostream &, const pointField &, const edgeList &)
Write edgeMesh components to stream.
Definition: edgeMeshFormat.C:118
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fileFormats::edgeMeshFormat::writeHeader
static void writeHeader(Ostream &, const pointField &, const edgeList &)
Write header information.
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fileFormats::edgeMeshFormat::read
static bool read(Istream &, pointField &, edgeList &)
Read edgeMesh components from stream.
Definition: edgeMeshFormat.C:97
Ostream.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< edge >
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fileFormats::edgeMeshFormat::~edgeMeshFormat
virtual ~edgeMeshFormat()=default
Destructor.
Foam::edgeMesh
Mesh data needed to do the Finite Area discretisation.
Definition: edgeFaMesh.H:53