]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove variables that only appear in assertions.
authorDavid Wells <wellsd2@rpi.edu>
Tue, 3 Jan 2017 17:44:41 +0000 (12:44 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 5 Jan 2017 03:08:30 +0000 (22:08 -0500)
This was caught by cppcheck.

include/deal.II/base/quadrature_point_data.h
include/deal.II/integrators/maxwell.h

index 9542728d6ef0c82bd7b2d44e948b01c1e79adbed..80c603dc6be8f34bb7a74b1e2aa84025439a07c6 100644 (file)
@@ -639,12 +639,11 @@ void pack_cell_data
 
   const std::vector<std::shared_ptr<const DataType> > qpd = data_storage->get_data(cell);
 
-  const unsigned int m = matrix_data.m();
   const unsigned int n = matrix_data.n();
 
   std::vector<double> single_qp_data(n);
-  Assert (qpd.size() == m,
-          ExcDimensionMismatch(qpd.size(),m));
+  Assert (qpd.size() == matrix_data.m(),
+          ExcDimensionMismatch(qpd.size(), matrix_data.m()));
   for (unsigned int q = 0; q < qpd.size(); q++)
     {
       qpd[q]->pack_values(single_qp_data);
@@ -673,12 +672,11 @@ void unpack_to_cell_data
 
   std::vector<std::shared_ptr<DataType> > qpd = data_storage->get_data(cell);
 
-  const unsigned int m = values_at_qp.m();
   const unsigned int n = values_at_qp.n();
 
   std::vector<double> single_qp_data(n);
-  Assert(qpd.size() == m,
-         ExcDimensionMismatch(qpd.size(),m));
+  Assert(qpd.size() == values_at_qp.m(),
+         ExcDimensionMismatch(qpd.size(), values_at_qp.m()));
 
   for (unsigned int q = 0; q < qpd.size(); q++)
     {
index e7e08589c5fcbb416912dc433d1e06040e28fa9f..80fa9cff919484d42e632a1290efa4f2330d99bb 100644 (file)
@@ -225,11 +225,12 @@ namespace LocalIntegrators
       const FEValuesBase<dim> &fetest,
       double factor = 1.)
     {
-      unsigned int t_comp = (dim==3) ? dim : 1;
       const unsigned int n_dofs = fe.dofs_per_cell;
       const unsigned int t_dofs = fetest.dofs_per_cell;
       AssertDimension(fe.get_fe().n_components(), dim);
-      AssertDimension(fetest.get_fe().n_components(), t_comp);
+      // There should be the right number of components (3 in 3D, otherwise 1)
+      // for the curl.
+      AssertDimension(fetest.get_fe().n_components(), (dim == 3) ? dim : 1);
       AssertDimension(M.m(), t_dofs);
       AssertDimension(M.n(), n_dofs);
 

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.