From: cazamias Date: Fri, 16 Nov 2012 22:52:37 +0000 (+0000) Subject: Added some reinit functions to trilinos_vector X-Git-Tag: v8.0.0~120^2~117 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50de42f5610bba6fd49902972860cdba7b52a510;p=dealii.git Added some reinit functions to trilinos_vector git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@27553 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/trilinos_vector.h b/deal.II/include/deal.II/lac/trilinos_vector.h index 4df3e86c6b..fe53940824 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_vector.h @@ -235,6 +235,16 @@ namespace TrilinosWrappers void reinit (const BlockVector &v, const bool import_data = false); + /** + * Reinit function. Creates a vector + * using the IndexSet local as our + * own unknowns, add optional ghost + * values ghost. + */ + void reinit (const MPI_Comm &communicator, + const IndexSet &local, + const IndexSet &ghost=IndexSet(0)); + /** * Set all components of the * vector to the given number @p @@ -416,6 +426,10 @@ namespace TrilinosWrappers Vector (const IndexSet ¶llel_partitioning, const MPI_Comm &communicator = MPI_COMM_WORLD); + Vector (const MPI_Comm &communicator, + const IndexSet &local, + const IndexSet &ghost=IndexSet(0)); + /** * Copy constructor from the * TrilinosWrappers vector @@ -616,6 +630,16 @@ namespace TrilinosWrappers Vector (const IndexSet &partitioning, const MPI_Comm &communicator = MPI_COMM_WORLD); + /** + * This constructor creates a vector + * using the IndexSet local as our + * own unknowns, add optional ghost + * values ghost. + */ + Vector (const MPI_Comm &communicator, + const IndexSet &local, + const IndexSet &ghost); + /** * This constructor takes a * (possibly parallel) Trilinos @@ -691,6 +715,7 @@ namespace TrilinosWrappers const bool fast = false, const bool allow_different_maps = false); + /** * Set all components of the * vector to the given number @p diff --git a/deal.II/include/deal.II/lac/trilinos_vector_base.h b/deal.II/include/deal.II/lac/trilinos_vector_base.h index f3a7bee54a..fd39fff3d0 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector_base.h +++ b/deal.II/include/deal.II/lac/trilinos_vector_base.h @@ -858,6 +858,14 @@ namespace TrilinosWrappers */ void ratio (const VectorBase &a, const VectorBase &b); + + + /** + * Empty function; added to allow + * PETSc and Trilinos Vectors to + * be used interchangeably + */ + void update_ghost_values() const; //@} @@ -949,6 +957,7 @@ namespace TrilinosWrappers std::size_t memory_consumption () const; //@} + /** * Exception */ diff --git a/deal.II/source/lac/trilinos_vector.cc b/deal.II/source/lac/trilinos_vector.cc index 2f4611cc64..64be7df513 100644 --- a/deal.II/source/lac/trilinos_vector.cc +++ b/deal.II/source/lac/trilinos_vector.cc @@ -106,6 +106,17 @@ namespace TrilinosWrappers reinit (v, false, true); } + Vector::Vector (const MPI_Comm &communicator, + const IndexSet &local, + const IndexSet &ghost) + : + VectorBase() + { + IndexSet parallel_partitioning = local; + parallel_partitioning.add_indices(ghost); + reinit(parallel_partitioning, communicator); + } + Vector::~Vector () @@ -279,6 +290,13 @@ namespace TrilinosWrappers } + void Vector::reinit(const MPI_Comm &communicator, const IndexSet &local, const IndexSet &ghost) + { + IndexSet parallel_partitioning = local; + parallel_partitioning.add_indices(ghost); + reinit(parallel_partitioning, communicator); + } + Vector & Vector::operator = (const Vector &v) diff --git a/deal.II/source/lac/trilinos_vector_base.cc b/deal.II/source/lac/trilinos_vector_base.cc index 7e545c4f17..706af557cf 100644 --- a/deal.II/source/lac/trilinos_vector_base.cc +++ b/deal.II/source/lac/trilinos_vector_base.cc @@ -425,6 +425,11 @@ namespace TrilinosWrappers + this->local_size()*( sizeof(double)+sizeof(int) ); } + void + VectorBase::update_ghost_values() const + { + } + } /* end of namespace TrilinosWrappers */