From 852539fdf51cbbe6c47417c0dee059814fc1e656 Mon Sep 17 00:00:00 2001 From: RAJAT ARORA Date: Tue, 14 Nov 2017 13:13:13 -0500 Subject: [PATCH] Added Assert in fe_values.h to ensure fe_values object is reinited to a cell --- include/deal.II/fe/fe_values.h | 65 ++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index 71edc3b5ac..11e89c987f 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -4365,7 +4365,8 @@ FEValuesBase::shape_value (const unsigned int i, ExcAccessToUninitializedField("update_values")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: if (fe->is_primitive()) @@ -4401,6 +4402,8 @@ FEValuesBase::shape_value_component (const unsigned int i, ExcAccessToUninitializedField("update_values")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function // is non-zero at all within @@ -4430,7 +4433,8 @@ FEValuesBase::shape_grad (const unsigned int i, ExcAccessToUninitializedField("update_gradients")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: if (fe->is_primitive()) @@ -4466,7 +4470,8 @@ FEValuesBase::shape_grad_component (const unsigned int i, ExcAccessToUninitializedField("update_gradients")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); - + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function // is non-zero at all within // this component: @@ -4495,7 +4500,8 @@ FEValuesBase::shape_hessian (const unsigned int i, ExcAccessToUninitializedField("update_hessians")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: if (fe->is_primitive()) @@ -4531,7 +4537,8 @@ FEValuesBase::shape_hessian_component (const unsigned int i, ExcAccessToUninitializedField("update_hessians")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); - + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function // is non-zero at all within // this component: @@ -4560,7 +4567,8 @@ FEValuesBase::shape_3rd_derivative (const unsigned int i, ExcAccessToUninitializedField("update_3rd_derivatives")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: if (fe->is_primitive()) @@ -4596,7 +4604,8 @@ FEValuesBase::shape_3rd_derivative_component (const unsigned int i ExcAccessToUninitializedField("update_3rd_derivatives")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); - + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function // is non-zero at all within // this component: @@ -4649,6 +4658,8 @@ FEValuesBase::get_quadrature_points () const { Assert (this->update_flags & update_quadrature_points, ExcAccessToUninitializedField("update_quadrature_points")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.quadrature_points; } @@ -4661,6 +4672,8 @@ FEValuesBase::get_JxW_values () const { Assert (this->update_flags & update_JxW_values, ExcAccessToUninitializedField("update_JxW_values")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.JxW_values; } @@ -4673,6 +4686,8 @@ FEValuesBase::get_jacobians () const { Assert (this->update_flags & update_jacobians, ExcAccessToUninitializedField("update_jacobians")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobians; } @@ -4685,6 +4700,8 @@ FEValuesBase::get_jacobian_grads () const { Assert (this->update_flags & update_jacobian_grads, ExcAccessToUninitializedField("update_jacobians_grads")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_grads; } @@ -4697,6 +4714,8 @@ FEValuesBase::jacobian_pushed_forward_grad (const unsigned int i) { Assert (this->update_flags & update_jacobian_pushed_forward_grads, ExcAccessToUninitializedField("update_jacobian_pushed_forward_grads")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_grads[i]; } @@ -4709,6 +4728,8 @@ FEValuesBase::get_jacobian_pushed_forward_grads () const { Assert (this->update_flags & update_jacobian_pushed_forward_grads, ExcAccessToUninitializedField("update_jacobian_pushed_forward_grads")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_grads; } @@ -4721,6 +4742,8 @@ FEValuesBase::jacobian_2nd_derivative (const unsigned int i) const { Assert (this->update_flags & update_jacobian_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_2nd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_2nd_derivatives[i]; } @@ -4733,6 +4756,8 @@ FEValuesBase::get_jacobian_2nd_derivatives () const { Assert (this->update_flags & update_jacobian_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_2nd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_2nd_derivatives; } @@ -4745,6 +4770,8 @@ FEValuesBase::jacobian_pushed_forward_2nd_derivative (const unsign { Assert (this->update_flags & update_jacobian_pushed_forward_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_2nd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_2nd_derivatives[i]; } @@ -4757,6 +4784,8 @@ FEValuesBase::get_jacobian_pushed_forward_2nd_derivatives () const { Assert (this->update_flags & update_jacobian_pushed_forward_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_2nd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_2nd_derivatives; } @@ -4769,6 +4798,8 @@ FEValuesBase::jacobian_3rd_derivative (const unsigned int i) const { Assert (this->update_flags & update_jacobian_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_3rd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_3rd_derivatives[i]; } @@ -4781,6 +4812,8 @@ FEValuesBase::get_jacobian_3rd_derivatives () const { Assert (this->update_flags & update_jacobian_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_3rd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_3rd_derivatives; } @@ -4793,6 +4826,8 @@ FEValuesBase::jacobian_pushed_forward_3rd_derivative (const unsign { Assert (this->update_flags & update_jacobian_pushed_forward_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_3rd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_3rd_derivatives[i]; } @@ -4805,6 +4840,8 @@ FEValuesBase::get_jacobian_pushed_forward_3rd_derivatives () const { Assert (this->update_flags & update_jacobian_pushed_forward_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_3rd_derivatives")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_3rd_derivatives; } @@ -4816,6 +4853,8 @@ FEValuesBase::get_inverse_jacobians () const { Assert (this->update_flags & update_inverse_jacobians, ExcAccessToUninitializedField("update_inverse_jacobians")); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.inverse_jacobians; } @@ -4830,6 +4869,8 @@ FEValuesBase::quadrature_point (const unsigned int i) const ExcAccessToUninitializedField("update_quadrature_points")); Assert (imapping_output.quadrature_points.size(), ExcIndexRange(i, 0, this->mapping_output.quadrature_points.size())); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.quadrature_points[i]; } @@ -4846,6 +4887,8 @@ FEValuesBase::JxW (const unsigned int i) const ExcAccessToUninitializedField("update_JxW_values")); Assert (imapping_output.JxW_values.size(), ExcIndexRange(i, 0, this->mapping_output.JxW_values.size())); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.JxW_values[i]; } @@ -4861,6 +4904,8 @@ FEValuesBase::jacobian (const unsigned int i) const ExcAccessToUninitializedField("update_jacobians")); Assert (imapping_output.jacobians.size(), ExcIndexRange(i, 0, this->mapping_output.jacobians.size())); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobians[i]; } @@ -4876,6 +4921,8 @@ FEValuesBase::jacobian_grad (const unsigned int i) const ExcAccessToUninitializedField("update_jacobians_grads")); Assert (imapping_output.jacobian_grads.size(), ExcIndexRange(i, 0, this->mapping_output.jacobian_grads.size())); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_grads[i]; } @@ -4891,6 +4938,8 @@ FEValuesBase::inverse_jacobian (const unsigned int i) const ExcAccessToUninitializedField("update_inverse_jacobians")); Assert (imapping_output.inverse_jacobians.size(), ExcIndexRange(i, 0, this->mapping_output.inverse_jacobians.size())); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.inverse_jacobians[i]; } @@ -4905,6 +4954,8 @@ FEValuesBase::normal_vector (const unsigned int i) const (typename FEValuesBase::ExcAccessToUninitializedField("update_normal_vectors"))); Assert (imapping_output.normal_vectors.size(), ExcIndexRange(i, 0, this->mapping_output.normal_vectors.size())); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.normal_vectors[i]; } -- 2.39.5