/**
* Change the dimension of the vector
- * to @p{N}. It is unspecified how
+ * to @arg N. It is unspecified how
* resizing the vector affects the
* memory allocation of this object;
* i.e., it is not guaranteed that
* the same amount of memory is used
* for less data.
*
- * On @p{fast==false}, the vector is
+ * On @arg fast is false, the vector is
* filled by zeros. Otherwise, the
* elements are left an unspecified
* state.
+ *
+ * For parallel vectors, @arg
+ * local_size denotes how many of the
+ * @arg N values shall be stored
+ * locally on the present process. This
+ * argument is ignored for sequantial
+ * vectors.
*/
void reinit (const unsigned int N,
- const bool fast=false);
+ const bool fast=false,
+ const unsigned int local_size = 0);
/**
* Change the dimension to that of the
void
Vector::create_vector (const unsigned int n,
- const unsigned int /*local_size*/)
+ const unsigned int local_size)
{
+ Assert (local_size < n, ExcIndexRange (local_size, 0, n));
+
const int ierr
= VecCreateSeq (PETSC_COMM_SELF, n, &vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
void
VectorBase::reinit (const unsigned int n,
- const bool fast)
+ const bool fast,
+ const unsigned int local_sz)
{
// only do something if the sizes
// mismatch
- if (size() != n)
+ if ((size() != n) || (local_size() != local_sz))
{
// FIXME: I'd like to use this here,
// but somehow it leads to odd errors
ierr = VecDestroy (vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
- create_vector (n);
+ create_vector (n, local_sz);
}
// finally clear the new vector if so