]> https://gitweb.dealii.org/ - dealii.git/commitdiff
enum class
authorTimo Heister <timo.heister@gmail.com>
Thu, 14 Jul 2022 02:08:42 +0000 (22:08 -0400)
committerTimo Heister <timo.heister@gmail.com>
Thu, 14 Jul 2022 17:06:28 +0000 (13:06 -0400)
examples/step-23/step-23.cc
examples/step-24/step-24.cc
examples/step-25/step-25.cc
examples/step-9/step-9.cc
include/deal.II/base/data_out_base.h
source/base/data_out_base.cc
tests/simplex/step-23.cc

index 444a94784a7a580eb4ed957e06278e1cdc60536a..0a77d03890801b3da2f787428565914143091c91 100644 (file)
@@ -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);
index ee7d7477a34d64f7ee53bf0a825935d09346dc4c..694169dc9daecbaf874960ebf1c795fea480f9c1 100644 (file)
@@ -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);
   }
index 5c0c3fa073d7590043d55d76ad077ca229a9159b..f5c2f5227fcb83bc0795cf1a6e55284a750fca69 100644 (file)
@@ -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);
index 26d2db469e202570ad01bc58624d0a5f24c06b22..83b26254a37781fb9dac1cc686bdae8bf34d1e49 100644 (file)
@@ -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");
index 75f316d514f7f0cc5d6623f37504d45a14832cbb..3027abb5e2f961692f67febc4b6ee07f0e08b0d7 100644 (file)
@@ -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<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 bool             print_date_and_time = true,
+      const CompressionLevel compression_level =
+        CompressionLevel::best_compression,
+      const bool write_higher_order_cells                      = false,
       const std::map<std::string, std::string> &physical_units = {});
   };
 
index 701f7d7d890c7927e15e10f108151fc169165aae..5cbe8695660574e5715432acf2f70829fef5a3f0 100644 (file)
@@ -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<std::uint64_t>(compression),
       dim,
       spacedim,
       n_ranks,
@@ -9336,7 +9336,7 @@ DataOutReader<dim, spacedim>::read_whole_parallel_file(std::istream &in)
 
       boost::iostreams::filtering_istreambuf f;
       if (static_cast<DataOutBase::CompressionLevel>(header.compression) !=
-          DataOutBase::no_compression)
+          DataOutBase::CompressionLevel::no_compression)
 #ifdef DEAL_II_WITH_ZLIB
         f.push(boost::iostreams::zlib_decompressor());
 #else
index 5ad1b472982cea828c8069ec023b2c7f8a62529c..3b0d01e3a3d5df4fd63848c8c5829fb6aaceb9dd 100644 (file)
@@ -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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.