Utility fuctions for DGF IO. More...
Functions | |
unsigned int | check (std::ifstream &, std::vector< std::vector< int > > &) |
unsigned int | checkData (std::ifstream &, int &) |
template<typename T> | |
unsigned int | readData (std::ifstream &file_handle, int &N, std::vector< T > &Data) |
unsigned int | readMesh (std::ifstream &, int &, int &, std::vector< std::array< double, 3 > > &, std::vector< std::vector< int > > &) |
unsigned int | readMesh (std::ifstream &, int &, int &, std::vector< std::vector< double > > &, std::vector< std::vector< int > > &) |
template<typename T> | |
unsigned int | readSimplexData (std::ifstream &file_handle, int &n, std::vector< T > &data, const std::string &data_name="") |
template<typename T> | |
unsigned int | readVertexData (std::ifstream &file_handle, int &n, std::vector< T > &data, const std::string &data_name="") |
unsigned int | scan (std::ifstream &, int &, int &, std::vector< std::string > &, std::vector< std::string > &, std::vector< int > &, std::vector< int > &) |
unsigned int | scanData (std::ifstream &, int &) |
template<typename T> | |
unsigned int | writeData (std::ofstream &, int &, std::vector< T > &) |
unsigned int | writeMesh (std::ofstream &, int &, int &, std::vector< std::array< double, 3 > > &, std::vector< std::vector< int > > &) |
unsigned int | writeMesh (std::ofstream &, int &, int &, std::vector< std::vector< double > > &, std::vector< std::vector< int > > &) |
template<typename T> | |
unsigned int | writeSimplexData (std::ofstream &file_handle, int &N, std::vector< T > &Data, const std::string &Data_name="") |
template<typename T> | |
unsigned int | writeVertexData (std::ofstream &file_handle, int &N, std::vector< T > &Data, const std::string &Data_name="") |
Detailed Description
Utility fuctions for DGF IO.
/}
Function Documentation
◆ check()
unsigned int bitpit::dgf::check | ( | std::ifstream & | file_handle, |
std::vector< std::vector< int > > & | err_code ) |
Scan dgf file and check for format error(s) within the file.
- Parameters
-
[in,out] file_handle input stream from dgf file. [in,out] err_code on output stores the error code for format error(s) found in each data section: err_code[0][0] stores the list of error codes found in the vertex section err_code[1][0] stores the list of error codes found in the cell section err_code[2][i] stores the list of error codes found in the i-th vertex data section err_code[3][i] stores the list of error codes found in the i-th cell data section Error codes are listed below: err_code[i][j] = 0: no error(s) found err_code[i][j] = 1: unterminated data block err_code[i][j] = 2: unreadable data
- Returns
- error flag for I/O errors: err = 0: no error(s) encountered err = 1: failed to scan dgf file.
◆ checkData()
unsigned int bitpit::dgf::checkData | ( | std::ifstream & | file_handle, |
int & | err_code ) |
Scan dgf data block and check for format errors.
- Parameters
-
[in,out] file_handle input stream from dgf file. [in,out] err_code error code for format error founds in the data block err_code = 0: no error(s) found err_code = 1: unterminated data block err_code = 2: unreadable data
- Returns
- error flag for I/O errors: err = 0: no error(s) encountered err = 1: failed to scan dgf file.
◆ readData()
unsigned int bitpit::dgf::readData | ( | std::ifstream & | file_handle, |
int & | N, | ||
std::vector< T > & | Data ) |
Read data block from dgf file.
- Parameters
-
[in,out] file_handle input stream from dgf file [in,out] N number data entries loaded from the data set [in,out] Data on output stores the data loaded from the data block
- Returns
- error flag tor I/O errors err = 0: no error(s) encountered err = 1: failed to load data from dgf file
◆ readMesh() [1/2]
unsigned int bitpit::dgf::readMesh | ( | std::ifstream & | file_handle, |
int & | nV, | ||
int & | nS, | ||
std::vector< std::array< double, 3 > > & | V, | ||
std::vector< std::vector< int > > & | S ) |
Load mesh from dgf file. Overloading of function dgf::readMesh() for container vector<array<double,3>>
- Parameters
-
[in] file_handle input file stream [in,out] nV on input stores the number of vertices already acquired from the dgf file. On output stores the input value incremented by the number of mesh vertices loaded from the dgf file. [in,out] nS on input stores the number of cells already acquired from the dgf file. On output stores the input value incremented by the number of mesh cells loaded from the dgf file. [in,out] V vertex coordinate list. On output stores the coordinates of the vertices already acquired from the dgf file. New coordinates are appended at the end of V. [in,out] S cell->vertex connectivity data. On output stores the connectivity entries for cells acquired from the dgf file. New connectivity entries are appended at the and of S.
- Returns
- error flag for I/O errors. err = 0: no error(s) occurred err = 1: failed to import mesh data from dgf file.
◆ readMesh() [2/2]
unsigned int bitpit::dgf::readMesh | ( | std::ifstream & | file_handle, |
int & | nV, | ||
int & | nS, | ||
std::vector< std::vector< double > > & | V, | ||
std::vector< std::vector< int > > & | S ) |
Load mesh from dgf file.
- Parameters
-
[in] file_handle input file stream [in,out] nV on input stores the number of vertices already acquired from the dgf file. On output stores the input value incremented by the number of mesh vertices loaded from the dgf file. [in,out] nS on input stores the number of cells already acquired from the dgf file. On output stores the input value incremented by the number of mesh cells loaded from the dgf file. [in,out] V vertex coordinate list. On output stores the coordinates of the vertices already acquired from the dgf file. New coordinates are appended at the end of V. [in,out] S cell->vertex connectivity data. On output stores the connectivity entries for cells acquired from the dgf file. New connectivity entries are appended at the and of S.
- Returns
- error flag for I/O errors. err = 0: no error(s) occurred err = 1: failed to import mesh data from dgf file.
◆ readSimplexData()
unsigned int bitpit::dgf::readSimplexData | ( | std::ifstream & | file_handle, |
int & | n, | ||
std::vector< T > & | data, | ||
const std::string & | data_name ) |
Read cell data from dgf file.
- Parameters
-
[in,out] file_handle input stream from dgf file [in,out] n number data entries loaded from the data set [in,out] data on output stores the data loaded from the data block [in] data_name name of the cell data set to be loaded. If no name is specified (i.e. data_name = "") the first cell data set encountered in the dgf file is returned. If no cell data set matching the input name is found, no data is loaded from the dgf file.
- Returns
- error flag tor I/O errors err = 0: no error(s) encountered err = 1: failed to load data from dgf file
◆ readVertexData()
unsigned int bitpit::dgf::readVertexData | ( | std::ifstream & | file_handle, |
int & | n, | ||
std::vector< T > & | data, | ||
const std::string & | data_name ) |
Read vertex data from dgf file.
- Parameters
-
[in,out] file_handle input stream from dgf file [in,out] n number data entries loaded from the data set [in,out] data on output stores the data loaded from the data block [in] data_name name of the vertex data set to be loaded. If no name is specified (i.e. data_name = "") the first vertex data set encountered in the dgf file is returned. If no vertex data set matching the input name is found, no data is loaded from the dgf file.
- Returns
- error flag tor I/O errors err = 0: no error(s) encountered err = 1: failed to load data from dgf file
◆ scan()
unsigned int bitpit::dgf::scan | ( | std::ifstream & | file_handle, |
int & | nV, | ||
int & | nS, | ||
std::vector< std::string > & | sV_data, | ||
std::vector< std::string > & | sS_data, | ||
std::vector< int > & | nV_data, | ||
std::vector< int > & | nS_data ) |
Scan dgf file and gather infos
- Parameters
-
[in,out] file_handle input stream from dgf file. [in,out] nV on output stores the number of mesh vertices [in,out] nS on output stores the number of mesh cells [in,out] sV_data name associated to each vertex data block [in,out] sS_data name associated to each cell data block [in,out] nV_data number of data entries for each vertex data block [in,out] nS_data number of data entries for each cell data block
- Returns
- error flag for I/O errors: err = 0: no error(s) encountered err = 1: failed to scan dgf file.
◆ scanData()
unsigned int bitpit::dgf::scanData | ( | std::ifstream & | file_handle, |
int & | n ) |
Scan dgf data block and returns the number of entries in the block.
- Parameters
-
[in,out] file_handle input stream from dgf file [in,out] n on output stores the number of entries found in the data block
- Returns
- error flag for I/O errors: err = 0: no error(s) encountered err = 1: failed to scan dgf file.
◆ writeData()
unsigned int bitpit::dgf::writeData | ( | std::ofstream & | file_handle, |
int & | N, | ||
std::vector< T > & | Data ) |
Write data block to dgf file.
- Parameters
-
[in,out] file_handle output stream to dgf file [in,out] N number data entries to be written to file [in,out] Data container storing the data
- Returns
- error flag tor I/O errors err = 0: no error(s) encountered err = 1: failed to write data to dgf file
◆ writeMesh() [1/2]
unsigned int bitpit::dgf::writeMesh | ( | std::ofstream & | file_handle, |
int & | nV, | ||
int & | nS, | ||
std::vector< std::array< double, 3 > > & | V, | ||
std::vector< std::vector< int > > & | S ) |
Export mesh to dgf file. Overloading of function dgf::writeMesh() for container vector<array<double,3> >
- Parameters
-
[in,out] file_handle output stream to dgf file. [in] nV number of mesh vertices [in] nS number of mesh cells [in] V vertex coordinate list [in] S cell->vertex connectivity
- Returns
- error flag for I/O errors: err = 0: no error(s) encountered err = 1: failed to write data to dgf file.
◆ writeMesh() [2/2]
unsigned int bitpit::dgf::writeMesh | ( | std::ofstream & | file_handle, |
int & | nV, | ||
int & | nS, | ||
std::vector< std::vector< double > > & | V, | ||
std::vector< std::vector< int > > & | S ) |
Export mesh to dgf file.
- Parameters
-
[in,out] file_handle output stream to dgf file. [in] nV number of mesh vertices [in] nS number of mesh cells [in] V vertex coordinate list [in] S cell->vertex connectivity
- Returns
- error flag for I/O errors: err = 0: no error(s) encountered err = 1: failed to write data to dgf file.
◆ writeSimplexData()
unsigned int bitpit::dgf::writeSimplexData | ( | std::ofstream & | file_handle, |
int & | N, | ||
std::vector< T > & | Data, | ||
const std::string & | Data_name ) |
Write cell data to dgf file.
- Parameters
-
[in,out] file_handle output stream to dgf file [in,out] N number data entries to be written [in,out] Data container storing the data [in] Data_name name of the cell data set
- Returns
- error flag tor I/O errors err = 0: no error(s) encountered err = 1: failed to load data from dgf file
◆ writeVertexData()
unsigned int bitpit::dgf::writeVertexData | ( | std::ofstream & | file_handle, |
int & | N, | ||
std::vector< T > & | Data, | ||
const std::string & | Data_name ) |
Write vertex data to dgf file.
- Parameters
-
[in,out] file_handle output stream to dgf file [in,out] N number data entries to be written [in,out] Data container storing the data [in] Data_name name of the vertex data set
- Returns
- error flag tor I/O errors err = 0: no error(s) encountered err = 1: failed to load data from dgf file
