*
* @arg communicator denotes the MPI communicator over which the
* different parts of the vector shall communicate
+ *
+ * @deprecated The use of objects that are explicitly of type VectorBase
+ * is deprecated: use PETScWrappers::MPI::Vector instead.
*/
explicit Vector (const MPI_Comm &communicator,
const VectorBase &v,
- const size_type local_size);
+ const size_type local_size) DEAL_II_DEPRECATED;
/**
* Construct a new parallel ghosted PETSc vector from an IndexSet.
const VectorBase &v,
const size_type local_size)
:
+ VectorBase (v),
communicator (communicator)
{
- Vector::create_vector (v.size(), local_size);
-
- VectorBase::operator = (v);
+ // In the past (before it was deprecated) this constructor did a
+ // byte-for-byte copy of v. This choice resulted in two problems:
+ // 1. The created vector will have the same size as v, not local size.
+ // 2. Since both the created vector and v maintain ownership of the same
+ // PETSc Vec, both will try to destroy it: this does not make sense.
+ //
+ // For the sake of backwards compatibility, preserve the behavior of the
+ // copy, but correct the ownership bug. Note that in both this (and the
+ // original) implementation local_size is ultimately unused.
+ (void)local_size;
}