From: Timo Heister Date: Thu, 14 Jul 2022 02:08:42 +0000 (-0400) Subject: enum class X-Git-Tag: v9.5.0-rc1~1072^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2c394f27bce2fe22c7b02455b5796d726186ff2;p=dealii.git enum class --- diff --git a/examples/step-23/step-23.cc b/examples/step-23/step-23.cc index 444a94784a..0a77d03890 100644 --- a/examples/step-23/step-23.cc +++ b/examples/step-23/step-23.cc @@ -412,7 +412,7 @@ namespace Step23 // 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::best_speed; + vtk_flags.compression_level = DataOutBase::CompressionLevel::best_speed; data_out.set_flags(vtk_flags); std::ofstream output(filename); data_out.write_vtu(output); diff --git a/examples/step-24/step-24.cc b/examples/step-24/step-24.cc index ee7d7477a3..694169dc9d 100644 --- a/examples/step-24/step-24.cc +++ b/examples/step-24/step-24.cc @@ -431,7 +431,7 @@ namespace Step24 const std::string filename = "solution-" + Utilities::int_to_string(timestep_number, 3) + ".vtu"; DataOutBase::VtkFlags vtk_flags; - vtk_flags.compression_level = DataOutBase::best_speed; + vtk_flags.compression_level = DataOutBase::CompressionLevel::best_speed; std::ofstream output(filename); data_out.write_vtu(output); } diff --git a/examples/step-25/step-25.cc b/examples/step-25/step-25.cc index 5c0c3fa073..f5c2f5227f 100644 --- a/examples/step-25/step-25.cc +++ b/examples/step-25/step-25.cc @@ -559,7 +559,7 @@ namespace Step25 const std::string filename = "solution-" + Utilities::int_to_string(timestep_number, 3) + ".vtu"; DataOutBase::VtkFlags vtk_flags; - vtk_flags.compression_level = DataOutBase::best_speed; + vtk_flags.compression_level = DataOutBase::CompressionLevel::best_speed; data_out.set_flags(vtk_flags); std::ofstream output(filename); data_out.write_vtu(output); diff --git a/examples/step-9/step-9.cc b/examples/step-9/step-9.cc index 26d2db469e..83b26254a3 100644 --- a/examples/step-9/step-9.cc +++ b/examples/step-9/step-9.cc @@ -844,7 +844,7 @@ namespace Step9 // 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::best_speed; + vtk_flags.compression_level = DataOutBase::CompressionLevel::best_speed; data_out.set_flags(vtk_flags); std::ofstream output("solution-" + std::to_string(cycle) + ".vtu"); diff --git a/include/deal.II/base/data_out_base.h b/include/deal.II/base/data_out_base.h index 75f316d514..3027abb5e2 100644 --- a/include/deal.II/base/data_out_base.h +++ b/include/deal.II/base/data_out_base.h @@ -224,7 +224,7 @@ namespace DataOutBase * An enum for different levels of compression used in several places * to determine zlib compression levels. */ - enum CompressionLevel + enum class CompressionLevel { /** * Do not use any compression. @@ -1158,13 +1158,13 @@ namespace DataOutBase DataOutBase::CompressionLevel; DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel - no_compression = dealii::DataOutBase::no_compression; + no_compression = DataOutBase::CompressionLevel::no_compression; DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel - best_compression = dealii::DataOutBase::best_compression; + best_compression = DataOutBase::CompressionLevel::best_compression; DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel best_speed = - dealii::DataOutBase::best_speed; + DataOutBase::CompressionLevel::best_speed; DEAL_II_DEPRECATED static const DataOutBase::CompressionLevel - default_compression = dealii::DataOutBase::default_compression; + default_compression = DataOutBase::CompressionLevel::default_compression; /** * Flag determining the compression level at which zlib, if available, is @@ -1218,12 +1218,13 @@ namespace DataOutBase * Constructor. Initializes the member variables with names corresponding * to the argument names of this function. */ - VtkFlags( + explicit VtkFlags( const double time = std::numeric_limits::min(), const unsigned int cycle = std::numeric_limits::min(), - const bool print_date_and_time = true, - const CompressionLevel compression_level = best_compression, - const bool write_higher_order_cells = false, + const bool print_date_and_time = true, + const CompressionLevel compression_level = + CompressionLevel::best_compression, + const bool write_higher_order_cells = false, const std::map &physical_units = {}); }; diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 701f7d7d89..5cbe869566 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -98,13 +98,13 @@ namespace { switch (level) { - case (DataOutBase::no_compression): + case (DataOutBase::CompressionLevel::no_compression): return Z_NO_COMPRESSION; - case (DataOutBase::best_speed): + case (DataOutBase::CompressionLevel::best_speed): return Z_BEST_SPEED; - case (DataOutBase::best_compression): + case (DataOutBase::CompressionLevel::best_compression): return Z_BEST_COMPRESSION; - case (DataOutBase::default_compression): + case (DataOutBase::CompressionLevel::default_compression): return Z_DEFAULT_COMPRESSION; default: Assert(false, ExcNotImplemented()); @@ -122,13 +122,13 @@ namespace { switch (level) { - case (DataOutBase::no_compression): + case (DataOutBase::CompressionLevel::no_compression): return boost::iostreams::zlib::no_compression; - case (DataOutBase::best_speed): + case (DataOutBase::CompressionLevel::best_speed): return boost::iostreams::zlib::best_speed; - case (DataOutBase::best_compression): + case (DataOutBase::CompressionLevel::best_compression): return boost::iostreams::zlib::best_compression; - case (DataOutBase::default_compression): + case (DataOutBase::CompressionLevel::default_compression): return boost::iostreams::zlib::default_compression; default: Assert(false, ExcNotImplemented()); @@ -7641,7 +7641,7 @@ namespace DataOutBase { boost::iostreams::filtering_ostream f; - if (compression != no_compression) + if (compression != CompressionLevel::no_compression) # ifdef DEAL_II_WITH_ZLIB f.push(boost::iostreams::zlib_compressor( get_boost_zlib_compression_level(compression))); @@ -7668,7 +7668,7 @@ namespace DataOutBase const ParallelIntermediateHeader header{ 0x00dea111, Deal_II_IntermediateFlags::format_version, - compression, + static_cast(compression), dim, spacedim, n_ranks, @@ -9336,7 +9336,7 @@ DataOutReader::read_whole_parallel_file(std::istream &in) boost::iostreams::filtering_istreambuf f; if (static_cast(header.compression) != - DataOutBase::no_compression) + DataOutBase::CompressionLevel::no_compression) #ifdef DEAL_II_WITH_ZLIB f.push(boost::iostreams::zlib_decompressor()); #else diff --git a/tests/simplex/step-23.cc b/tests/simplex/step-23.cc index 5ad1b47298..3b0d01e3a3 100644 --- a/tests/simplex/step-23.cc +++ b/tests/simplex/step-23.cc @@ -312,7 +312,7 @@ namespace Step23 const std::string filename = "solution-" + Utilities::int_to_string(timestep_number, 3) + ".vtu"; DataOutBase::VtkFlags vtk_flags; - vtk_flags.compression_level = DataOutBase::best_speed; + vtk_flags.compression_level = DataOutBase::CompressionLevel::best_speed; data_out.set_flags(vtk_flags); std::ofstream output(filename); data_out.write_vtu(output);