// zlib compression algorithm that is optimized for speed instead of disk
// usage since otherwise plotting the output becomes a bottleneck:
DataOutBase::VtkFlags vtk_flags;
- vtk_flags.compression_level =
- DataOutBase::VtkFlags::ZlibCompressionLevel::best_speed;
+ vtk_flags.compression_level = DataOutBase::best_speed;
data_out.set_flags(vtk_flags);
std::ofstream output(filename);
data_out.write_vtu(output);
const std::string filename =
"solution-" + Utilities::int_to_string(timestep_number, 3) + ".vtu";
DataOutBase::VtkFlags vtk_flags;
- vtk_flags.compression_level =
- DataOutBase::VtkFlags::ZlibCompressionLevel::best_speed;
+ vtk_flags.compression_level = DataOutBase::best_speed;
std::ofstream output(filename);
data_out.write_vtu(output);
}
const std::string filename =
"solution-" + Utilities::int_to_string(timestep_number, 3) + ".vtu";
DataOutBase::VtkFlags vtk_flags;
- vtk_flags.compression_level =
- DataOutBase::VtkFlags::ZlibCompressionLevel::best_speed;
+ vtk_flags.compression_level = DataOutBase::best_speed;
data_out.set_flags(vtk_flags);
std::ofstream output(filename);
data_out.write_vtu(output);
// disk. Here we ask ZLib, a compression library, to compress the data
// in a way that maximizes throughput.
DataOutBase::VtkFlags vtk_flags;
- vtk_flags.compression_level =
- DataOutBase::VtkFlags::ZlibCompressionLevel::best_speed;
+ vtk_flags.compression_level = DataOutBase::best_speed;
data_out.set_flags(vtk_flags);
std::ofstream output("solution-" + std::to_string(cycle) + ".vtu");
*/
namespace DataOutBase
{
+ /**
+ * An enum for different levels of compression used in several places
+ * to determine zlib compression levels.
+ */
+ enum CompressionLevel
+ {
+ /**
+ * Do not use any compression.
+ */
+ no_compression,
+ /**
+ * Use the fastest available compression algorithm.
+ */
+ best_speed,
+ /**
+ * Use the algorithm which results in the smallest compressed
+ * files. This is the default flag.
+ */
+ best_compression,
+ /**
+ * Use the default compression algorithm. This is a compromise between
+ * speed and file size.
+ */
+ default_compression
+ };
+
+
/**
* Data structure describing a patch of data in <tt>dim</tt> space
* dimensions.
/**
* A data type providing the different possible zlib compression
* levels. These map directly to constants defined by zlib.
+ *
+ * @deprecated Use DataOutBase::CompressionLevel instead.
*/
- enum ZlibCompressionLevel
- {
- /**
- * Do not use any compression.
- */
- no_compression,
- /**
- * Use the fastest available compression algorithm.
- */
- best_speed,
- /**
- * Use the algorithm which results in the smallest compressed
- * files. This is the default flag.
- */
- best_compression,
- /**
- * Use the default compression algorithm. This is a compromise between
- * speed and file size.
- */
- default_compression
- };
+ using ZlibCompressionLevel DEAL_II_DEPRECATED =
+ DataOutBase::CompressionLevel;
+
+ DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel
+ no_compression = dealii::DataOutBase::no_compression;
+ DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel
+ best_compression = dealii::DataOutBase::best_compression;
+ DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel best_speed =
+ dealii::DataOutBase::best_speed;
+ DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel
+ default_compression = dealii::DataOutBase::default_compression;
/**
* Flag determining the compression level at which zlib, if available, is
* run. The default is <tt>best_compression</tt>.
*/
- ZlibCompressionLevel compression_level;
+ DataOutBase::CompressionLevel compression_level;
/**
* Flag determining whether to write patches as linear cells
* to the argument names of this function.
*/
VtkFlags(
- const double time = std::numeric_limits<double>::min(),
- const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
- const bool print_date_and_time = true,
- const ZlibCompressionLevel compression_level = best_compression,
- const bool write_higher_order_cells = false,
+ const double time = std::numeric_limits<double>::min(),
+ const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
+ const bool print_date_and_time = true,
+ const CompressionLevel compression_level = best_compression,
+ const bool write_higher_order_cells = false,
const std::map<std::string, std::string> &physical_units = {});
};
unsigned int,
std::string,
DataComponentInterpretation::DataComponentInterpretation>>
- & nonscalar_data_ranges,
- const Deal_II_IntermediateFlags & flags,
- const std::string & filename,
- const MPI_Comm & comm,
- const VtkFlags::ZlibCompressionLevel compression);
+ & nonscalar_data_ranges,
+ const Deal_II_IntermediateFlags &flags,
+ const std::string & filename,
+ const MPI_Comm & comm,
+ const CompressionLevel compression);
/**
* Write the data in @p data_filter to a single HDF5 file containing both the
*/
void
write_deal_II_intermediate_in_parallel(
- const std::string & filename,
- const MPI_Comm & comm,
- const DataOutBase::VtkFlags::ZlibCompressionLevel compression) const;
+ const std::string & filename,
+ const MPI_Comm & comm,
+ const DataOutBase::CompressionLevel compression) const;
/**
* Create an XDMFEntry based on the data in the data_filter. This assumes
* constant defined by zlib.
*/
int
- get_zlib_compression_level(
- const DataOutBase::VtkFlags::ZlibCompressionLevel level)
+ get_zlib_compression_level(const DataOutBase::CompressionLevel level)
{
switch (level)
{
- case (DataOutBase::VtkFlags::no_compression):
+ case (DataOutBase::no_compression):
return Z_NO_COMPRESSION;
- case (DataOutBase::VtkFlags::best_speed):
+ case (DataOutBase::best_speed):
return Z_BEST_SPEED;
- case (DataOutBase::VtkFlags::best_compression):
+ case (DataOutBase::best_compression):
return Z_BEST_COMPRESSION;
- case (DataOutBase::VtkFlags::default_compression):
+ case (DataOutBase::default_compression):
return Z_DEFAULT_COMPRESSION;
default:
Assert(false, ExcNotImplemented());
}
}
+# ifdef DEAL_II_WITH_MPI
/**
* Convert between the enum specified inside VtkFlags and the preprocessor
* constant defined by boost::iostreams::zlib.
*/
int
- get_boost_zlib_compression_level(
- const DataOutBase::VtkFlags::ZlibCompressionLevel level)
+ get_boost_zlib_compression_level(const DataOutBase::CompressionLevel level)
{
switch (level)
{
- case (DataOutBase::VtkFlags::no_compression):
+ case (DataOutBase::no_compression):
return boost::iostreams::zlib::no_compression;
- case (DataOutBase::VtkFlags::best_speed):
+ case (DataOutBase::best_speed):
return boost::iostreams::zlib::best_speed;
- case (DataOutBase::VtkFlags::best_compression):
+ case (DataOutBase::best_compression):
return boost::iostreams::zlib::best_compression;
- case (DataOutBase::VtkFlags::default_compression):
+ case (DataOutBase::default_compression):
return boost::iostreams::zlib::default_compression;
default:
Assert(false, ExcNotImplemented());
return boost::iostreams::zlib::no_compression;
}
}
+# endif
/**
* Do a zlib compression followed by a base64 encoding of the given data. The
- VtkFlags::VtkFlags(const double time,
- const unsigned int cycle,
- const bool print_date_and_time,
- const VtkFlags::ZlibCompressionLevel compression_level,
- const bool write_higher_order_cells,
+ VtkFlags::VtkFlags(const double time,
+ const unsigned int cycle,
+ const bool print_date_and_time,
+ const CompressionLevel compression_level,
+ const bool write_higher_order_cells,
const std::map<std::string, std::string> &physical_units)
: time(time)
, cycle(cycle)
unsigned int,
std::string,
DataComponentInterpretation::DataComponentInterpretation>>
- & nonscalar_data_ranges,
- const Deal_II_IntermediateFlags & flags,
- const std::string & filename,
- const MPI_Comm & comm,
- const VtkFlags::ZlibCompressionLevel compression)
+ & nonscalar_data_ranges,
+ const Deal_II_IntermediateFlags &flags,
+ const std::string & filename,
+ const MPI_Comm & comm,
+ const CompressionLevel compression)
{
#ifndef DEAL_II_WITH_MPI
(void)patches;
{
boost::iostreams::filtering_ostream f;
- if (compression != VtkFlags::no_compression)
+ if (compression != no_compression)
# ifdef DEAL_II_WITH_ZLIB
f.push(boost::iostreams::zlib_compressor(
get_boost_zlib_compression_level(compression)));
template <int dim, int spacedim>
void
DataOutInterface<dim, spacedim>::write_deal_II_intermediate_in_parallel(
- const std::string & filename,
- const MPI_Comm & comm,
- const DataOutBase::VtkFlags::ZlibCompressionLevel compression) const
+ const std::string & filename,
+ const MPI_Comm & comm,
+ const DataOutBase::CompressionLevel compression) const
{
DataOutBase::write_deal_II_intermediate_in_parallel(
get_patches(),
in.read(temp_buffer.data(), chunk_sizes[n]);
boost::iostreams::filtering_istreambuf f;
- if (static_cast<DataOutBase::VtkFlags::ZlibCompressionLevel>(
- header.compression) != DataOutBase::VtkFlags::no_compression)
+ if (static_cast<DataOutBase::CompressionLevel>(header.compression) !=
+ DataOutBase::no_compression)
#ifdef DEAL_II_WITH_ZLIB
f.push(boost::iostreams::zlib_decompressor());
#else
unsigned int,
std::string,
DataComponentInterpretation::DataComponentInterpretation>>
- & nonscalar_data_ranges,
- const Deal_II_IntermediateFlags & flags,
- const std::string & filename,
- const MPI_Comm & comm,
- const VtkFlags::ZlibCompressionLevel compression);
+ & nonscalar_data_ranges,
+ const Deal_II_IntermediateFlags &flags,
+ const std::string & filename,
+ const MPI_Comm & comm,
+ const CompressionLevel compression);
template void
write_hdf5_parallel(
const std::string filename =
"solution-" + Utilities::int_to_string(timestep_number, 3) + ".vtu";
DataOutBase::VtkFlags vtk_flags;
- vtk_flags.compression_level =
- DataOutBase::VtkFlags::ZlibCompressionLevel::best_speed;
+ vtk_flags.compression_level = DataOutBase::best_speed;
data_out.set_flags(vtk_flags);
std::ofstream output(filename);
data_out.write_vtu(output);