20 #ifndef GEOS_LINEARALGEBRA_INTERFACES_PETSCVECTOR_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_PETSCVECTOR_HPP_
34 extern "C" struct _p_Vec;
110 MPI_Comm
const &
comm )
override;
120 virtual void rand(
unsigned const seed )
override;
135 real64 const beta )
override;
175 virtual void print( std::ostream & os = std::cout )
const override;
177 virtual void write(
string const & filename,
178 LAIOutputFormat const format = LAIOutputFormat::MATRIX_MARKET )
const override;
183 virtual MPI_Comm
comm()
const override;
190 using Vec =
struct _p_Vec *;
This class creates and provides basic support for Vec vector object type used in PETSc.
virtual bool created() const override
Query vector creation status.
virtual void touch() override
Notify the vector about external modification through direct data pointer.
virtual void close() override
Close vector for modification.
const Vec & unwrapped() const
Returns a const pointer to the underlying Vec.
virtual void axpby(real64 const alpha, PetscVector const &x, real64 const beta) override
Update vector y as y = alpha*x + beta*y.
PetscVector(PetscVector &&src) noexcept
Move constructor.
virtual void print(std::ostream &os=std::cout) const override
Print the vector in Trilinos format to the terminal.
PetscVector()
Empty vector constructor.
virtual MPI_Comm comm() const override
Get the communicator used by this vector.
virtual real64 dot(PetscVector const &vec) const override
Dot product with the vector vec.
Vec & unwrapped()
Returns a non-const pointer to the underlying Vec.
PetscVector & operator=(PetscVector &&src) noexcept
Move assignment.
virtual void axpy(real64 const alpha, PetscVector const &x) override
Update vector y as y = alpha*x + y.
virtual void pointwiseProduct(PetscVector const &x, PetscVector &y) const override
Compute the component-wise multiplication y = v * x.
virtual globalIndex globalSize() const override
Returns the global of the vector.
virtual real64 norm1() const override
1-norm of the vector.
virtual void scale(real64 const scalingFactor) override
Multiply all elements by factor.
virtual real64 normInf() const override
Infinity-norm of the vector.
virtual void set(real64 const value) override
Set all elements to a constant value.
virtual void reciprocal() override
Replace vector elements by their reciprocals.
~PetscVector()
Destructor.
virtual globalIndex ilower() const override
Get lower bound of local partition.
virtual void copy(PetscVector const &x) override
Update vector y as y = x.
virtual void write(string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const override
Write the vector to a file.
virtual void create(localIndex const localSize, MPI_Comm const &comm) override
Create a vector based on local number of elements.
virtual globalIndex iupper() const override
Get upper bound of local partition.
PetscVector(PetscVector const &src)
Copy constructor.
virtual void reset() override
Reset the vector to default state.
virtual real64 norm2() const override
2-norm of the vector.
PetscVector & operator=(PetscVector const &src)
Copy assignment.
virtual void rand(unsigned const seed) override
Set vector elements to random entries.
virtual localIndex localSize() const override
Returns the local size of the vector.
Common base template for all vector wrapper types.
bool ready() const
Query vector ready status.
virtual arrayView1d< real64 > open()
Open the vector for modifying entries.
arrayView1d< real64 const > values() const
virtual void zero()
Set vector elements to zero.
bool closed() const
Query vector closed status.
void setName(string const &name)
Set a name for the vector (mainly used during various logging).
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).