https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PetscVectorReader.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "PetscVectorReader.h"
11
13 : _vec(vec), _raw_value(vec.get_array_read())
14{
15}
16
18 : _vec(libMesh::cast_ref<PetscVector<Number> &>(vec)), _raw_value(_vec.get_array_read())
19{
20}
21
23
24void
26{
27 mooseAssert(readable(), "Array not retrieved");
29 _raw_value = nullptr;
30}
void restore()
Restore the array, usually upon going out of scope.
PetscVectorReader(PetscVector< Number > &vec)
Construct using a pets vector.
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.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...