Commit 8a4544c8 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Use full names and scope for enums

parent b2666958
......@@ -25,7 +25,7 @@ class Vtk[Type]Writer
{
public:
// Constructor
Vtk[Type]Writer(GridView, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32);
Vtk[Type]Writer(GridView, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32);
// Bind data to the writer
Vtk[Type]Writer& addPointData(Function [, std::string name, int numComponents, Vtk::FormatTypes]);
......@@ -37,7 +37,7 @@ public:
```
where `Function` is either a `GridViewFunction`, i.e. supports `bind()`, `unbind()`, and `localFunction(Function)`, or is a legacy `VTKFunction` from Dune-Grid. The optional parameters `name`, `numComponents` and `format` may be given for a `GridViewFunction`.
The parameter `Vtk::FormatTypes` is one of `Vtk::ASCII`, `Vtk::BINARY`, or `Vtk::COMPRESSED` and `Vtk::DataTypes` is one of `Vtk::FLOAT32`, or `Vtk::FLOAT64`. The `[Type]` of a VtkWriter is one of `UnstructuredGrid`, `StructuredGrid`, `RectilinearGrid`, `ImageData`, or `Timeseries`, see below for details. A `DataCollector` may be specified to control how point and cell values are extracted from the `GridView` and the bound data. See `dune/vtk/datacollectors/` of a list of poissible types. The default datacollector extracts a connected grid with continuous data, where points are grid vertices.
The parameter `Vtk::FormatTypes` is one of `Vtk::FormatTypes::ASCII`, `Vtk::FormatTypes::BINARY`, or `Vtk::COMPRESSED` and `Vtk::DataTypes` is one of `Vtk::DataTypes::FLOAT32`, or `Vtk::DataTypes::FLOAT64`. The `[Type]` of a VtkWriter is one of `UnstructuredGrid`, `StructuredGrid`, `RectilinearGrid`, `ImageData`, or `Timeseries`, see below for details. A `DataCollector` may be specified to control how point and cell values are extracted from the `GridView` and the bound data. See `dune/vtk/datacollectors/` of a list of poissible types. The default datacollector extracts a connected grid with continuous data, where points are grid vertices.
See also the `src/` directory for more examples.
......@@ -110,7 +110,7 @@ format. Supports all VtkWriters for the timestep output. In each timestep a coll
### VtkTimseriesWriter
A timeseries is a collection of timesteps stored in one file, instead of separate
files for each timestep value. Since in the `Vtk::APPENDED` mode, the data is written
files for each timestep value. Since in the `Vtk::FormatTypes::APPENDED` mode, the data is written
as binary blocks in the appended section of the file and references by an offset
in the XML DataArray attributes, it allows to reuse written data. An example of
usage is when the grid points and cells do not change over time, but just the
......
......@@ -51,14 +51,14 @@ namespace Dune
/// Constructor VtkFunction from legacy VTKFunction
/**
* \param fct The VTKFunction to wrap
* \param type The VTK datatype how to write the function values to the output [Vtk::FLOAT64]
* \param type The VTK datatype how to write the function values to the output [Vtk::DataTypes::FLOAT64]
**/
Function (std::shared_ptr<VTKFunction<GridView> const> const& fct,
std::optional<Vtk::DataTypes> type = {})
: localFct_(fct)
, name_(fct->name())
, ncomps_(fct->ncomps())
, type_(type ? *type : Vtk::FLOAT32)
, type_(type ? *type : Vtk::DataTypes::FLOAT32)
{}
/// Construct VtkFunction from dune-functions GridFunction with Signature
......@@ -124,7 +124,7 @@ namespace Dune
Vtk::LocalFunction<GridView> localFct_;
std::string name_;
int ncomps_ = 1;
Vtk::DataTypes type_ = Vtk::FLOAT32;
Vtk::DataTypes type_ = Vtk::DataTypes::FLOAT32;
};
} // end namespace Vtk
......
......@@ -39,7 +39,7 @@ void PvdWriter<W>
assert(out.is_open());
out.imbue(std::locale::classic());
out << std::setprecision(datatype_ == Vtk::FLOAT32
out << std::setprecision(datatype_ == Vtk::DataTypes::FLOAT32
? std::numeric_limits<float>::max_digits10
: std::numeric_limits<double>::max_digits10);
......@@ -66,7 +66,7 @@ std::string PvdWriter<W>
assert(out.is_open());
out.imbue(std::locale::classic());
out << std::setprecision(datatype_ == Vtk::FLOAT32
out << std::setprecision(datatype_ == Vtk::DataTypes::FLOAT32
? std::numeric_limits<float>::max_digits10
: std::numeric_limits<double>::max_digits10);
......@@ -85,7 +85,7 @@ void PvdWriter<W>
out << "<VTKFile"
<< " type=\"Collection\""
<< " version=\"0.1\""
<< (format_ != Vtk::ASCII ? " byte_order=\"" + vtkWriter_.getEndian() + "\"" : "")
<< (format_ != Vtk::FormatTypes::ASCII ? " byte_order=\"" + vtkWriter_.getEndian() + "\"" : "")
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\"" : "")
<< ">\n";
......
......@@ -57,14 +57,14 @@ int testGridView (std::string prefix, Dune::VTKChecker& vtkChecker, GridView con
// ASCII files
{
vtk.setFormat(Dune::Vtk::ASCII);
vtk.setFormat(Dune::Vtk::FormatTypes::ASCII);
std::string name = vtk.write(prefix + "_ascii");
if (gridView.comm().rank() == 0) vtkChecker.push(name);
}
// BINARY files
{
vtk.setFormat(Dune::Vtk::BINARY);
vtk.setFormat(Dune::Vtk::FormatTypes::BINARY);
std::string name = vtk.write(prefix + "_binary");
if (gridView.comm().rank() == 0) vtkChecker.push(name);
}
......
......@@ -42,11 +42,11 @@ template <class Grid, class Creator, class Field>
void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& input, bool fillCreator)
{
clear();
compressor_ = Vtk::NONE;
Vtk::DataTypes header_type = Vtk::UINT32;
compressor_ = Vtk::CompressorTypes::NONE;
Vtk::DataTypes header_type = Vtk::DataTypes::UINT32;
std::string data_id = "";
std::string data_format = "";
Vtk::DataTypes data_type = Vtk::UNKNOWN;
Vtk::DataTypes data_type = Vtk::DataTypes::UNKNOWN;
unsigned int data_components = 0;
std::uint64_t data_offset = 0;
......@@ -64,16 +64,16 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
VTK_ASSERT_MSG(attr["byte_order"] == "LittleEndian", "LittleEndian byte order supported");
if (attr["header_type"] == "UInt32")
header_type = Vtk::UINT32;
header_type = Vtk::DataTypes::UINT32;
else if (attr["header_type"] == "UInt64")
header_type = Vtk::UINT64;
header_type = Vtk::DataTypes::UINT64;
if (attr["compressor"] == "vtkZLibDataCompressor")
compressor_ = Vtk::ZLIB;
compressor_ = Vtk::CompressorTypes::ZLIB;
else if (attr["compressor"] == "vtkLZ4DataCompressor")
compressor_ = Vtk::LZ4;
compressor_ = Vtk::CompressorTypes::LZ4;
else if (attr["compressor"] == "vtkLZMADataCompressor")
compressor_ = Vtk::LZMA;
compressor_ = Vtk::CompressorTypes::LZMA;
section = VTK_FILE;
}
......@@ -133,9 +133,9 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
// determine FormatType
data_format = Vtk::to_lower(attr["format"]);
if (data_format == "appended") {
format_ = compressor_ != Vtk::NONE ? Vtk::COMPRESSED : Vtk::BINARY;
format_ = compressor_ != Vtk::CompressorTypes::NONE ? Vtk::FormatTypes::COMPRESSED : Vtk::FormatTypes::BINARY;
} else {
format_ = Vtk::ASCII;
format_ = Vtk::FormatTypes::ASCII;
}
// Offset makes sense in appended mode only
......@@ -249,8 +249,8 @@ void VtkReader<Grid,Creator,Field>::readParallelFileFromStream (std::ifstream& i
{
clear();
[[maybe_unused]] Vtk::DataTypes header_type = Vtk::UINT32;
compressor_ = Vtk::NONE;
[[maybe_unused]] Vtk::DataTypes header_type = Vtk::DataTypes::UINT32;
compressor_ = Vtk::CompressorTypes::NONE;
Sections section = NO_SECTION;
for (std::string line; std::getline(input, line); ) {
......@@ -268,16 +268,16 @@ void VtkReader<Grid,Creator,Field>::readParallelFileFromStream (std::ifstream& i
VTK_ASSERT_MSG(attr["byte_order"] == "LittleEndian", "LittleEndian byte order supported");
if (attr["header_type"] == "UInt32")
header_type = Vtk::UINT32;
header_type = Vtk::DataTypes::UINT32;
else if (attr["header_type"] == "UInt64")
header_type = Vtk::UINT64;
header_type = Vtk::DataTypes::UINT64;
if (attr["compressor"] == "vtkZLibDataCompressor")
compressor_ = Vtk::ZLIB;
compressor_ = Vtk::CompressorTypes::ZLIB;
else if (attr["compressor"] == "vtkLZ4DataCompressor")
compressor_ = Vtk::LZ4;
compressor_ = Vtk::CompressorTypes::LZ4;
else if (attr["compressor"] == "vtkLZMADataCompressor")
compressor_ = Vtk::LZMA;
compressor_ = Vtk::CompressorTypes::LZMA;
section = VTK_FILE;
}
......@@ -511,7 +511,7 @@ void VtkReader<Grid,Creator,Field>::readCellsAppended (MetaType<HeaderType>, std
auto offsets_data = dataArray_["Cells.offsets"];
auto connectivity_data = dataArray_["Cells.connectivity"];
VTK_ASSERT(types_data.type == Vtk::UINT8);
VTK_ASSERT(types_data.type == Vtk::DataTypes::UINT8);
readAppended(input, vec_types, HeaderType(types_data.offset));
VTK_ASSERT(vec_types.size() == numberOfCells_);
......@@ -539,7 +539,7 @@ void VtkReader<Grid,Creator,Field>::readCellsAppended (MetaType<HeaderType>, std
if (dataArray_.count("Cells.global_point_ids") > 0) {
auto point_id_data = dataArray_["Cells.global_point_ids"];
VTK_ASSERT(point_id_data.type == Vtk::UINT64);
VTK_ASSERT(point_id_data.type == Vtk::DataTypes::UINT64);
readAppended(input, vec_point_ids, HeaderType(point_id_data.offset));
VTK_ASSERT(vec_point_ids.size() == numberOfPoints_);
}
......@@ -625,7 +625,7 @@ void VtkReader<Grid,Creator,Field>::readAppended (std::ifstream& input, std::vec
std::vector<HeaderType> cbs; // compressed block sizes
// read total size / block-size(s)
if (compressor_ != Vtk::NONE) {
if (compressor_ != Vtk::CompressorTypes::NONE) {
input.read((char*)&num_blocks, sizeof(HeaderType));
input.read((char*)&block_size, sizeof(HeaderType));
input.read((char*)&last_block_size, sizeof(HeaderType));
......@@ -644,7 +644,7 @@ void VtkReader<Grid,Creator,Field>::readAppended (std::ifstream& input, std::vec
VTK_ASSERT(size > 0 && (size % sizeof(FloatType)) == 0);
values.resize(size / sizeof(FloatType));
if (compressor_ != Vtk::NONE) {
if (compressor_ != Vtk::CompressorTypes::NONE) {
// upper bound for compressed block-size
HeaderType compressed_block_size = block_size + (block_size + 999)/1000 + 12;
// number of values in the full blocks
......@@ -655,13 +655,13 @@ void VtkReader<Grid,Creator,Field>::readAppended (std::ifstream& input, std::vec
HeaderType bs = i < std::size_t(num_blocks-1) ? block_size : last_block_size;
switch (compressor_) {
case Vtk::ZLIB:
case Vtk::CompressorTypes::ZLIB:
read_compressed_zlib(values.data() + i*num_values, buffer_in.data(), bs, cbs[i], input);
break;
case Vtk::LZ4:
case Vtk::CompressorTypes::LZ4:
read_compressed_lz4(values.data() + i*num_values, buffer_in.data(), bs, cbs[i], input);
break;
case Vtk::LZMA:
case Vtk::CompressorTypes::LZMA:
read_compressed_lzma(values.data() + i*num_values, buffer_in.data(), bs, cbs[i], input);
break;
default:
......
......@@ -42,7 +42,7 @@ namespace Dune
VtkTimeseriesWriter (Args&&... args)
: vtkWriter_{std::forward<Args>(args)...}
{
assert(vtkWriter_.format_ != Vtk::ASCII && "Timeseries writer requires APPENDED mode");
assert(vtkWriter_.format_ != Vtk::FormatTypes::ASCII && "Timeseries writer requires APPENDED mode");
std::srand(std::time(nullptr));
// put temporary file to /tmp directory
......
......@@ -104,7 +104,7 @@ std::string VtkTimeseriesWriter<W>
assert(serial_out.is_open());
serial_out.imbue(std::locale::classic());
serial_out << std::setprecision(vtkWriter_.getDatatype() == Vtk::FLOAT32
serial_out << std::setprecision(vtkWriter_.getDatatype() == Vtk::DataTypes::FLOAT32
? std::numeric_limits<float>::digits10+2
: std::numeric_limits<double>::digits10+2);
......@@ -118,7 +118,7 @@ std::string VtkTimeseriesWriter<W>
assert(parallel_out.is_open());
parallel_out.imbue(std::locale::classic());
parallel_out << std::setprecision(vtkWriter_.getDatatype() == Vtk::FLOAT32
parallel_out << std::setprecision(vtkWriter_.getDatatype() == Vtk::DataTypes::FLOAT32
? std::numeric_limits<float>::digits10+2
: std::numeric_limits<double>::digits10+2);
......
......@@ -47,7 +47,7 @@ namespace Dune
// deduction guide
template <class GridView,
class = std::void_t<typename GridView::IndexSet>>
VtkWriter (GridView const&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkWriter (GridView const&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkWriter<GridView>;
......
......@@ -49,9 +49,9 @@ namespace Dune
* the passed gridView.
*
* \param gridView Implementation of Dune::GridView
* \param format Format of the VTK file, either Vtk::BINARY, Vtk::ASCII, or Vtk::COMPRESSED
* \param datatype Data type of a single component of the point coordinates [Vtk::FLOAT32]
* \param headertype Integer type used in binary data headers [Vtk::UINT32]
* \param format Format of the VTK file, either Vtk::FormatTypes::BINARY, Vtk::FormatTypes::ASCII, or Vtk::COMPRESSED
* \param datatype Data type of a single component of the point coordinates [Vtk::DataTypes::FLOAT32]
* \param headertype Integer type used in binary data headers [Vtk::DataTypes::UINT32]
**/
VtkWriterInterface (GridView const& gridView,
Vtk::FormatTypes format = Vtk::FormatTypes::BINARY,
......
......@@ -52,7 +52,7 @@ std::string VtkWriterInterface<GV,DC>
assert(serial_out.is_open());
serial_out.imbue(std::locale::classic());
serial_out << std::setprecision(datatype_ == Vtk::FLOAT32
serial_out << std::setprecision(datatype_ == Vtk::DataTypes::FLOAT32
? std::numeric_limits<float>::max_digits10
: std::numeric_limits<double>::max_digits10);
......@@ -66,7 +66,7 @@ std::string VtkWriterInterface<GV,DC>
assert(parallel_out.is_open());
parallel_out.imbue(std::locale::classic());
parallel_out << std::setprecision(datatype_ == Vtk::FLOAT32
parallel_out << std::setprecision(datatype_ == Vtk::DataTypes::FLOAT32
? std::numeric_limits<float>::max_digits10
: std::numeric_limits<double>::max_digits10);
......@@ -84,11 +84,11 @@ void VtkWriterInterface<GV,DC>
std::optional<std::size_t> timestep) const
{
out << "<DataArray Name=\"" << fct.name() << "\" type=\"" << to_string(fct.type()) << "\""
<< " NumberOfComponents=\"" << fct.ncomps() << "\" format=\"" << (format_ == Vtk::ASCII ? "ascii\"" : "appended\"");
<< " NumberOfComponents=\"" << fct.ncomps() << "\" format=\"" << (format_ == Vtk::FormatTypes::ASCII ? "ascii\"" : "appended\"");
if (timestep)
out << " TimeStep=\"" << *timestep << "\"";
if (format_ == Vtk::ASCII) {
if (format_ == Vtk::FormatTypes::ASCII) {
out << ">\n";
if (type == POINT_DATA)
writeValuesAscii(out, dataCollector_->template pointData<double>(fct));
......@@ -110,11 +110,11 @@ void VtkWriterInterface<GV,DC>
std::optional<std::size_t> timestep) const
{
out << "<DataArray type=\"" << to_string(datatype_) << "\""
<< " NumberOfComponents=\"3\" format=\"" << (format_ == Vtk::ASCII ? "ascii\"" : "appended\"");
<< " NumberOfComponents=\"3\" format=\"" << (format_ == Vtk::FormatTypes::ASCII ? "ascii\"" : "appended\"");
if (timestep)
out << " TimeStep=\"" << *timestep << "\"";
if (format_ == Vtk::ASCII) {
if (format_ == Vtk::FormatTypes::ASCII) {
out << ">\n";
writeValuesAscii(out, dataCollector_->template points<double>());
out << "</DataArray>\n";
......@@ -191,7 +191,7 @@ template <class GV, class DC>
void VtkWriterInterface<GV,DC>
::writeValuesAscii (std::ofstream& out, std::vector<T> const& values) const
{
assert(is_a(format_, Vtk::ASCII) && "Function should by called only in ascii mode!\n");
assert(is_a(format_, Vtk::FormatTypes::ASCII) && "Function should by called only in ascii mode!\n");
std::size_t i = 0;
for (auto const& v : values)
out << Impl::printable(v) << (++i % 6 != 0 ? ' ' : '\n');
......@@ -207,9 +207,9 @@ void VtkWriterInterface<GV,DC>
<< " type=\"" << type << "\""
<< " version=\"1.0\""
<< " header_type=\"" << to_string(headertype_) << "\"";
if (format_ != Vtk::ASCII)
if (format_ != Vtk::FormatTypes::ASCII)
out << " byte_order=\"" << getEndian() << "\"";
if (compressor_ != Vtk::NONE)
if (compressor_ != Vtk::CompressorTypes::NONE)
out << " compressor=\"" << to_string(compressor_) << "\"";
out << ">\n";
}
......@@ -285,7 +285,7 @@ template <class GV, class DC>
std::uint64_t VtkWriterInterface<GV,DC>
::writeValuesAppended (std::ofstream& out, std::vector<FloatType> const& values) const
{
assert(is_a(format_, Vtk::APPENDED) && "Function should by called only in appended mode!\n");
assert(is_a(format_, Vtk::FormatTypes::APPENDED) && "Function should by called only in appended mode!\n");
pos_type begin_pos = out.tellp();
HeaderType size = values.size() * sizeof(FloatType);
......@@ -296,7 +296,7 @@ std::uint64_t VtkWriterInterface<GV,DC>
// write block-size(s)
HeaderType zero = 0;
if (compressor_ != Vtk::NONE) {
if (compressor_ != Vtk::CompressorTypes::NONE) {
out.write((char*)&num_blocks, sizeof(HeaderType));
out.write((char*)&block_size, sizeof(HeaderType));
out.write((char*)&last_block_size, sizeof(HeaderType));
......@@ -309,7 +309,7 @@ std::uint64_t VtkWriterInterface<GV,DC>
HeaderType compressed_block_size = block_size + (block_size + 999)/1000 + 12;
std::vector<unsigned char> buffer(block_size);
std::vector<unsigned char> buffer_out;
if (compressor_ != Vtk::NONE)
if (compressor_ != Vtk::CompressorTypes::NONE)
buffer_out.resize(std::size_t(compressed_block_size));
std::size_t num_values = block_size / sizeof(FloatType);
......@@ -319,18 +319,18 @@ std::uint64_t VtkWriterInterface<GV,DC>
HeaderType bs = Impl::writeValuesToBuffer<FloatType>(num_values, buffer.data(), values, i*num_values);
switch (compressor_) {
case Vtk::NONE:
case Vtk::CompressorTypes::NONE:
out.write((char*)buffer.data(), bs);
break;
case Vtk::ZLIB:
case Vtk::CompressorTypes::ZLIB:
cbs[i] = Impl::compressBuffer_zlib(buffer.data(), buffer_out.data(), bs, compressed_block_size, compression_level);
out.write((char*)buffer_out.data(), cbs[i]);
break;
case Vtk::LZ4:
case Vtk::CompressorTypes::LZ4:
cbs[i] = Impl::compressBuffer_zlib(buffer.data(), buffer_out.data(), bs, compressed_block_size, compression_level);
out.write((char*)buffer_out.data(), cbs[i]);
break;
case Vtk::LZMA:
case Vtk::CompressorTypes::LZMA:
cbs[i] = Impl::compressBuffer_zlib(buffer.data(), buffer_out.data(), bs, compressed_block_size, compression_level);
out.write((char*)buffer_out.data(), cbs[i]);
break;
......@@ -338,7 +338,7 @@ std::uint64_t VtkWriterInterface<GV,DC>
}
pos_type end_pos = out.tellp();
if (compressor_ != Vtk::NONE) {
if (compressor_ != Vtk::CompressorTypes::NONE) {
out.seekp(begin_pos + std::streamoff(3*sizeof(HeaderType)));
out.write((char*)cbs.data(), std::streamsize(num_blocks*sizeof(HeaderType)));
out.seekp(end_pos);
......
......@@ -61,17 +61,17 @@ namespace Dune
// deduction guides
template <class GridView,
class = std::void_t<typename GridView::IndexSet>>
VtkImageDataWriter(GridView const&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkImageDataWriter(GridView const&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkImageDataWriter<GridView, Vtk::StructuredDataCollector<GridView>>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkImageDataWriter(DataCollector&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkImageDataWriter(DataCollector&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkImageDataWriter<typename DataCollector::GridView, DataCollector>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkImageDataWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkImageDataWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkImageDataWriter<typename DataCollector::GridView, DataCollector>;
} // end namespace Dune
......
......@@ -67,17 +67,17 @@ namespace Dune
// deduction guides
template <class GridView,
class = std::void_t<typename GridView::IndexSet>>
VtkRectilinearGridWriter(GridView const&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkRectilinearGridWriter(GridView const&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkRectilinearGridWriter<GridView, Vtk::StructuredDataCollector<GridView>>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkRectilinearGridWriter(DataCollector&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkRectilinearGridWriter(DataCollector&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkRectilinearGridWriter<typename DataCollector::GridView, DataCollector>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkRectilinearGridWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkRectilinearGridWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkRectilinearGridWriter<typename DataCollector::GridView, DataCollector>;
} // end namespace Dune
......
......@@ -119,7 +119,7 @@ void VtkRectilinearGridWriter<GV,DC>
std::optional<std::size_t> timestep) const
{
std::string names = "xyz";
if (format_ == Vtk::ASCII) {
if (format_ == Vtk::FormatTypes::ASCII) {
auto coordinates = dataCollector_->template coordinates<double>();
for (std::size_t d = 0; d < 3; ++d) {
out << "<DataArray type=\"" << to_string(datatype_) << "\" Name=\"" << names[d] << "\" format=\"ascii\"";
......@@ -130,7 +130,7 @@ void VtkRectilinearGridWriter<GV,DC>
out << "</DataArray>\n";
}
}
else { // Vtk::APPENDED format
else { // Vtk::FormatTypes::APPENDED format
for (std::size_t j = 0; j < 3; ++j) {
out << "<DataArray type=\"" << to_string(datatype_) << "\" Name=\"" << names[j] << "\" format=\"appended\"";
if (timestep)
......@@ -148,7 +148,7 @@ template <class GV, class DC>
void VtkRectilinearGridWriter<GV,DC>
::writeGridAppended (std::ofstream& out, std::vector<std::uint64_t>& blocks) const
{
assert(is_a(format_, Vtk::APPENDED) && "Function should by called only in appended mode!\n");
assert(is_a(format_, Vtk::FormatTypes::APPENDED) && "Function should by called only in appended mode!\n");
// write coordinates along axis
Vtk::mapDataTypes<std::is_floating_point, std::is_integral>(datatype_, headertype_,
......
......@@ -61,17 +61,17 @@ namespace Dune
// deduction guides
template <class GridView,
class = std::void_t<typename GridView::IndexSet>>
VtkStructuredGridWriter(GridView const&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkStructuredGridWriter(GridView const&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkStructuredGridWriter<GridView, Vtk::StructuredDataCollector<GridView>>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkStructuredGridWriter(DataCollector&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkStructuredGridWriter(DataCollector&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkStructuredGridWriter<typename DataCollector::GridView, DataCollector>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkStructuredGridWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkStructuredGridWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkStructuredGridWriter<typename DataCollector::GridView, DataCollector>;
} // end namespace Dune
......
......@@ -116,7 +116,7 @@ template <class GV, class DC>
void VtkStructuredGridWriter<GV,DC>
::writeGridAppended (std::ofstream& out, std::vector<std::uint64_t>& blocks) const
{
assert(is_a(format_, Vtk::APPENDED) && "Function should by called only in appended mode!\n");
assert(is_a(format_, Vtk::FormatTypes::APPENDED) && "Function should by called only in appended mode!\n");
// write points
Vtk::mapDataTypes<std::is_floating_point, std::is_integral>(datatype_, headertype_,
......
......@@ -93,17 +93,17 @@ namespace Dune
// deduction guides
template <class GridView,
class = std::void_t<typename GridView::IndexSet>>
VtkUnstructuredGridWriter(GridView const&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkUnstructuredGridWriter(GridView const&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkUnstructuredGridWriter<GridView, Vtk::ContinuousDataCollector<GridView>>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkUnstructuredGridWriter(DataCollector&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkUnstructuredGridWriter(DataCollector&, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkUnstructuredGridWriter<typename DataCollector::GridView, DataCollector>;
template <class DataCollector,
class = std::void_t<typename DataCollector::GridView>>
VtkUnstructuredGridWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32)
VtkUnstructuredGridWriter(std::shared_ptr<DataCollector>, Vtk::FormatTypes = Vtk::FormatTypes::BINARY, Vtk::DataTypes = Vtk::DataTypes::FLOAT32)
-> VtkUnstructuredGridWriter<typename DataCollector::GridView, DataCollector>;
} // end namespace Dune
......
......@@ -115,7 +115,7 @@ void VtkUnstructuredGridWriter<GV,DC>
std::vector<std::pair<double, std::string>> const& timesteps,
std::vector<std::uint64_t> const& blocks) const
{
assert(is_a(format_, Vtk::APPENDED));
assert(is_a(format_, Vtk::FormatTypes::APPENDED));
std::vector<std::vector<pos_type>> offsets(timesteps.size()); // pos => offset
this->writeHeader(out, "UnstructuredGrid");
......@@ -283,7 +283,7 @@ void VtkUnstructuredGridWriter<GV,DC>
::writeCells (std::ofstream& out, std::vector<pos_type>& offsets,
std::optional<std::size_t> timestep) const
{
if (format_ == Vtk::ASCII) {
if (format_ == Vtk::FormatTypes::ASCII) {
auto cells = dataCollector_->cells();
out << "<DataArray type=\"Int64\" Name=\"connectivity\" format=\"ascii\"";
if (timestep)
......@@ -306,7 +306,7 @@ void VtkUnstructuredGridWriter<GV,DC>
this->writeValuesAscii(out, cells.types);
out << "</DataArray>\n";
}
else { // Vtk::APPENDED format
else { // Vtk::FormatTypes::APPENDED format
out << "<DataArray type=\"Int64\" Name=\"connectivity\" format=\"appended\"";
if (timestep)
out << " TimeStep=\"" << *timestep << "\"";
......@@ -344,7 +344,7 @@ void VtkUnstructuredGridWriter<GV,DC>
if (ids.empty())
return;
if (format_ == Vtk::ASCII) {
if (format_ == Vtk::FormatTypes::ASCII) {
out << "<DataArray type=\"UInt64\" Name=\"global_point_ids\" format=\"ascii\"";
if (timestep)
out << " TimeStep=\"" << *timestep << "\"";
......@@ -352,7 +352,7 @@ void VtkUnstructuredGridWriter<GV,DC>
this->writeValuesAscii(out, ids);
out << "</DataArray>\n";
}
else { // Vtk::APPENDED format
else { // Vtk::FormatTypes::APPENDED format
out << "<DataArray type=\"UInt64\" Name=\"global_point_ids\" format=\"appended\"";
if (timestep)
out << " TimeStep=\"" << *timestep << "\"";
......@@ -368,7 +368,7 @@ template <class GV, class DC>
void VtkUnstructuredGridWriter<GV,DC>
::writeGridAppended (std::ofstream& out, std::vector<std::uint64_t>& blocks) const
{
assert(is_a(format_, Vtk::APPENDED) && "Function should by called only in appended mode!\n");
assert(is_a(format_, Vtk::FormatTypes::APPENDED) && "Function should by called only in appended mode!\n");
Vtk::mapDataTypes<std::is_floating_point, std::is_integral>(datatype_, headertype_,
[&](auto f, auto h) {
......