ug4
|
Grants write access to vtu files. More...
#include <file_io_vtu.h>
Public Member Functions | |
void | add_subset_handler (ISubsetHandler &sh, const std::string &name) |
You may add subset-handlers which will be written as regions to the vtk-file. More... | |
void | begin_cell_data () |
void | begin_point_data () |
void | end_cell_data () |
void | end_point_data () |
void | finish () |
GridWriterVTU () | |
GridWriterVTU (std::ostream *out) | |
Pass a pointer to an ostream to which the data shall be written. More... | |
template<class TPositionAttachment > | |
bool | new_piece (Grid &grid, ISubsetHandler *psh, TPositionAttachment &aPos) |
void | set_stream (std::ostream *out) |
Pass a pointer to an ostream to which the data shall be written. More... | |
virtual | ~GridWriterVTU () |
Protected Types | |
typedef Grid::EdgeAttachmentAccessor< AInt > | AAEdgeIndex |
typedef Grid::FaceAttachmentAccessor< AInt > | AAFaceIndex |
typedef Grid::VolumeAttachmentAccessor< AInt > | AAVolIndex |
typedef Grid::VertexAttachmentAccessor< AInt > | AAVrtIndex |
enum | Mode { NONE , OPEN , CLOSED } |
Protected Member Functions | |
template<class TElem > | |
void | collect_cells (std::vector< GridObject * > &cellsOut, Grid &grid, typename Grid::traits< TElem >::callback consider_elem=ConsiderAll()) |
void | end_piece () |
std::ostream & | out_stream () |
void | write_cells (std::vector< GridObject * > &cells, Grid &grid, AAVrtIndex aaInd) |
void | write_data_array_footer () |
void | write_data_array_header (const char *type, const char *name, int numberOfComponents) |
template<class TElem , class TAttachment > | |
void | write_vector_data (Grid &grid, TAttachment aData, const char *name="", typename Grid::traits< TElem >::callback consider_elem=ConsiderAll()) |
Protected Attributes | |
Mode | m_cellDataMode |
std::vector< GridObject * > | m_cells |
Grid * | m_curGrid |
ISubsetHandler * | m_curSH |
Mode | m_pieceMode |
std::vector< std::pair< ISubsetHandler *, std::string > > | m_pieceSubsetHandlers |
Mode | m_pointDataMode |
std::ostream * | m_pout |
Grants write access to vtu files.
Make sure that all elements added via one of the add_* methods exist until the FileAccessor is destroyed.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
ug::GridWriterVTU::GridWriterVTU | ( | ) |
ug::GridWriterVTU::GridWriterVTU | ( | std::ostream * | out | ) |
Pass a pointer to an ostream to which the data shall be written.
Make sure, that the stream is open and stays valid while write operations are performed.
References set_stream().
|
virtual |
void ug::GridWriterVTU::add_subset_handler | ( | ISubsetHandler & | sh, |
const std::string & | name | ||
) |
You may add subset-handlers which will be written as regions to the vtk-file.
Make sure to add subset-handlers before 'end_cell_data' is called. Note that if you pass a subset-handler to 'new_piece', then it will be automatically registered with the name "regions".
References CLOSED, m_cellDataMode, m_pieceSubsetHandlers, name, and UG_COND_THROW.
Referenced by new_piece().
void ug::GridWriterVTU::begin_cell_data | ( | ) |
References m_cellDataMode, m_pointDataMode, NONE, OPEN, out_stream(), and UG_COND_THROW.
Referenced by end_piece().
void ug::GridWriterVTU::begin_point_data | ( | ) |
References m_cellDataMode, m_pointDataMode, NONE, OPEN, out_stream(), and UG_COND_THROW.
Referenced by end_piece().
|
protected |
References ug::Grid::begin(), and ug::Grid::end().
void ug::GridWriterVTU::end_cell_data | ( | ) |
References CLOSED, ug::ISubsetHandler::get_subset_index(), m_cellDataMode, m_cells, m_pieceSubsetHandlers, name, ug::SubsetInfo::name, ug::ISubsetHandler::num_subsets(), OPEN, out_stream(), ug::ISubsetHandler::subset_info(), UG_COND_THROW, write_data_array_footer(), and write_data_array_header().
Referenced by end_piece().
|
protected |
References begin_cell_data(), begin_point_data(), CLOSED, end_cell_data(), end_point_data(), m_cellDataMode, m_cells, m_pieceMode, m_pieceSubsetHandlers, m_pointDataMode, NONE, OPEN, and out_stream().
Referenced by finish(), and new_piece().
void ug::GridWriterVTU::end_point_data | ( | ) |
References CLOSED, m_pointDataMode, OPEN, out_stream(), and UG_COND_THROW.
Referenced by end_piece().
void ug::GridWriterVTU::finish | ( | ) |
References end_piece(), m_cells, m_pieceMode, m_pieceSubsetHandlers, m_pout, NONE, OPEN, and out_stream().
Referenced by ug::SaveGridToVTU(), and set_stream().
bool ug::GridWriterVTU::new_piece | ( | Grid & | grid, |
ISubsetHandler * | psh, | ||
TPositionAttachment & | aPos | ||
) |
TPositionAttachments value type has to be compatible with MathVector. Make sure that aPos is attached to the vertices of the grid. If a SubsetHandler is specified through 'psh' (NULL is valid too), it will automatically be passed to 'add_subset_handler' with the name "regions". If you pass a subset handler to this method, furthermore only those elements which are assigned to subsets will be written to the file as cells. If you don't pass a subset-handler, only elements of highest dimension are written to the file.
References add_subset_handler(), ug::AssignIndices(), ug::Grid::attach_to_vertices(), ug::Grid::begin(), ug::Grid::detach_from_vertices(), ug::Grid::end(), end_piece(), m_cellDataMode, m_cells, m_curGrid, m_curSH, m_pieceMode, m_pieceSubsetHandlers, m_pointDataMode, NONE, ug::Grid::num(), OPEN, out_stream(), and write_cells().
Referenced by ug::SaveGridToVTU().
|
inlineprotected |
References m_pout, and UG_COND_THROW.
Referenced by begin_cell_data(), begin_point_data(), end_cell_data(), end_piece(), end_point_data(), finish(), new_piece(), write_cells(), write_data_array_footer(), write_data_array_header(), and write_vector_data().
void ug::GridWriterVTU::set_stream | ( | std::ostream * | out | ) |
Pass a pointer to an ostream to which the data shall be written.
Make sure, that the stream is open and stays valid while write operations are performed.
References finish(), m_pout, and UG_COND_THROW.
Referenced by GridWriterVTU(), and ug::SaveGridToVTU().
|
protected |
|
protected |
References out_stream().
Referenced by end_cell_data(), write_cells(), and write_vector_data().
|
protected |
name | Set to "" to omit this parameter in the output. |
numberOfComponents | Set to 0 to omit this parameter in the output. |
References name, and out_stream().
Referenced by end_cell_data(), write_cells(), and write_vector_data().
|
protected |
References ug::Grid::begin(), ug::Grid::end(), out_stream(), write_data_array_footer(), and write_data_array_header().
|
protected |
Referenced by add_subset_handler(), begin_cell_data(), begin_point_data(), end_cell_data(), end_piece(), and new_piece().
|
protected |
Referenced by end_cell_data(), end_piece(), finish(), and new_piece().
|
protected |
Referenced by new_piece().
|
protected |
Referenced by new_piece().
|
protected |
Referenced by end_piece(), finish(), and new_piece().
|
protected |
Referenced by add_subset_handler(), end_cell_data(), end_piece(), finish(), and new_piece().
|
protected |
Referenced by begin_cell_data(), begin_point_data(), end_piece(), end_point_data(), and new_piece().
|
protected |
Referenced by finish(), out_stream(), and set_stream().