|
dune-grid
2.2.0
|
Dump a .vtu/.vtp files contents to a stream. More...
#include <dune/grid/io/file/vtk/pvtuwriter.hh>
Public Member Functions | |
| PVTUWriter (std::ostream &stream_, FileType fileType_) | |
| create a PVTUWriter object | |
| ~PVTUWriter () | |
| write footer | |
| void | beginPointData (const std::string &scalars="", const std::string &vectors="") |
| start PointData section | |
| void | endPointData () |
| finish PointData section | |
| void | beginCellData (const std::string &scalars="", const std::string &vectors="") |
| start CellData section | |
| void | endCellData () |
| finish CellData section | |
| void | beginPoints () |
| start section for the point coordinates | |
| void | endPoints () |
| finish section for the point coordinates | |
| void | beginMain (unsigned ghostLevel=0) |
| start the main PPolyData/PUnstructuredGrid section | |
| void | endMain () |
| finish the main PolyData/UnstructuredGrid section | |
| template<typename T > | |
| void | addArray (const std::string &name, unsigned ncomps) |
| Add an array to the output file. | |
| void | addPiece (const std::string &filename) |
| Add a serial piece to the output file. | |
Dump a .vtu/.vtp files contents to a stream.
This will help generating a .vtu/.vtp file. Typical use is like this:
{
// create writer, writes begin tag
PVTUWriter writer(std::cout, polyData);
// start the main section
writer.beginMain();
// dump cell data (optional)
writer.beginCellData();
for(each cell data field)
writer.addArray<T>(field.name, field.ncomps);
writer.endCellData();
// dump point data (optional)
writer.beginPointData();
for(each point data field)
writer.addArray<T>(field.name, field.ncomps);
writer.endPointData();
// dump point coordinates
writer.beginPoints();
writer.addArray("Coordinates", 3);
writer.endPoints();
for(each serial piece)
writer.addPiece(piece.filename);
// finish main section
writer.endMain();
// end scope so the destructor gets called and the closing tag is written
}
| Dune::VTK::PVTUWriter::PVTUWriter | ( | std::ostream & | stream_, |
| FileType | fileType_ | ||
| ) | [inline] |
create a PVTUWriter object
| stream_ | Stream to write to. |
| fileType_ | Whether to write PolyData (1D) or UnstructuredGrid (nD) format. |
Create object and write header.
References Dune::VTK::getEndiannessString(), Dune::VTK::polyData, and Dune::VTK::unstructuredGrid.
| Dune::VTK::PVTUWriter::~PVTUWriter | ( | ) | [inline] |
write footer
| void Dune::VTK::PVTUWriter::addArray | ( | const std::string & | name, |
| unsigned | ncomps | ||
| ) | [inline] |
Add an array to the output file.
| T | The datatype of the array. |
| name | Name of the array. |
| ncomps | Number of components in each vector of the array. |
Referenced by Dune::VTK::SkeletonFunctionWriter< Func >::addArray(), Dune::VTK::VTKFunctionWriter< Func >::addArray(), Dune::VTK::CoordinatesWriter< Cell >::addArray(), Dune::VTK::ConformingConnectivityWriter< IteratorFactory >::addArray(), Dune::VTK::NonConformingConnectivityWriter< Cell >::addArray(), Dune::VTK::OffsetsWriter< Cell >::addArray(), and Dune::VTK::TypesWriter< Cell >::addArray().
| void Dune::VTK::PVTUWriter::addPiece | ( | const std::string & | filename | ) | [inline] |
Add a serial piece to the output file.
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::beginCellData | ( | const std::string & | scalars = "", |
| const std::string & | vectors = "" |
||
| ) | [inline] |
start CellData section
| scalars | Name of field to which should be marked as default scalars field. If this is the empty string, don't set any default. |
| vectors | Name of field to which should be marked as default vectors field. If this is the empty string, don't set any default. |
If there are no CellData fields, the call to this function may be skipped, together with the corresponding call to endCellData().
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::beginMain | ( | unsigned | ghostLevel = 0 | ) | [inline] |
start the main PPolyData/PUnstructuredGrid section
| ghostLevel | Set the GhostLevel attribute |
Inbetween the call to this method and to endMain(), there should be calls to add the actual data:
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::beginPointData | ( | const std::string & | scalars = "", |
| const std::string & | vectors = "" |
||
| ) | [inline] |
start PointData section
| scalars | Name of field to which should be marked as default scalars field. If this is the empty string, don't set any default. |
| vectors | Name of field to which should be marked as default vectors field. If this is the empty string, don't set any default. |
If there are no PointData fields, the call to this function may be skipped, together with the corresponding call to endPointData().
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::beginPoints | ( | ) | [inline] |
start section for the point coordinates
Between the call to this method an the following call to the endPoints(), there must be a single field written. The name must be "Coordinates" and it must have 3 components.
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::endCellData | ( | ) | [inline] |
finish CellData section
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::endMain | ( | ) | [inline] |
finish the main PolyData/UnstructuredGrid section
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::endPointData | ( | ) | [inline] |
finish PointData section
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
| void Dune::VTK::PVTUWriter::endPoints | ( | ) | [inline] |
finish section for the point coordinates
Referenced by Dune::VTK::BasicWriter< NonConformingBoundaryIteratorFactory< GV > >::writeCollection().
1.7.6.1