]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Increase precision of time written in xdmf output 14303/head
authorSebastian Proell <sebastian.proell@tum.de>
Thu, 22 Sep 2022 14:38:31 +0000 (16:38 +0200)
committerSebastian Proell <sebastian.proell@tum.de>
Thu, 22 Sep 2022 14:40:10 +0000 (16:40 +0200)
source/base/data_out_base.cc
tests/data_out/data_out_hdf5_01.cc
tests/data_out/data_out_hdf5_01.with_hdf5=true.with_mpi=false.output

index 99fc2c4e932eb1961961231372377df6e2c18fde..aceb6710ff94c80d8a1ec8ff0b537459eb4b41ce 100644 (file)
@@ -9783,6 +9783,7 @@ XDMFEntry::get_xdmf_content(const unsigned int indent_level) const
     return "";
 
   std::stringstream ss;
+  ss.precision(12);
   ss << indent(indent_level + 0)
      << "<Grid Name=\"mesh\" GridType=\"Uniform\">\n";
   ss << indent(indent_level + 1) << "<Time Value=\"" << entry_time << "\"/>\n";
index 9e3f5d190950b4a934e0226478ea9ebdc774ae89..14c5cfc53ac5b4f5b824253a7c8cfb6e8e2b321e 100644 (file)
@@ -56,8 +56,10 @@ test()
   data_out.write_filtered_data(data_filter);
   data_out.write_hdf5_parallel(data_filter, "out.h5", MPI_COMM_SELF);
   std::vector<XDMFEntry> xdmf_entries;
-  xdmf_entries.push_back(
-    data_out.create_xdmf_entry(data_filter, "out.h5", 0, MPI_COMM_SELF));
+
+  // Use a point in time that requires high precision output
+  xdmf_entries.push_back(data_out.create_xdmf_entry(
+    data_filter, "out.h5", 1 + 1e-10, MPI_COMM_SELF));
 
   data_out.write_xdmf_file(xdmf_entries, "out.xdmf", MPI_COMM_SELF);
 
index 911d9ff9414240ad1f5f1d8e91a08dc0d5bc665f..350a0ec1ded9e53632270c41a8202a0ef879f7cd 100644 (file)
@@ -6,7 +6,7 @@ DEAL::ok
   <Domain>
     <Grid Name="CellTime" GridType="Collection" CollectionType="Temporal">
       <Grid Name="mesh" GridType="Uniform">
-        <Time Value="0"/>
+        <Time Value="1.0000000001"/>
         <Geometry GeometryType="XY">
           <DataItem Dimensions="36 2" NumberType="Float" Precision="8" Format="HDF">
             out.h5:/nodes

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.