16 #ifndef dealii__petsc_vector_h
17 #define dealii__petsc_vector_h
20 #include <deal.II/base/config.h>
22 #ifdef DEAL_II_WITH_PETSC
24 # include <deal.II/base/subscriptor.h>
25 # include <deal.II/lac/exceptions.h>
26 # include <deal.II/lac/petsc_vector_base.h>
27 # include <deal.II/lac/petsc_parallel_vector.h>
28 # include <deal.II/lac/vector.h>
29 # include <deal.II/lac/vector_type_traits.h>
31 DEAL_II_NAMESPACE_OPEN
34 namespace PETScWrappers
98 template <
typename Number>
99 explicit Vector (const ::Vector<Number> &v);
107 explicit Vector (
const Vec &v);
164 template <
typename number>
178 const bool omit_zeroing_entries =
false);
188 const bool omit_zeroing_entries =
false);
196 } DEAL_II_DEPRECATED;
220 template <
typename number>
256 const PetscErrorCode ierr = VecCopy (v.vector,
vector);
274 #if DEAL_II_PETSC_VERSION_LT(3,2,0)
275 ierr = VecDestroy (
vector);
277 ierr = VecDestroy (&
vector);
291 #if DEAL_II_PETSC_VERSION_LT(2,2,0)
292 ierr = VecConvertMPIToSeqAll (static_cast<const Vec &>(v),
300 ierr = VecScatterCreateToAll (static_cast<const Vec &>(v), &ctx, &
vector);
303 #if ((PETSC_VERSION_MAJOR == 2) && \
304 ((PETSC_VERSION_MINOR < 3) || \
305 ((PETSC_VERSION_MINOR == 3) && \
306 (PETSC_VERSION_SUBMINOR < 3))))
307 ierr = VecScatterBegin (static_cast<const Vec &>(v),
vector,
308 INSERT_VALUES, SCATTER_FORWARD, ctx);
311 ierr = VecScatterEnd (static_cast<const Vec &>(v),
vector,
312 INSERT_VALUES, SCATTER_FORWARD, ctx);
316 ierr = VecScatterBegin (ctx,static_cast<const Vec &>(v),
vector,
317 INSERT_VALUES, SCATTER_FORWARD);
320 ierr = VecScatterEnd (ctx, static_cast<const Vec &>(v),
vector,
321 INSERT_VALUES, SCATTER_FORWARD);
326 #if DEAL_II_PETSC_VERSION_LT(3,2,0)
327 ierr = VecScatterDestroy (ctx);
329 ierr = VecScatterDestroy (&ctx);
339 template <
typename number>
402 template <
typename>
class ReinitHelper;
412 template <
typename Matrix>
416 bool omit_zeroing_entries)
419 omit_zeroing_entries);
422 template <
typename Matrix>
426 bool omit_zeroing_entries)
429 omit_zeroing_entries);
448 DEAL_II_NAMESPACE_CLOSE
450 #endif // DEAL_II_WITH_PETSC
void reinit(const size_type N, const bool omit_zeroing_entries=false)
types::global_dof_index size_type
void create_vector(const size_type n)
static void reinit_domain_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
#define AssertThrow(cond, exc)
VectorBase & operator=(const PetscScalar s)
Vector & operator=(const Vector &v)
static const bool supports_distributed_data
void compress(const VectorOperation::values operation)
unsigned int global_dof_index
static void reinit_range_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
void swap(Vector &u, Vector &v)