]> https://gitweb.dealii.org/ - dealii.git/commitdiff
minor adjustments to block matrix and vector to work with complex PETSc 2216/head
authorDenis Davydov <davydden@gmail.com>
Mon, 22 Feb 2016 12:29:45 +0000 (13:29 +0100)
committerDenis Davydov <davydden@gmail.com>
Mon, 22 Feb 2016 13:02:47 +0000 (14:02 +0100)
include/deal.II/lac/block_vector_base.h
source/lac/block_matrix_array.cc

index 6aed46afdf86cf980149e8d40adca8bddb199ae5..17d5eebaeb25e4281cbcab4711ef601f0058f020 100644 (file)
@@ -1686,10 +1686,11 @@ typename BlockVectorBase<VectorType>::value_type
 BlockVectorBase<VectorType>::mean_value () const
 {
   value_type sum = 0.;
+  // need to do static_cast as otherwise it won't work with value_type=complex<T>
   for (size_type i=0; i<n_blocks(); ++i)
-    sum += components[i].mean_value() * components[i].size();
+    sum += components[i].mean_value() * static_cast<double>(components[i].size());
 
-  return sum/size();
+  return sum/static_cast<double>(size());
 }
 
 
index 58c47462914c62b35bf11898c23b86eeaaa600b9..c8dce1d78ff58450d2d1533ce559cc6f4fba45c5 100644 (file)
@@ -323,7 +323,7 @@ BlockTrianglePrecondition<number,BlockVectorType>::do_row
             m->matrix->Tvmult(aux, dst.block(j));
           else
             m->matrix->vmult(aux, dst.block(j));
-          dst.block(i).add (-1 * m->prefix, aux);
+          dst.block(i).add (-1.0 * m->prefix, aux);
         }
     }
   Assert (diagonals.size() != 0, ExcNoDiagonal(row_num));
@@ -438,10 +438,17 @@ template class BlockTrianglePrecondition<double, TrilinosWrappers::MPI::BlockVec
 #endif
 
 #ifdef DEAL_II_WITH_PETSC
+#ifdef PETSC_USE_COMPLEX
+template class BlockMatrixArray<std::complex<float>, PETScWrappers::MPI::BlockVector>;
+template class BlockMatrixArray<std::complex<double>, PETScWrappers::MPI::BlockVector>;
+template class BlockTrianglePrecondition<std::complex<float>, PETScWrappers::MPI::BlockVector>;
+template class BlockTrianglePrecondition<std::complex<double>, PETScWrappers::MPI::BlockVector>;
+#else
 template class BlockMatrixArray<float, PETScWrappers::MPI::BlockVector>;
 template class BlockMatrixArray<double, PETScWrappers::MPI::BlockVector>;
 template class BlockTrianglePrecondition<float, PETScWrappers::MPI::BlockVector>;
 template class BlockTrianglePrecondition<double, PETScWrappers::MPI::BlockVector>;
 #endif
+#endif
 
 DEAL_II_NAMESPACE_CLOSE

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.