33 #ifndef __H__LIB_GRID__FILE_IO_VTU__
34 #define __H__LIB_GRID__FILE_IO_VTU__
39 #include "common/parser/rapidxml/rapidxml.hpp"
58 template <
class TAPosition>
71 const char* filename);
75 template <
class TAPosition>
112 template <
class TPositionAttachment>
114 TPositionAttachment& aPos);
140 int numberOfComponents);
144 template <
class TElem,
class TAttachment>
147 const char*
name =
"",
151 template <
class TElem>
205 template <
class TPositionAttachment>
206 bool grid(
Grid& gridOut,
size_t index, TPositionAttachment& aPos);
216 size_t subsetHandlerIndex)
const;
221 size_t subsetHandlerIndex);
263 template <
class TAAPos>
265 rapidxml::xml_node<>* vrtNode, TAAPos aaPos);
269 rapidxml::xml_node<>* node,
271 size_t pieceVrtOffset);
275 rapidxml::xml_node<>* dataNode,
276 bool clearData =
true);
278 void trafoDblVec2Int( std::vector<double>
const & dblVec, std::vector<int> & intVec );
281 void check_indices(std::vector<T>& inds,
size_t first,
size_t num,
size_t max);
284 rapidxml::xml_node<>* parent,
285 const char* nodeName,
287 const char* argValue);
location name
Definition: checkpoint_util.lua:128
A generic specialization of IAttachment.
Definition: attachment_pipe.h:263
callback that always returns true
Definition: basic_callbacks.h:50
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
Grants read access to vtu (vtk) files.
Definition: file_io_vtu.h:191
size_t num_grids() const
returns the number of grids in the given file
Definition: file_io_vtu.h:200
static std::string const getRegionOfInterestIdentifyer()
Definition: file_io_vtu.h:223
bool parse_file(const char *filename)
parses an xml file
Definition: file_io_vtu.cpp:451
std::vector< GridEntry > m_entries
holds grids which already have been created
Definition: file_io_vtu.h:296
virtual ~GridReaderVTU()
Definition: file_io_vtu.cpp:412
GridReaderVTU()
Definition: file_io_vtu.cpp:408
bool subset_handler(ISubsetHandler &shOut, size_t refGridIndex, size_t subsetHandlerIndex)
fills the given subset-handler
Definition: file_io_vtu.cpp:592
std::string m_filename
stores the file-name
Definition: file_io_vtu.h:290
rapidxml::xml_document m_doc
the xml_document which stores the data
Definition: file_io_vtu.h:293
const char * get_subset_handler_name(size_t refGridIndex, size_t subsetHandlerIndex) const
returns the name of the given subset handler
Definition: file_io_vtu.cpp:579
bool create_vertices(std::vector< Vertex * > &vrtsOut, Grid &grid, rapidxml::xml_node<> *vrtNode, TAAPos aaPos)
creates vertices from a vertex-node.
Definition: file_io_vtu_impl.h:267
void read_scalar_data(std::vector< T > &dataOut, rapidxml::xml_node<> *dataNode, bool clearData=true)
Definition: file_io_vtu_impl.h:357
virtual bool new_document_parsed()
initializes internal arrays
Definition: file_io_vtu.cpp:525
rapidxml::xml_node * find_child_node_by_argument_value(rapidxml::xml_node<> *parent, const char *nodeName, const char *argName, const char *argValue)
Definition: file_io_vtu.cpp:875
bool grid(Grid &gridOut, size_t index, TPositionAttachment &aPos)
returns the i-th grid.
Definition: file_io_vtu_impl.h:212
static std::string m_regionOfInterest
Definition: file_io_vtu.h:300
size_t num_subset_handlers(size_t refGridIndex) const
returns the number of subset handlers for the given grid
Definition: file_io_vtu.cpp:567
const char * get_grid_name(size_t index) const
returns the name of the i-th grid
Definition: file_io_vtu.cpp:558
void trafoDblVec2Int(std::vector< double > const &dblVec, std::vector< int > &intVec)
Definition: file_io_vtu.cpp:863
bool create_cells(std::vector< GridObject * > &cellsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > vertices, size_t pieceVrtOffset)
Definition: file_io_vtu.cpp:716
static void setRegionOfInterestIdentifier(std::string const ®OfInt)
Definition: file_io_vtu.h:226
void check_indices(std::vector< T > &inds, size_t first, size_t num, size_t max)
Definition: file_io_vtu_impl.h:385
Grants write access to vtu files.
Definition: file_io_vtu.h:87
Mode m_pointDataMode
Definition: file_io_vtu.h:171
void write_data_array_footer()
Definition: file_io_vtu.cpp:195
void end_cell_data()
Definition: file_io_vtu.cpp:244
void begin_cell_data()
Definition: file_io_vtu.cpp:228
Mode m_pieceMode
Definition: file_io_vtu.h:170
Grid::VertexAttachmentAccessor< AInt > AAVrtIndex
Definition: file_io_vtu.h:130
Grid::EdgeAttachmentAccessor< AInt > AAEdgeIndex
Definition: file_io_vtu.h:131
std::ostream * m_pout
Definition: file_io_vtu.h:169
Grid::FaceAttachmentAccessor< AInt > AAFaceIndex
Definition: file_io_vtu.h:132
std::vector< std::pair< ISubsetHandler *, std::string > > m_pieceSubsetHandlers
Definition: file_io_vtu.h:178
Grid::VolumeAttachmentAccessor< AInt > AAVolIndex
Definition: file_io_vtu.h:133
void set_stream(std::ostream *out)
Pass a pointer to an ostream to which the data shall be written.
Definition: file_io_vtu.cpp:153
virtual ~GridWriterVTU()
Definition: file_io_vtu.cpp:147
void write_data_array_header(const char *type, const char *name, int numberOfComponents)
Definition: file_io_vtu.cpp:181
Mode
Definition: file_io_vtu.h:163
@ NONE
Definition: file_io_vtu.h:164
@ OPEN
Definition: file_io_vtu.h:165
@ CLOSED
Definition: file_io_vtu.h:166
Mode m_cellDataMode
Definition: file_io_vtu.h:172
bool new_piece(Grid &grid, ISubsetHandler *psh, TPositionAttachment &aPos)
Definition: file_io_vtu_impl.h:97
void write_vector_data(Grid &grid, TAttachment aData, const char *name="", typename Grid::traits< TElem >::callback consider_elem=ConsiderAll())
Definition: file_io_vtu_impl.h:165
Grid * m_curGrid
Definition: file_io_vtu.h:174
void finish()
Definition: file_io_vtu.cpp:380
void begin_point_data()
Definition: file_io_vtu.cpp:201
std::vector< GridObject * > m_cells
Definition: file_io_vtu.h:177
std::ostream & out_stream()
Definition: file_io_vtu_impl.h:89
void end_piece()
Definition: file_io_vtu.cpp:358
void write_cells(std::vector< GridObject * > &cells, Grid &grid, AAVrtIndex aaInd)
Definition: file_io_vtu.cpp:286
GridWriterVTU()
Definition: file_io_vtu.cpp:125
ISubsetHandler * m_curSH
Definition: file_io_vtu.h:175
void end_point_data()
Definition: file_io_vtu.cpp:216
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.
Definition: file_io_vtu.cpp:172
void collect_cells(std::vector< GridObject * > &cellsOut, Grid &grid, typename Grid::traits< TElem >::callback consider_elem=ConsiderAll())
Definition: file_io_vtu_impl.h:193
Definition: subset_handler_interface.h:223
Definition: multi_grid.h:72
std::pair< counting_iterator< size_t >, counting_iterator< size_t > > vertices(ug::BidirectionalMatrix< T > const &M)
Definition: bidirectional_boost.h:60
bool SaveGridToVTU(Grid &grid, ISubsetHandler *psh, const char *filename, TAPosition &aPos)
Writes a grid to a vtu (vtk unstructured mesh) file.
Definition: file_io_vtu_impl.h:67
bool LoadGridFromVTU(Grid &grid, ISubsetHandler &sh, const char *filename)
Reads a grid to a vtu (vtk unstructured mesh) file.
Definition: file_io_vtu.cpp:103
boost::function< bool(base_object *)> callback
callback type for the elements base type.
Definition: grid.h:150
Definition: file_io_vtu.h:239
GridEntry(rapidxml::xml_node<> *n)
Definition: file_io_vtu.h:240
std::vector< GridObject * > cells
Definition: file_io_vtu.h:247
Grid * grid
Definition: file_io_vtu.h:243
MultiGrid * mg
Definition: file_io_vtu.h:244
std::vector< Vertex * > vertices
Definition: file_io_vtu.h:246
rapidxml::xml_node * node
Definition: file_io_vtu.h:242
std::vector< SubsetHandlerEntry > subsetHandlerEntries
Definition: file_io_vtu.h:245
Definition: file_io_vtu.h:231
SubsetHandlerEntry(rapidxml::xml_node<> *n)
Definition: file_io_vtu.h:232
ISubsetHandler * sh
Definition: file_io_vtu.h:235
rapidxml::xml_node * node
Definition: file_io_vtu.h:234