12#include "libmesh/petsc_vector.h"
13#include "libmesh/id_types.h"
14#include "libmesh/libmesh_common.h"
39 PetscScalar
operator()(
const numeric_index_type i)
const;
46 PetscVector<Number> &
_vec;
55 mooseAssert(
readable(),
"Not readable");
56 const numeric_index_type local_index =
_vec.map_global_to_local_index(i);
A class which helps with repeated reading from a petsc vector.
PetscScalar operator()(const numeric_index_type i) const
Access a value in the petsc vector.
void restore()
Restore the array, usually upon going out of scope.
const PetscScalar * _raw_value
The raw values in the vector.
bool readable() const
Check if this vector is readable.
~PetscVectorReader()
Destructor to make sure the vector is restored every time this goes out of scope.
PetscVector< Number > & _vec
Reference to the petsc vector whose values shall be read.