[cig-commits] [commit] master: Fix visualization output time (bd9eefe)

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


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

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

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

commit bd9eefe99e81778da498bc7686b4c1c727086bea
Author: Eric Heien <github at heien.org>
Date:   Fri May 9 14:20:11 2014 -0700

    Fix visualization output time
    
    The visualization output still uses seconds rather than years even if
    the “Use years in output instead of seconds” parameter is true, this
    patch should fix it


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

bd9eefe99e81778da498bc7686b4c1c727086bea
 source/postprocess/visualization.cc | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/source/postprocess/visualization.cc b/source/postprocess/visualization.cc
index c17ca2b..2995cff 100644
--- a/source/postprocess/visualization.cc
+++ b/source/postprocess/visualization.cc
@@ -242,6 +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());
       if (output_format=="hdf5")
         {
           XDMFEntry new_xdmf_entry;
@@ -264,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(),
-                                                      this->get_time(),
+                                                      current_time,
                                                       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(),
-                                                      this->get_time(),
+                                                      current_time,
                                                       this->get_mpi_communicator());
 #endif
           xdmf_entries.push_back(new_xdmf_entry);
@@ -298,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(this->get_time(),
+              times_and_pvtu_names.push_back(std::make_pair(current_time,
                                                             pvtu_master_filename));
               const std::string
               pvd_master_filename = (this->get_output_directory() + "solution.pvd");
@@ -335,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 = this->get_time();
+            vtk_flags.time = current_time;
 #endif
             data_out.set_flags (vtk_flags);
 
@@ -364,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>
-                                             (this->get_time(), pvtu_master_filename));
+                                             (current_time, 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