Commit c6a0c6d5 authored by Christopher Subich's avatar Christopher Subich
Browse files

Include sanity checking for quadrature weight init

The quadrature weight "get" functions will now check whether the
corresponding array has been initialized (length >= 1) before returning
the array.  This will catch errors where quadrature weights are used
before being initialized.
parent d2631e0f
......@@ -342,11 +342,22 @@ void compute_quadweights(int szx, int szy, int szz,
_quadw_z = Lz/szz;
}
}
const blitz::Array<double,1> * get_quad_x() { return &_quadw_x;}
const blitz::Array<double,1> * get_quad_y() { return &_quadw_y;}
const blitz::Array<double,1> * get_quad_z() { return &_quadw_z;}
const blitz::Array<double,1> * get_quad_x() {
// Check whether the quad weight has been initialized
if (_quadw_x.length(firstDim) <= 0) {
assert(0 && "Error: quadrature weights were not initalized before use");
}
return &_quadw_x;
}
const blitz::Array<double,1> * get_quad_y() {
if (_quadw_y.length(firstDim) <= 0) {
assert(0 && "Error: quadrature weights were not initalized before use");
}
return &_quadw_y;
}
const blitz::Array<double,1> * get_quad_z() {
if (_quadw_z.length(firstDim) <= 0) {
assert(0 && "Error: quadrature weights were not initalized before use");
}
return &_quadw_z;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment