ug4
ug::GridReaderUGX Class Reference

Grants read access to ugx files. More...

#include <file_io_ugx.h>

Classes

struct  GridEntry
 
struct  SelectorEntry
 
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_projection_handler_name (size_t refGridIndex, size_t phIndex) const
 returns the name of the given projection-handler More...
 
size_t get_projection_handler_subset_handler_index (size_t phIndex, size_t refGridIndex)
 returns the subset handler index for a projection handler More...
 
const char * get_selector_name (size_t refGridIndex, size_t selectorIndex) const
 returns the name of the given selector 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...
 
 GridReaderUGX ()
 
size_t num_grids () const
 returns the number of grids More...
 
size_t num_projection_handlers (size_t refGridIndex) const
 returns the number of projection-handlers for the given grid More...
 
size_t num_selectors (size_t refGridIndex) const
 returns the number of selectors for the given grid 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 projection_handler (ProjectionHandler &phOut, size_t phIndex, size_t refGridIndex)
 fills the given projection-handler More...
 
bool selector (ISelector &selOut, size_t selectorIndex, size_t refGridIndex)
 fills the given selector More...
 
bool subset_handler (ISubsetHandler &shOut, size_t subsetHandlerIndex, size_t refGridIndex)
 fills the given subset-handler More...
 
virtual ~GridReaderUGX ()
 

Protected Member Functions

bool create_constrained_edges (std::vector< Edge * > &edgesOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_constrained_quadrilaterals (std::vector< Face * > &facesOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_constrained_triangles (std::vector< Face * > &facesOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
template<class TAAPos >
bool create_constrained_vertices (std::vector< Vertex * > &vrtsOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *vrtNode, TAAPos aaPos)
 
bool create_constraining_edges (std::vector< Edge * > &edgesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_constraining_quadrilaterals (std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_constraining_triangles (std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_edges (std::vector< Edge * > &edgesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_hexahedrons (std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_octahedrons (std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_prisms (std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_pyramids (std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_quadrilaterals (std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_tetrahedrons (std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
bool create_triangles (std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
 
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...
 
virtual bool new_document_parsed ()
 initializes internal arrays More...
 
template<class TElem >
bool read_attachment (Grid &grid, rapidxml::xml_node<> *node)
 
SPRefinementProjector read_projector (rapidxml::xml_node<> *projNode)
 
template<class TGeomObj >
bool read_selector_elements (ISelector &selOut, const char *elemNodeName, rapidxml::xml_node<> *selNode, std::vector< TGeomObj * > &vElems)
 
template<class TGeomObj >
bool read_subset_handler_elements (ISubsetHandler &shOut, const char *elemNodeName, rapidxml::xml_node<> *subsetNode, int subsetIndex, std::vector< TGeomObj * > &vElems)
 

Protected Attributes

rapidxml::xml_document m_doc
 the xml_document which stores the data More...
 
std::vector< GridEntrym_entries
 holds grids which already have been created More...
 

Detailed Description

Grants read access to ugx files.

Before any data can be retrieved using the get_* methods, a file has to be successfully loaded using load_file.

Todo:
: Improve performance by using in-situ stringstreams during element creation.

Constructor & Destructor Documentation

◆ GridReaderUGX()

ug::GridReaderUGX::GridReaderUGX ( )

◆ ~GridReaderUGX()

ug::GridReaderUGX::~GridReaderUGX ( )
virtual

Member Function Documentation

◆ create_constrained_edges()

bool ug::GridReaderUGX::create_constrained_edges ( std::vector< Edge * > &  edgesOut,
std::vector< std::pair< int, int > > &  constrainingObjsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_constrained_quadrilaterals()

bool ug::GridReaderUGX::create_constrained_quadrilaterals ( std::vector< Face * > &  facesOut,
std::vector< std::pair< int, int > > &  constrainingObjsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_constrained_triangles()

bool ug::GridReaderUGX::create_constrained_triangles ( std::vector< Face * > &  facesOut,
std::vector< std::pair< int, int > > &  constrainingObjsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_constrained_vertices()

template<class TAAPos >
bool ug::GridReaderUGX::create_constrained_vertices ( std::vector< Vertex * > &  vrtsOut,
std::vector< std::pair< int, int > > &  constrainingObjsOut,
Grid grid,
rapidxml::xml_node<> *  vrtNode,
TAAPos  aaPos 
)
protected

◆ create_constraining_edges()

bool ug::GridReaderUGX::create_constraining_edges ( std::vector< Edge * > &  edgesOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_constraining_quadrilaterals()

bool ug::GridReaderUGX::create_constraining_quadrilaterals ( std::vector< Face * > &  facesOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_constraining_triangles()

bool ug::GridReaderUGX::create_constraining_triangles ( std::vector< Face * > &  facesOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_edges()

bool ug::GridReaderUGX::create_edges ( std::vector< Edge * > &  edgesOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_hexahedrons()

bool ug::GridReaderUGX::create_hexahedrons ( std::vector< Volume * > &  volsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_octahedrons()

bool ug::GridReaderUGX::create_octahedrons ( std::vector< Volume * > &  volsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_prisms()

bool ug::GridReaderUGX::create_prisms ( std::vector< Volume * > &  volsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_pyramids()

bool ug::GridReaderUGX::create_pyramids ( std::vector< Volume * > &  volsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_quadrilaterals()

bool ug::GridReaderUGX::create_quadrilaterals ( std::vector< Face * > &  facesOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_tetrahedrons()

bool ug::GridReaderUGX::create_tetrahedrons ( std::vector< Volume * > &  volsOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_triangles()

bool ug::GridReaderUGX::create_triangles ( std::vector< Face * > &  facesOut,
Grid grid,
rapidxml::xml_node<> *  node,
std::vector< Vertex * > &  vrts 
)
protected

References ug::Grid::create(), and UG_LOG.

◆ create_vertices()

template<class TAAPos >
bool ug::GridReaderUGX::create_vertices ( std::vector< Vertex * > &  vrtsOut,
Grid grid,
rapidxml::xml_node<> *  vrtNode,
TAAPos  aaPos 
)
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().

◆ get_grid_name()

const char * ug::GridReaderUGX::get_grid_name ( size_t  index) const

returns the name of the i-th grid

◆ get_projection_handler_name()

const char * ug::GridReaderUGX::get_projection_handler_name ( size_t  refGridIndex,
size_t  phIndex 
) const

returns the name of the given projection-handler

References ug::GridReaderUGX::GridEntry::projectionHandlerEntries, and UG_COND_THROW.

◆ get_projection_handler_subset_handler_index()

size_t ug::GridReaderUGX::get_projection_handler_subset_handler_index ( size_t  phIndex,
size_t  refGridIndex 
)

returns the subset handler index for a projection handler

References ug::GridReaderUGX::GridEntry::projectionHandlerEntries, and UG_COND_THROW.

Referenced by ug::LoadGridFromUGX().

◆ get_selector_name()

const char * ug::GridReaderUGX::get_selector_name ( size_t  refGridIndex,
size_t  selectorIndex 
) const

returns the name of the given selector

References ug::GridReaderUGX::GridEntry::selectorEntries, and UG_COND_THROW.

◆ get_subset_handler_name()

const char * ug::GridReaderUGX::get_subset_handler_name ( size_t  refGridIndex,
size_t  subsetHandlerIndex 
) const

returns the name of the given subset handler

References ug::GridReaderUGX::GridEntry::subsetHandlerEntries.

Referenced by ug::LoadGridFromUGX().

◆ grid()

template<class TPositionAttachment >
bool ug::GridReaderUGX::grid ( Grid gridOut,
size_t  index,
TPositionAttachment &  aPos 
)

◆ new_document_parsed()

bool ug::GridReaderUGX::new_document_parsed ( )
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 ug::GridReaderUGX::GridEntry::projectionHandlerEntries, ug::GridReaderUGX::GridEntry::selectorEntries, and ug::GridReaderUGX::GridEntry::subsetHandlerEntries.

◆ num_grids()

size_t ug::GridReaderUGX::num_grids ( ) const
inline

returns the number of grids

References m_entries.

Referenced by ug::LoadGridFromUGX().

◆ num_projection_handlers()

size_t ug::GridReaderUGX::num_projection_handlers ( size_t  refGridIndex) const

returns the number of projection-handlers for the given grid

References UG_COND_THROW.

Referenced by ug::LoadGridFromUGX().

◆ num_selectors()

size_t ug::GridReaderUGX::num_selectors ( size_t  refGridIndex) const

returns the number of selectors for the given grid

References UG_COND_THROW.

◆ num_subset_handlers()

size_t ug::GridReaderUGX::num_subset_handlers ( size_t  refGridIndex) const

returns the number of subset handlers for the given grid

References UG_LOG.

Referenced by ug::LoadGridFromUGX().

◆ parse_file()

bool ug::GridReaderUGX::parse_file ( const char *  filename)

parses an xml file

Referenced by ug::LoadGridFromUGX().

◆ projection_handler()

bool ug::GridReaderUGX::projection_handler ( ProjectionHandler phOut,
size_t  phIndex,
size_t  refGridIndex 
)

◆ read_attachment()

template<class TElem >
bool ug::GridReaderUGX::read_attachment ( Grid grid,
rapidxml::xml_node<> *  node 
)
protected

◆ read_projector()

SPRefinementProjector ug::GridReaderUGX::read_projector ( rapidxml::xml_node<> *  projNode)
protected

◆ read_selector_elements()

template<class TGeomObj >
bool ug::GridReaderUGX::read_selector_elements ( ISelector selOut,
const char *  elemNodeName,
rapidxml::xml_node<> *  selNode,
std::vector< TGeomObj * > &  vElems 
)
protected

References ug::ISelector::select(), and UG_LOG.

◆ read_subset_handler_elements()

template<class TGeomObj >
bool ug::GridReaderUGX::read_subset_handler_elements ( ISubsetHandler shOut,
const char *  elemNodeName,
rapidxml::xml_node<> *  subsetNode,
int  subsetIndex,
std::vector< TGeomObj * > &  vElems 
)
protected

◆ selector()

◆ subset_handler()

Member Data Documentation

◆ m_doc

rapidxml::xml_document ug::GridReaderUGX::m_doc
protected

the xml_document which stores the data

◆ m_entries

std::vector<GridEntry> ug::GridReaderUGX::m_entries
protected

holds grids which already have been created

Referenced by num_grids().


The documentation for this class was generated from the following files: