ug4
|
Grants read access to vtu (vtk) files. More...
#include <file_io_vtu.h>
Classes | |
struct | GridEntry |
struct | SubsetHandlerEntry |
Public Member Functions | |
const char * | get_grid_name (size_t index) const |
returns the name of the i-th grid More... | |
const char * | get_subset_handler_name (size_t refGridIndex, size_t subsetHandlerIndex) const |
returns the name of the given subset handler More... | |
template<class TPositionAttachment > | |
bool | grid (Grid &gridOut, size_t index, TPositionAttachment &aPos) |
returns the i-th grid. More... | |
GridReaderVTU () | |
size_t | num_grids () const |
returns the number of grids in the given file More... | |
size_t | num_subset_handlers (size_t refGridIndex) const |
returns the number of subset handlers for the given grid More... | |
bool | parse_file (const char *filename) |
parses an xml file More... | |
bool | subset_handler (ISubsetHandler &shOut, size_t refGridIndex, size_t subsetHandlerIndex) |
fills the given subset-handler More... | |
virtual | ~GridReaderVTU () |
Static Public Member Functions | |
static std::string const | getRegionOfInterestIdentifyer () |
static void | setRegionOfInterestIdentifier (std::string const ®OfInt) |
Protected Member Functions | |
template<class T > | |
void | check_indices (std::vector< T > &inds, size_t first, size_t num, size_t max) |
bool | create_cells (std::vector< GridObject * > &cellsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > vertices, size_t pieceVrtOffset) |
template<class TAAPos > | |
bool | create_vertices (std::vector< Vertex * > &vrtsOut, Grid &grid, rapidxml::xml_node<> *vrtNode, TAAPos aaPos) |
creates vertices from a vertex-node. More... | |
rapidxml::xml_node * | find_child_node_by_argument_value (rapidxml::xml_node<> *parent, const char *nodeName, const char *argName, const char *argValue) |
virtual bool | new_document_parsed () |
initializes internal arrays More... | |
template<class T > | |
void | read_scalar_data (std::vector< T > &dataOut, rapidxml::xml_node<> *dataNode, bool clearData=true) |
void | trafoDblVec2Int (std::vector< double > const &dblVec, std::vector< int > &intVec) |
Protected Attributes | |
rapidxml::xml_document | m_doc |
the xml_document which stores the data More... | |
std::vector< GridEntry > | m_entries |
holds grids which already have been created More... | |
std::string | m_filename |
stores the file-name More... | |
Static Protected Attributes | |
static std::string | m_regionOfInterest = "regions" |
Grants read access to vtu (vtk) files.
Before any data can be retrieved using the get_* methods, a file has to be successfully loaded using load_file.
ug::GridReaderVTU::GridReaderVTU | ( | ) |
|
virtual |
|
protected |
References UG_COND_THROW.
Referenced by create_cells().
|
protected |
References check_indices(), grid(), m_filename, ug::UGError::push_msg(), read_scalar_data(), UG_COND_THROW, UG_LOG, UG_THROW, boost::vertices(), VRT, ug::VTK_HEXAHEDRON, ug::VTK_LINE, ug::VTK_NUM_TYPES, ug::VTK_PYRAMID, ug::VTK_QUAD, ug::VTK_TETRA, ug::VTK_TRIANGLE, ug::VTK_VERTEX, ug::VTK_WEDGE, and ug::VTKCellNames.
|
protected |
creates vertices from a vertex-node.
if aaPos has more coordinates per vertex than the vrtNode, 0's will be appended. If it has less, unused coordinates will be ignored.
References ug::Grid::create(), UG_COND_THROW, and UG_LOG.
|
protected |
Referenced by subset_handler().
const char * ug::GridReaderVTU::get_grid_name | ( | size_t | index | ) | const |
returns the name of the i-th grid
References m_entries, and num_grids().
const char * ug::GridReaderVTU::get_subset_handler_name | ( | size_t | refGridIndex, |
size_t | subsetHandlerIndex | ||
) | const |
returns the name of the given subset handler
References m_entries, num_grids(), and ug::GridReaderVTU::GridEntry::subsetHandlerEntries.
Referenced by subset_handler().
|
inlinestatic |
References m_regionOfInterest.
bool ug::GridReaderVTU::grid | ( | Grid & | gridOut, |
size_t | index, | ||
TPositionAttachment & | aPos | ||
) |
returns the i-th grid.
TPositionAttachments value type has to be compatible with MathVector. Make sure that a file has already been loaded.
References ug::Grid::attach_to_vertices(), ug::Grid::get_options(), ug::GRIDOPT_NONE, ug::Grid::has_vertex_attachment(), ug::Grid::set_options(), UG_COND_THROW, UG_LOG, and boost::vertices().
Referenced by create_cells(), and ug::LoadGridFromVTU().
|
protectedvirtual |
initializes internal arrays
searches for all grid-nodes and stores, resizes m_entries and stores the node for each entry.
If you create your own version of this method, don't forget to call the base-class implementation!
References m_doc, m_entries, ug::GridReaderVTU::GridEntry::subsetHandlerEntries, and UG_COND_THROW.
Referenced by parse_file().
|
inline |
returns the number of grids in the given file
References m_entries.
Referenced by get_grid_name(), get_subset_handler_name(), and ug::LoadGridFromVTU().
size_t ug::GridReaderVTU::num_subset_handlers | ( | size_t | refGridIndex | ) | const |
bool ug::GridReaderVTU::parse_file | ( | const char * | filename | ) |
parses an xml file
References m_doc, m_filename, m_regionOfInterest, and new_document_parsed().
Referenced by ug::LoadGridFromVTU().
|
protected |
Referenced by create_cells(), and subset_handler().
|
inlinestatic |
References m_regionOfInterest.
bool ug::GridReaderVTU::subset_handler | ( | ISubsetHandler & | shOut, |
size_t | refGridIndex, | ||
size_t | subsetHandlerIndex | ||
) |
fills the given subset-handler
References ug::ISubsetHandler::assign_subset(), ug::GridReaderVTU::GridEntry::cells, find_child_node_by_argument_value(), get_subset_handler_name(), m_entries, m_filename, ug::SubsetInfo::name, ug::GridReaderVTU::SubsetHandlerEntry::node, ug::GridReaderVTU::GridEntry::node, read_scalar_data(), ug::GridReaderVTU::SubsetHandlerEntry::sh, ug::ISubsetHandler::subset_info(), ug::GridReaderVTU::GridEntry::subsetHandlerEntries, trafoDblVec2Int(), UG_COND_THROW, UG_LOG, and UG_THROW.
Referenced by ug::LoadGridFromVTU().
|
protected |
Referenced by subset_handler().
|
protected |
the xml_document which stores the data
Referenced by new_document_parsed(), and parse_file().
|
protected |
holds grids which already have been created
Referenced by get_grid_name(), get_subset_handler_name(), new_document_parsed(), num_grids(), num_subset_handlers(), and subset_handler().
|
protected |
stores the file-name
Referenced by create_cells(), parse_file(), and subset_handler().
|
staticprotected |
Referenced by getRegionOfInterestIdentifyer(), parse_file(), and setRegionOfInterestIdentifier().