]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make things work with complex-valued vectors.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 30 Oct 2017 22:33:17 +0000 (16:33 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 30 Oct 2017 22:33:17 +0000 (16:33 -0600)
source/numerics/error_estimator_1d.cc

index d49a71b91422c559fb3ea20a80a45c50148d1da6..d6482821cb76550eff33000f74898f5ad26420b5 100644 (file)
@@ -308,8 +308,8 @@ estimate (const Mapping<1,spacedim>                  &mapping,
                   std::vector<std::vector<Tensor<1,spacedim,number> > >(2, std::vector<Tensor<1,spacedim,number> >(n_components)));
   std::vector<std::vector<std::vector<Tensor<1,spacedim,number> > > >
   gradients_neighbor (gradients_here);
-  std::vector<Vector<number> >
-  grad_neighbor (n_solution_vectors, Vector<number>(n_components));
+  std::vector<Vector<typename ProductType<number,double>::type> >
+  grad_neighbor (n_solution_vectors, Vector<typename ProductType<number,double>::type>(n_components));
 
   // reserve some space for coefficient values at one point.  if there is no
   // coefficient, then we fill it by unity once and for all and don't set it
@@ -436,12 +436,14 @@ estimate (const Mapping<1,spacedim>                  &mapping,
                 if (component_mask[component] == true)
                   {
                     // get gradient here
-                    const number grad_here = gradients_here[s][n][component]
-                                             * normal;
-
-                    const number jump = ((grad_here - grad_neighbor[s](component)) *
-                                         coefficient_values(component));
-                    (*errors[s])(cell->active_cell_index()) += numbers::NumberTraits<number>::abs_square(jump) * cell->diameter();
+                    const typename ProductType<number,double>::type
+                    grad_here = gradients_here[s][n][component] * normal;
+
+                    const typename ProductType<number,double>::type
+                    jump = ((grad_here - grad_neighbor[s](component)) *
+                            coefficient_values(component));
+                    (*errors[s])(cell->active_cell_index())
+                    += numbers::NumberTraits<typename ProductType<number,double>::type>::abs_square(jump) * cell->diameter();
                   }
           }
 

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.