From 8d6213ea0cd2aab1222e5a0a2cab5bc71835c0f0 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 31 Jan 2013 17:31:02 +0100 Subject: [PATCH] added: sanity check specified isotropic materials if we end up with too small/large poisson's ratio, bail with an error message rather than crashing with a segfault --- dune/elasticity/material.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dune/elasticity/material.cpp b/dune/elasticity/material.cpp index 0623b61..22e9956 100644 --- a/dune/elasticity/material.cpp +++ b/dune/elasticity/material.cpp @@ -132,6 +132,14 @@ Material* Material::create(int ID, const std::string& file) } else if (str == "en") { // young's modulus and poisson's ratio E = p1; nu = p2; + } else { + std::cerr << "Could not parse rock file " << file << ", bailing" << std::endl + exit(1); + } + + if (nu < 0 || nu > 0.5) { + std::cerr << "Material in " << file << " is not isotropic (nu=" << nu << "), bailing" << std::endl; + exit(1); } return new Isotropic(ID,E,nu,rho);