From 6f5bdedad6e94c03be0a8da047a98976d0ad83be Mon Sep 17 00:00:00 2001 From: alberto sartori Date: Tue, 10 May 2016 13:30:27 +0200 Subject: [PATCH] parpack. added reinit for block vectors --- doc/news/changes.h | 5 ++++ include/deal.II/lac/parpack_solver.h | 41 ++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/doc/news/changes.h b/doc/news/changes.h index 4f0c73dfbb..88ce9b37a2 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -248,6 +248,11 @@ inconvenience this causes.

Specific improvements

    +
  1. New: Added PArpackSolver::reinit() when dealing with BlockVectors. +
    + (Alberto Sartori, 2016/05/19) +
  2. +
  3. Fixed: Corrected the sign of curl calculated in the functions: LocalIntegrators::curl_curl_matrix, LocalIntegrators::curl_matrix, LocalIntegrators::nitsche_curl_matrix and LocalIntegrators::ip_curl_matrix in diff --git a/include/deal.II/lac/parpack_solver.h b/include/deal.II/lac/parpack_solver.h index 27c20d5dd9..8ce958c12c 100644 --- a/include/deal.II/lac/parpack_solver.h +++ b/include/deal.II/lac/parpack_solver.h @@ -231,7 +231,16 @@ public: /** * Initialise internal variables. */ - void reinit(const dealii::IndexSet &locally_owned_dofs ); + void reinit(const IndexSet &locally_owned_dofs ); + + /** + * Initialize internal variables when working with BlockVectors. + * @p locally_owned_dofs is used to set the dimension of the problem, + * whereas @p partitioning is used for calling the reinit of the deal.II + * blockvectors used. + */ + void reinit(const IndexSet &locally_owned_dofs, + const std::vector &partitioning); /** * Set desired shift value. @@ -369,6 +378,14 @@ protected: private: + /** + * Initialize internal variables which depend on + * @p locally_owned_dofs. + * + * This function is called inside the reinit() functions + */ + void internal_reinit(const IndexSet &locally_owned_dofs); + /** * PArpackExcInfoPdnaupds. */ @@ -469,7 +486,8 @@ void PArpackSolver::set_shift(const double s ) } template -void PArpackSolver::reinit(const dealii::IndexSet &locally_owned_dofs) +void PArpackSolver:: +internal_reinit(const IndexSet &locally_owned_dofs) { // store local indices to write to vectors locally_owned_dofs.fill_index_vector(local_indices); @@ -507,6 +525,12 @@ void PArpackSolver::reinit(const dealii::IndexSet &locally_owned_dof workev.resize (lworkev, 0.); select.resize (ncv, 0); +} + +template +void PArpackSolver::reinit(const IndexSet &locally_owned_dofs) +{ + internal_reinit(locally_owned_dofs); // deal.II vectors: src.reinit (locally_owned_dofs,mpi_communicator); @@ -515,6 +539,19 @@ void PArpackSolver::reinit(const dealii::IndexSet &locally_owned_dof } +template +void PArpackSolver::reinit(const IndexSet &locally_owned_dofs, + const std::vector &partitioning) +{ + internal_reinit(locally_owned_dofs); + + // deal.II vectors: + src.reinit (partitioning,mpi_communicator); + dst.reinit (partitioning,mpi_communicator); + tmp.reinit (partitioning,mpi_communicator); + +} + template template void PArpackSolver::solve -- 2.39.5