ug4
ug::GridWriterVTU Class Reference

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< AIntAAEdgeIndex
 
typedef Grid::FaceAttachmentAccessor< AIntAAFaceIndex
 
typedef Grid::VolumeAttachmentAccessor< AIntAAVolIndex
 
typedef Grid::VertexAttachmentAccessor< AIntAAVrtIndex
 
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
 
Gridm_curGrid
 
ISubsetHandlerm_curSH
 
Mode m_pieceMode
 
std::vector< std::pair< ISubsetHandler *, std::string > > m_pieceSubsetHandlers
 
Mode m_pointDataMode
 
std::ostream * m_pout
 

Detailed Description

Grants write access to vtu files.

Make sure that all elements added via one of the add_* methods exist until the FileAccessor is destroyed.

Member Typedef Documentation

◆ AAEdgeIndex

◆ AAFaceIndex

◆ AAVolIndex

◆ AAVrtIndex

Member Enumeration Documentation

◆ Mode

enum ug::GridWriterVTU::Mode
protected
Enumerator
NONE 
OPEN 
CLOSED 

Constructor & Destructor Documentation

◆ GridWriterVTU() [1/2]

ug::GridWriterVTU::GridWriterVTU ( )

◆ GridWriterVTU() [2/2]

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().

◆ ~GridWriterVTU()

ug::GridWriterVTU::~GridWriterVTU ( )
virtual

Member Function Documentation

◆ add_subset_handler()

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().

◆ begin_cell_data()

void ug::GridWriterVTU::begin_cell_data ( )

◆ begin_point_data()

void ug::GridWriterVTU::begin_point_data ( )

◆ collect_cells()

template<class TElem >
void ug::GridWriterVTU::collect_cells ( std::vector< GridObject * > &  cellsOut,
Grid grid,
typename Grid::traits< TElem >::callback  consider_elem = ConsiderAll() 
)
protected

◆ end_cell_data()

◆ end_piece()

◆ end_point_data()

void ug::GridWriterVTU::end_point_data ( )

References CLOSED, m_pointDataMode, OPEN, out_stream(), and UG_COND_THROW.

Referenced by end_piece().

◆ finish()

void ug::GridWriterVTU::finish ( )

◆ new_piece()

template<class TPositionAttachment >
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().

◆ out_stream()

◆ set_stream()

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().

◆ write_cells()

◆ write_data_array_footer()

void ug::GridWriterVTU::write_data_array_footer ( )
protected

◆ write_data_array_header()

void ug::GridWriterVTU::write_data_array_header ( const char *  type,
const char *  name,
int  numberOfComponents 
)
protected
Parameters
nameSet to "" to omit this parameter in the output.
numberOfComponentsSet 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().

◆ write_vector_data()

template<class TElem , class TAttachment >
void ug::GridWriterVTU::write_vector_data ( Grid grid,
TAttachment  aData,
const char *  name = "",
typename Grid::traits< TElem >::callback  consider_elem = ConsiderAll() 
)
protected

Member Data Documentation

◆ m_cellDataMode

Mode ug::GridWriterVTU::m_cellDataMode
protected

◆ m_cells

std::vector<GridObject*> ug::GridWriterVTU::m_cells
protected

◆ m_curGrid

Grid* ug::GridWriterVTU::m_curGrid
protected

Referenced by new_piece().

◆ m_curSH

ISubsetHandler* ug::GridWriterVTU::m_curSH
protected

Referenced by new_piece().

◆ m_pieceMode

Mode ug::GridWriterVTU::m_pieceMode
protected

Referenced by end_piece(), finish(), and new_piece().

◆ m_pieceSubsetHandlers

std::vector<std::pair<ISubsetHandler*, std::string> > ug::GridWriterVTU::m_pieceSubsetHandlers
protected

◆ m_pointDataMode

Mode ug::GridWriterVTU::m_pointDataMode
protected

◆ m_pout

std::ostream* ug::GridWriterVTU::m_pout
protected

Referenced by finish(), out_stream(), and set_stream().


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