23 #include "libmesh/dof_map.h" 
   24 #include "libmesh/dense_matrix.h" 
   25 #include "libmesh/laspack_matrix.h" 
   26 #include "libmesh/eigen_sparse_matrix.h" 
   27 #include "libmesh/parallel.h" 
   28 #include "libmesh/petsc_matrix.h" 
   29 #include "libmesh/sparse_matrix.h" 
   30 #include "libmesh/trilinos_epetra_matrix.h" 
   31 #include "libmesh/numeric_vector.h" 
   32 #include "libmesh/auto_ptr.h"  
   33 #include "libmesh/enum_solver_package.h" 
   57                                         const std::vector<numeric_index_type> & brows,
 
   58                                         const std::vector<numeric_index_type> & bcols)
 
   60   libmesh_assert_equal_to (dm.
m() / brows.size(), dm.
n() / bcols.size());
 
   63     (dm.
m() / brows.size());
 
   65   libmesh_assert_equal_to (dm.
m()%blocksize, 0);
 
   66   libmesh_assert_equal_to (dm.
n()%blocksize, 0);
 
   68   std::vector<numeric_index_type> rows, cols;
 
   70   rows.reserve(blocksize*brows.size());
 
   71   cols.reserve(blocksize*bcols.size());
 
   73   for (
auto & row : brows)
 
   77       for (
unsigned int v=0; v<blocksize; v++)
 
   81   for (
auto & col : bcols)
 
   85       for (
unsigned int v=0; v<blocksize; v++)
 
   89   this->add_matrix (dm, rows, cols);
 
  102       libmesh_not_implemented();
 
  105   os << 
"Real part:" << std::endl;
 
  109         os << std::setw(8) << (*this)(i,j).
real() << 
" ";
 
  113   os << std::endl << 
"Imaginary part:" << std::endl;
 
  117         os << std::setw(8) << (*this)(i,j).
imag() << 
" ";
 
  128 template <
typename T>
 
  129 std::unique_ptr<SparseMatrix<T>>
 
  137   switch (solver_package)
 
  140 #ifdef LIBMESH_HAVE_LASPACK 
  142       return libmesh_make_unique<LaspackMatrix<T>>(comm);
 
  146 #ifdef LIBMESH_HAVE_PETSC 
  148       return libmesh_make_unique<PetscMatrix<T>>(comm);
 
  152 #ifdef LIBMESH_TRILINOS_HAVE_EPETRA 
  154       return libmesh_make_unique<EpetraMatrix<T>>(comm);
 
  158 #ifdef LIBMESH_HAVE_EIGEN 
  160       return libmesh_make_unique<EigenSparseMatrix<T>>(comm);
 
  164       libmesh_error_msg(
"ERROR:  Unrecognized solver package: " << solver_package);
 
  169 template <
typename T>
 
  174   this->vector_mult_add(dest,arg);
 
  179 template <
typename T>
 
  190 template <
typename T>
 
  194   libmesh_not_implemented();
 
  199 template <
typename T>
 
  202   parallel_object_only();
 
  207     libmesh_error_msg(
"Error!  Trying to print a matrix with no dof_map set!");
 
  211   if (this->processor_id() == 0)
 
  213       libmesh_assert_equal_to (this->_dof_map->first_dof(), 0);
 
  215            i!=this->_dof_map->end_dof(); ++i)
 
  222                   if (c != static_cast<T>(0.0))
 
  224                       os << i << 
" " << j << 
" " << c << std::endl;
 
  231                 os << (*this)(i,j) << 
" ";
 
  236       std::vector<numeric_index_type> ibuf, jbuf;
 
  241           this->comm().receive(p, ibuf);
 
  242           this->comm().receive(p, jbuf);
 
  243           this->comm().receive(p, cbuf);
 
  244           libmesh_assert_equal_to (ibuf.size(), jbuf.size());
 
  245           libmesh_assert_equal_to (ibuf.size(), cbuf.size());
 
  249           libmesh_assert_greater_equal (ibuf.front(), currenti);
 
  250           libmesh_assert_greater_equal (ibuf.back(), ibuf.front());
 
  252           std::size_t currentb = 0;
 
  253           for (;currenti <= ibuf.back(); ++currenti)
 
  259                       if (currentb < ibuf.size() &&
 
  260                           ibuf[currentb] == currenti &&
 
  263                           os << currenti << 
" " << j << 
" " << cbuf[currentb] << std::endl;
 
  272                       if (currentb < ibuf.size() &&
 
  273                           ibuf[currentb] == currenti &&
 
  276                           os << cbuf[currentb] << 
" ";
 
  280                         os << static_cast<T>(0.0) << 
" ";
 
  288           for (; currenti != this->m(); ++currenti)
 
  291                 os << static_cast<T>(0.0) << 
" ";
 
  298       std::vector<numeric_index_type> ibuf, jbuf;
 
  304            i!=this->_dof_map->end_dof(); ++i)
 
  309               if (c != static_cast<T>(0.0))
 
  317       this->comm().send(0,ibuf);
 
  318       this->comm().send(0,jbuf);
 
  319       this->comm().send(0,cbuf);