[cig-commits] [commit] master: Fix forgotten resizing of depth average files. Add an assertion. (c10d31a)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed May 14 15:02:26 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/f0327bd8bf41ede933190688a9c078bc091c2670...2f27335d4a52efc6ce31351c2a47422171411114
>---------------------------------------------------------------
commit c10d31aa4519942b6432ca442c9590261e511ffe
Author: Wolfgang Bangerth <bangerth at math.tamu.edu>
Date: Wed May 14 16:43:08 2014 -0500
Fix forgotten resizing of depth average files. Add an assertion.
>---------------------------------------------------------------
c10d31aa4519942b6432ca442c9590261e511ffe
source/postprocess/visualization/seismic_anomalies.cc | 8 ++++----
source/simulator/helper_functions.cc | 3 +++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/source/postprocess/visualization/seismic_anomalies.cc b/source/postprocess/visualization/seismic_anomalies.cc
index cd304ba..4fd6473 100644
--- a/source/postprocess/visualization/seismic_anomalies.cc
+++ b/source/postprocess/visualization/seismic_anomalies.cc
@@ -84,8 +84,8 @@ namespace aspect
new Vector<float>(this->get_triangulation().n_active_cells()));
- const int npoints = 2; // npoint in running average half-width of window
- std::vector<double> Vs_depth_average;
+ const unsigned int npoints = 2; // window in running average half-width of window
+ std::vector<double> Vs_depth_average(50);
this->get_depth_average_Vs(Vs_depth_average);
compute_running_average(Vs_depth_average, npoints);
@@ -156,8 +156,8 @@ namespace aspect
new Vector<float>(this->get_triangulation().n_active_cells()));
- const int npoints = 2; // npoint in running average half-width of window
- std::vector<double> Vp_depth_average;
+ const unsigned int npoints = 2; // window in running average half-width of window
+ std::vector<double> Vp_depth_average(50);
this->get_depth_average_Vp(Vp_depth_average);
compute_running_average(Vp_depth_average, npoints);
diff --git a/source/simulator/helper_functions.cc b/source/simulator/helper_functions.cc
index 5007d2f..df57a8f 100644
--- a/source/simulator/helper_functions.cc
+++ b/source/simulator/helper_functions.cc
@@ -747,6 +747,9 @@ namespace aspect
void Simulator<dim>::compute_depth_average(std::vector<double> &values,
FUNCTOR &fctr) const
{
+ Assert (values.size() > 0,
+ ExcMessage ("To call this function, you need to request a positive "
+ "number of depth slices."));
const unsigned int num_slices = values.size();
std::vector<double> volume(num_slices);
More information about the CIG-COMMITS
mailing list