Go to the documentation of this file.
20 #ifndef LIBMESH_XDR_CXX_H
21 #define LIBMESH_XDR_CXX_H
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/libmesh.h"
26 #include "libmesh/enum_xdr_mode.h"
31 #ifdef LIBMESH_HAVE_XDR
39 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
45 #ifndef LIBMESH_DEFAULT_SINGLE_PRECISION
46 #define xdr_REAL xdr_double
48 #define xdr_REAL xdr_float
84 void open (
const std::string &
name);
129 template <
typename T>
135 template <
typename T>
141 template <
typename T>
147 template <
typename T>
170 template <
typename T>
173 template <
typename T>
174 void do_read(std::complex<T> & a);
176 template <
typename T>
177 void do_read(std::vector<T> & a);
179 template <
typename T>
180 void do_read(std::vector<std::complex<T>> & a);
185 template <
typename T>
188 template <
typename T>
191 template <
typename T>
194 template <
typename T>
195 void do_write(std::vector<std::complex<T>> & a);
207 #ifdef LIBMESH_HAVE_XDR
225 std::unique_ptr<std::istream>
in;
230 std::unique_ptr<std::ostream>
out;
253 #endif // LIBMESH_XDR_CXX_H
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
bool gzipped_file
Are we reading/writing zipped files?
XdrMODE access_mode() const
The libMesh namespace provides an interface to certain functionality in the library.
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
std::string file_name
The file name.
int version() const
Gets the version of the file that is being read.
const int comm_len
A buffer to put comment strings into.
Xdr(const std::string &name="", const XdrMODE m=UNKNOWN)
Constructor.
int version_number
Version of the file being read.
void do_write(T &a)
Helper method for writing different data types.
void data(T &a, const char *comment="")
Inputs or outputs a single value.
XdrMODE
Defines an enum for read/write mode in Xdr format.
const XdrMODE mode
The mode used for accessing the file.
void do_read(T &a)
Helper method for reading different data types.
void open(const std::string &name)
Opens the file.
void data_stream(T *val, const unsigned int len, const unsigned int line_break=libMesh::invalid_uint)
Inputs or outputs a raw data stream.
const unsigned int xdr_MAX_STRING_LENGTH
void close()
Closes the file if it is open.
std::unique_ptr< std::ostream > out
The output file stream.
void set_version(int ver)
Sets the version of the file that is being read.
Xdr & operator<<(T &a)
Same, but provides an ostream like interface.
std::unique_ptr< std::istream > in
The input file stream.
std::unique_ptr< XDR > xdrs
Pointer to the standard XDR struct.
void comment(std::string &)
Writes or reads (ignores) a comment line.
Xdr & operator>>(T &a)
Same, but provides an istream like interface.
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
char comm[xdr_MAX_STRING_LENGTH]