[cig-commits] [commit] master: Minor fixes to last patch (6f20954)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri May 9 16:07:17 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/819c050c264b9f09a3e22aeda1b82df6cb5f1236...555391b308f972e57b2488cb024ed6bda549ebf0

>---------------------------------------------------------------

commit 6f20954ab0c7f53f653e0c4d59cd5d2dfbca53a6
Author: Eric Heien <github at heien.org>
Date:   Fri May 9 15:17:14 2014 -0700

    Minor fixes to last patch


>---------------------------------------------------------------

6f20954ab0c7f53f653e0c4d59cd5d2dfbca53a6
 doc/modules/changes.h               |  5 ++++-
 source/postprocess/visualization.cc | 16 ++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/doc/modules/changes.h b/doc/modules/changes.h
index 284c71d..7c1e61a 100644
--- a/doc/modules/changes.h
+++ b/doc/modules/changes.h
@@ -5,7 +5,10 @@
  * 1.0. All entries are signed with the names of the author. </p>
  *
  * <ol>
- *
+ * <li>Fixed: Times associated with visualization output are now correctly
+ * modified when "Use years in output instead of seconds" is true.
+ * <br>
+ * (Eric Heien, 2014/05/09)
  *
  * </ol>
  *
diff --git a/source/postprocess/visualization.cc b/source/postprocess/visualization.cc
index 2995cff..50f9e36 100644
--- a/source/postprocess/visualization.cc
+++ b/source/postprocess/visualization.cc
@@ -242,9 +242,9 @@ namespace aspect
 
       std::string solution_file_prefix = "solution-" + Utilities::int_to_string (output_file_number, 5);
       std::string mesh_file_prefix = "mesh-" + Utilities::int_to_string (output_file_number, 5);
-      double current_time = (this->convert_output_to_years() ?
-                             this->get_time() / year_in_seconds :
-                             this->get_time());
+      const double time_in_years_or_seconds = (this->convert_output_to_years() ?
+                                               this->get_time() / year_in_seconds :
+                                               this->get_time());
       if (output_format=="hdf5")
         {
           XDMFEntry new_xdmf_entry;
@@ -267,13 +267,13 @@ namespace aspect
           new_xdmf_entry = data_out.create_xdmf_entry(data_filter,
                                                       last_mesh_file_name.c_str(),
                                                       h5_solution_file_name.c_str(),
-                                                      current_time,
+                                                      time_in_years_or_seconds,
                                                       this->get_mpi_communicator());
 #else
           data_out.write_hdf5_parallel((this->get_output_directory()+h5_solution_file_name).c_str(),
                                        this->get_mpi_communicator());
           new_xdmf_entry = data_out.create_xdmf_entry(h5_solution_file_name.c_str(),
-                                                      current_time,
+                                                      time_in_years_or_seconds,
                                                       this->get_mpi_communicator());
 #endif
           xdmf_entries.push_back(new_xdmf_entry);
@@ -301,7 +301,7 @@ namespace aspect
 
               // now also generate a .pvd file that matches simulation
               // time and corresponding .pvtu record
-              times_and_pvtu_names.push_back(std::make_pair(current_time,
+              times_and_pvtu_names.push_back(std::make_pair(time_in_years_or_seconds,
                                                             pvtu_master_filename));
               const std::string
               pvd_master_filename = (this->get_output_directory() + "solution.pvd");
@@ -338,7 +338,7 @@ namespace aspect
             DataOutBase::VtkFlags vtk_flags;
 #if (DEAL_II_MAJOR*100 + DEAL_II_MINOR) >= 704
             vtk_flags.cycle = this->get_timestep_number();
-            vtk_flags.time = current_time;
+            vtk_flags.time = time_in_years_or_seconds;
 #endif
             data_out.set_flags (vtk_flags);
 
@@ -367,7 +367,7 @@ namespace aspect
               // now also generate a .pvd file that matches simulation
               // time and corresponding .pvtu record
               times_and_pvtu_names.push_back(std::pair<double,std::string>
-                                             (current_time, pvtu_master_filename));
+                                             (time_in_years_or_seconds, pvtu_master_filename));
               const std::string
               pvd_master_filename = (this->get_output_directory() + "solution.pvd");
               std::ofstream pvd_master (pvd_master_filename.c_str());



More information about the CIG-COMMITS mailing list