<h3>Specific improvements</h3>
<ol>
+ <li> New: Add a clear function to the PETSc::Vector
+ and PETSc::MPI::Vector classes similar to the Trilinos vector classes.
+ <br>
+ (Martin Steigemann 2015/05/22)
+ </li>
+
<li> New: Three new quadrature formulas in quadrature_lib, based on
Chebyshev quadrature rules. See functions QGaussChebyshev,
QGaussRadauChebyshev and QGaussLobattoChebyshev.
explicit Vector (const IndexSet &local,
const MPI_Comm &communicator);
+ /**
+ * Release all memory and return to a state just like after having called
+ * the default constructor.
+ */
+ void clear ();
+
/**
* Copy the given vector. Resize the present vector if necessary. Also
* take over the MPI communicator of @p v.
*/
explicit Vector (const MPI::Vector &v);
+ /**
+ * Release all memory and return to a state just like after having called
+ * the default constructor.
+ */
+ void clear ();
+
/**
* Copy the given vector. Resize the present vector if necessary.
*/
*/
virtual ~VectorBase ();
+ /**
+ * Release all memory and return to a state just like after having called
+ * the default constructor.
+ */
+ virtual void clear ();
+
/**
* Compress the underlying representation of the PETSc object, i.e. flush
* the buffers of the vector object if it has any. This function is
}
+
Vector::Vector (const IndexSet &local,
const MPI_Comm &communicator)
:
}
+
+ void
+ Vector::clear ()
+ {
+ // destroy the PETSc Vec and create an invalid empty vector,
+ // so we can just as well create a sequential one to avoid
+ // all the overhead incurred by parallelism
+ attained_ownership = true;
+ VectorBase::clear ();
+
+ const int n = 0;
+ int ierr = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
+ AssertThrow (ierr == 0, ExcPETScError(ierr));
+ }
+
+
+
void
Vector::reinit (const MPI_Comm &comm,
const size_type n,
+ void
+ Vector::clear ()
+ {
+ VectorBase::clear ();
+ Vector::create_vector (0);
+ }
+
+
+
void
Vector::reinit (const size_type n,
const bool fast)
+ void
+ VectorBase::clear ()
+ {
+ if (attained_ownership)
+ {
+#if DEAL_II_PETSC_VERSION_LT(3,2,0)
+ const int ierr = VecDestroy (vector);
+#else
+ const int ierr = VecDestroy (&vector);
+#endif
+ AssertThrow (ierr == 0, ExcPETScError(ierr));
+ }
+
+ ghosted = false;
+ ghost_indices.clear ();
+ last_action = ::dealii::VectorOperation::unknown;
+ attained_ownership = true;
+ }
+
+
+
VectorBase &
VectorBase::operator = (const PetscScalar s)
{