]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added Assert in fe_values.h to ensure fe_values object is reinited to a cell
authorRAJAT ARORA <rajat.arora9464@gmail.com>
Tue, 14 Nov 2017 18:13:13 +0000 (13:13 -0500)
committerRAJAT ARORA <rajat.arora9464@gmail.com>
Tue, 14 Nov 2017 18:13:13 +0000 (13:13 -0500)
include/deal.II/fe/fe_values.h

index 71edc3b5acbc64935dad540c98ce76455f5234ee..11e89c987fb81089c29639e959a1dafbacf4aaba 100644 (file)
@@ -4365,7 +4365,8 @@ FEValuesBase<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::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<dim,spacedim>::quadrature_point (const unsigned int i) const
           ExcAccessToUninitializedField("update_quadrature_points"));
   Assert (i<this->mapping_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<dim,spacedim>::JxW (const unsigned int i) const
           ExcAccessToUninitializedField("update_JxW_values"));
   Assert (i<this->mapping_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<dim,spacedim>::jacobian (const unsigned int i) const
           ExcAccessToUninitializedField("update_jacobians"));
   Assert (i<this->mapping_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<dim,spacedim>::jacobian_grad (const unsigned int i) const
           ExcAccessToUninitializedField("update_jacobians_grads"));
   Assert (i<this->mapping_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<dim,spacedim>::inverse_jacobian (const unsigned int i) const
           ExcAccessToUninitializedField("update_inverse_jacobians"));
   Assert (i<this->mapping_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<dim,spacedim>::normal_vector (const unsigned int i) const
           (typename FEValuesBase<dim,spacedim>::ExcAccessToUninitializedField("update_normal_vectors")));
   Assert (i<this->mapping_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];
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.