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 33 #include "libmesh/ignore_warnings.h" 36 #include "libmesh/restore_warnings.h" 43 #include <string_view> 47 #ifndef LIBMESH_DEFAULT_SINGLE_PRECISION 48 #define xdr_REAL xdr_double 50 #define xdr_REAL xdr_float 82 Xdr (std::ostream & stream);
87 Xdr (std::istream & stream);
142 template <
typename T>
148 template <
typename T>
154 template <
typename T>
160 template <
typename T>
183 template <
typename T>
186 template <
typename T>
187 void do_read(std::complex<T> & a);
189 template <
typename T>
190 void do_read(std::vector<T> & a);
192 template <
typename T>
193 void do_read(std::vector<std::complex<T>> & a);
198 template <
typename T>
201 template <
typename T>
204 template <
typename T>
207 template <
typename T>
208 void do_write(std::vector<std::complex<T>> & a);
213 template <
typename T>
215 const unsigned int line_break);
220 template <
typename XFP>
222 #ifdef LIBMESH_HAVE_XDR
228 const unsigned int line_break,
241 #ifdef LIBMESH_HAVE_XDR 259 std::unique_ptr<std::istream>
in;
264 std::unique_ptr<std::ostream>
out;
287 #endif // LIBMESH_XDR_CXX_H std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Xdr(std::string name="", const XdrMODE m=UNKNOWN)
File-based constructor.
const int comm_len
A buffer to put comment strings into.
std::string file_name
The file name.
const unsigned int xdr_MAX_STRING_LENGTH
void do_write(T &a)
Helper method for writing different data types.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
char comm[xdr_MAX_STRING_LENGTH]
void comment(std::string &)
Writes or reads (ignores) a comment line.
void close()
Closes the file if it is open.
Xdr & operator>>(T &a)
Same, but provides an istream like interface.
int version() const
Gets the version of the file that is being read.
The libMesh namespace provides an interface to certain functionality in the library.
const XdrMODE mode
The mode used for accessing the file.
void do_read(T &a)
Helper method for reading different data types.
bool gzipped_file
Are we reading/writing zipped files?
void _complex_data_stream(std::complex< T > *val, const unsigned int len, const unsigned int line_break)
Helper method for complex types.
XdrMODE
Defines an enum for read/write mode in Xdr format.
void data(T &a, std::string_view comment="")
Inputs or outputs a single value.
std::unique_ptr< std::istream > in
The input file stream.
int version_number
Version of the file being read.
std::unique_ptr< std::ostream > out
The output file stream.
XdrMODE access_mode() const
Xdr & operator<<(T &a)
Same, but provides an ostream like interface.
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
std::unique_ptr< XDR > xdrs
Pointer to the standard XDR struct.
void set_version(int ver)
Sets the version of the file that is being read.
void _xfp_data_stream(XFP *val, const unsigned int len, #ifdef LIBMESH_HAVE_XDR xdrproc_t #else void *#endif xdr_proc, const unsigned int line_break, const int n_digits)
Helper method for extended FP types.
void open(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.