#include <xdr_mgf.h>

Public Types | |
| enum | XdrIO_TYPE { UNKNOWN = -1, ENCODE =0, DECODE, W_ASCII, R_ASCII } |
Public Member Functions | |
| XdrMGF () | |
| XdrMGF () | |
| void | init (XdrIO_TYPE t, const char *fn, const char *type, int icnt) |
| virtual | ~XdrMGF () |
| void | fini () |
| int | dataBlk (int *array, int numvar, int size) |
| int | dataBlk (Real *array, int numvar, int size) |
| LegacyXdrIO::FileFormat | get_orig_flag () const |
| void | set_orig_flag (LegacyXdrIO::FileFormat in_orig_flag) |
| void | set_num_levels (unsigned int num_levels) |
| unsigned int | get_num_levels () |
Protected Attributes | |
| unsigned int | _num_levels |
| XdrIO_TYPE | m_type |
| XDR * | mp_xdr_handle |
| LegacyXdrIO::FileFormat | orig_flag |
| std::ifstream | mp_in |
| std::ofstream | mp_out |
Private Member Functions | |
| void | tokenize_first_line (const char *p) |
Private Attributes | |
| std::FILE * | mp_fp |
This class is taken directly from MGF. It facilitates reading and writing binary solution/mesh files using the xdr binary format, which allows for portable binary files across various platforms. For more information on the xdr format, see the standard C include file rpc/rpc.h.
There are essentially two inheritance trees and six classes: XdrMGF XdrHEAD ^ ^ ^ ^ | | | | XdrMESH XdrSOLN XdrMHEAD XdrSHEAD
XdrHEAD, XdrMHEAD, and XdrSHEAD just read the headers of solution and mesh files.
XdrMGF, XdrMESH, and XdrSOLN handle the "meat" of the files: everything other than the headers.
This enum specifies the access permission which will be acquired for the current xdr file. Note that it is only possible to read (DECODE) or write (ENCODE) but not both. For ASCII type files, use WRITE or READ instead!
| Enumerator | |
|---|---|
| UNKNOWN | |
| ENCODE | |
| DECODE | |
| W_ASCII | |
| R_ASCII | |
Definition at line 100 of file xdr_mgf.h.
|
inline |
Constructor. Intializes the access type, xdr file handle, xdr file pointer, and originator flag. Zero is a good default value for the flag, since that is the DEAL identifier. The xdr file handle is a struct defined in the standard C header rpc/rpc.h.
Definition at line 117 of file xdr_mgf.h.
|
inline |
Definition at line 119 of file xdr_mgf.h.
|
virtual |
| int libMesh::XdrMGF::dataBlk | ( | int * | array, |
| int | numvar, | ||
| int | size | ||
| ) |
Reads/Writes a block of ints to/from the current xdr file/file handle.
| array | Pointer to data to be read/written |
| numvar | The total number of variables (size of the array) |
| size | The size of each individual variable in the array |
Definition at line 264 of file xdr_mgf.C.
References DECODE, ENCODE, libMesh::libmesh_assert(), m_type, mp_in, mp_out, mp_xdr_handle, R_ASCII, and W_ASCII.
Referenced by libMesh::XdrMESH::BC(), libMesh::XdrMESH::coord(), libMesh::XdrMESH::Icon(), and libMesh::XdrSOLN::values().
| int libMesh::XdrMGF::dataBlk | ( | Real * | array, |
| int | numvar, | ||
| int | size | ||
| ) |
Read/Writes a block of Reals to/from the current xdr file/file handle.
Definition at line 327 of file xdr_mgf.C.
References DECODE, ENCODE, libMesh::libmesh_assert(), m_type, mp_in, mp_out, mp_xdr_handle, R_ASCII, libMesh::Real, and W_ASCII.
| void libMesh::XdrMGF::fini | ( | ) |
Finalizes operations on the current xdr file handle, and closes the xdr file.
Uses xdr_destroy found in rpc/rpc.h.
Definition at line 35 of file xdr_mgf.C.
References libmesh_nullptr, mp_fp, and mp_xdr_handle.
Referenced by init(), and ~XdrMGF().
|
inline |
Get number of levels
Definition at line 184 of file xdr_mgf.h.
References _num_levels.
Referenced by libMesh::XdrMESH::header(), init(), and libMesh::LegacyXdrIO::read_mesh().
|
inline |
Get the originator flag.
Definition at line 168 of file xdr_mgf.h.
References orig_flag.
Referenced by init(), libMesh::LegacyXdrIO::read_mesh(), and libMesh::LegacyXdrIO::write_mesh().
| void libMesh::XdrMGF::init | ( | XdrMGF::XdrIO_TYPE | t, |
| const char * | fn, | ||
| const char * | type, | ||
| int | icnt | ||
| ) |
Initialization of the xdr file. This function performs the following operations:
xdr file if necessary.xdr file name and opens this file.xdr file handle.Definition at line 68 of file xdr_mgf.C.
References libMesh::LegacyXdrIO::DEAL, DECODE, ENCODE, fini(), get_num_levels(), get_orig_flag(), libMesh::LegacyXdrIO::LIBM, m_type, libMesh::LegacyXdrIO::MGF, mp_fp, mp_in, mp_out, mp_xdr_handle, libMesh::Quality::name(), orig_flag, libMesh::out, R_ASCII, tokenize_first_line(), and W_ASCII.
Referenced by libMesh::XdrSOLN::init(), and libMesh::XdrMESH::init().
|
inline |
Set number of levels
Definition at line 179 of file xdr_mgf.h.
References _num_levels.
Referenced by libMesh::LegacyXdrIO::write_mesh().
|
inline |
Set the originator flag.
Definition at line 173 of file xdr_mgf.h.
References orig_flag.
Referenced by libMesh::LegacyXdrIO::read_mesh(), and libMesh::LegacyXdrIO::write_mesh().
|
inlineprivate |
This function allows us to set the number of levels in the mesh when reading.
Definition at line 242 of file xdr_mgf.h.
Referenced by init().
|
protected |
Number of levels of refinement in the mesh
Definition at line 191 of file xdr_mgf.h.
Referenced by get_num_levels(), and set_num_levels().
|
protected |
Specifies the read/write permission for the current xdr file. Possibilities are:
UNKNOWN = -1ENCODE = 0DECODE = 1 Definition at line 200 of file xdr_mgf.h.
Referenced by dataBlk(), libMesh::XdrSOLN::header(), libMesh::XdrMESH::header(), and init().
|
private |
|
protected |
An input file stream object
Definition at line 228 of file xdr_mgf.h.
Referenced by dataBlk(), libMesh::XdrSOLN::header(), libMesh::XdrMESH::header(), and init().
|
protected |
An output file stream object.
Definition at line 233 of file xdr_mgf.h.
Referenced by dataBlk(), libMesh::XdrSOLN::header(), libMesh::XdrMESH::header(), and init().
|
protected |
Pointer to the standard {xdr} struct. See the standard header file rpc/rpc.h for more information.
Definition at line 210 of file xdr_mgf.h.
Referenced by dataBlk(), fini(), libMesh::XdrSOLN::header(), libMesh::XdrMESH::header(), and init().
|
protected |
Flag indicating how much checking we need to do. We can read in mgf meshes more quickly because there is only one type of element in these meshes. Deal meshes on the other hand will require a check for each element to find out what type it is. Possible values are:
Definition at line 223 of file xdr_mgf.h.
Referenced by get_orig_flag(), libMesh::XdrMESH::header(), init(), and set_orig_flag().