[cig-commits] [commit] master: Add an assertion. (8d81ef3)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Sat May 24 14:21:34 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/e2d2428a203331b4832dbc4e5f4d716934c22694...f68c1b584dc0211691228ef830ea1d2538da258d
>---------------------------------------------------------------
commit 8d81ef37164606b3842552a8dff3bdf83949d5ac
Author: Rene Gassmoeller <R.Gassmoeller at mailbox.org>
Date: Fri May 23 19:10:33 2014 -0500
Add an assertion.
>---------------------------------------------------------------
8d81ef37164606b3842552a8dff3bdf83949d5ac
source/velocity_boundary_conditions/gplates.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/source/velocity_boundary_conditions/gplates.cc b/source/velocity_boundary_conditions/gplates.cc
index 02b2f35..d6e56a6 100644
--- a/source/velocity_boundary_conditions/gplates.cc
+++ b/source/velocity_boundary_conditions/gplates.cc
@@ -147,8 +147,12 @@ namespace aspect
// n_points = n_theta * n_phi with n_phi = 2 * (n_theta - 1)
// From the XML information we only know n_points, but need n_theta
// and n_phi to properly size the arrays and get the grip point positions
- const unsigned int n_theta = static_cast<unsigned int>(0.5 + std::sqrt(0.25 + n_points/2));
- const unsigned int n_phi = 2 * (n_theta - 1);
+ const double dn_theta = 0.5 + std::sqrt(0.25 + n_points/2);
+ const unsigned int n_theta = static_cast<unsigned int> (dn_theta);
+ const unsigned int n_phi = 2 * (dn_theta - 1);
+
+ AssertThrow(dn_theta - n_theta <= 1e-5,
+ ExcMessage("The velocity file has a grid structure that is not readable. Please refer to the manual for a proper grid structure."));
if ((delta_theta != 0.0) || (delta_phi != 0.0))
{
More information about the CIG-COMMITS
mailing list