19 #ifndef GEOSX_LINEARALGEBRA_INTERFACES_PETSCVECTOR_HPP_ 20 #define GEOSX_LINEARALGEBRA_INTERFACES_PETSCVECTOR_HPP_ 33 extern "C" struct _p_Vec;
49 using Vec =
struct _p_Vec *;
106 virtual bool created()
const override;
109 MPI_Comm
const & comm )
override;
112 MPI_Comm
const & comm )
override;
115 MPI_Comm
const & comm )
override;
117 virtual void open()
override;
119 virtual void close()
override;
121 virtual void reset()
override;
124 real64 const value )
override;
127 real64 const value )
override;
129 virtual void set(
globalIndex const * globalIndices,
143 virtual void set(
real64 const value )
override;
145 virtual void zero()
override;
147 virtual void rand(
unsigned const seed = 1984 )
override;
149 virtual void scale(
real64 const scalingFactor )
override;
162 real64 const beta )
override;
207 virtual void print( std::ostream & os = std::cout )
const override;
209 virtual void write(
string const & filename,
229 virtual MPI_Comm
getComm()
const override;
Common base template for all vector wrapper types.
virtual void copy(PetscVector const &x) override
Update vector y as y = x.
virtual real64 dot(PetscVector const &vec) const override
Dot product with the vector vec.
virtual bool created() const override
Query vector creation status.
virtual real64 norm2() const override
2-norm of the vector.
virtual globalIndex ilower() const override
Get lower bound of local partition.
virtual void extract(arrayView1d< real64 > const &localVector) const
Extract local solution by copying into a user-provided array.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
This class serves to provide a sliced multidimensional interface to the family of LvArray classes...
bool closed() const
Query vector closed status.
std::string format(int NDIM, INDEX_TYPE const *const dims)
This function returns a string that may be used as the "type" in a call to TV_ttf_add_row(). This will either be a single value or an array.
virtual void zero() override
Set vector elements to zero.
struct _p_Vec * Vec
Alias for PETSc vector struct pointer.
virtual void close() override
Assemble vector.
This class serves to provide a "view" of a multidimensional array.
PetscVector()
Empty vector constructor.
double real64
64-bit floating point type.
virtual void rand(unsigned const seed=1984) override
Set vector elements to random entries.
virtual void open() override
Open the vector for modifying entries.
This class creates and provides basic support for Vec vector object type used in PETSc.
virtual void reset() override
Reset the matrix to default state.
virtual void add(globalIndex const globalRow, real64 const value) override
Add into vector value.
~PetscVector()
Destructor.
virtual real64 norm1() const override
1-norm of the vector.
virtual void write(string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const override
Write the vector to a file.
virtual void pointwiseProduct(PetscVector const &x, PetscVector &y) const override
Compute the componentwise multiplication y = v * x.
virtual globalIndex globalSize() const override
Returns the global of the vector.
virtual globalIndex iupper() const override
Get upper bound of local partition.
virtual void createWithGlobalSize(globalIndex const globalSize, MPI_Comm const &comm) override
Create a vector based on global number of elements.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
virtual globalIndex getGlobalRowID(localIndex const localRow) const override
Map a local row index to global row index.
virtual localIndex getLocalRowID(globalIndex const globalRow) const override
Map a global row index to local row index.
virtual localIndex localSize() const override
Returns the local size of the vector.
PetscVector & operator=(PetscVector const &src)
Copy assignment.
virtual void scale(real64 const scalingFactor) override
Multiply all elements by scalingFactor.
virtual real64 normInf() const override
Infinity-norm of the vector.
virtual void create(arrayView1d< real64 const > const &localValues, MPI_Comm const &comm) override
Construct parallel vector from a local array.
virtual void axpy(real64 const alpha, PetscVector const &x) override
Update vector y as y = alpha*x + y.
virtual MPI_Comm getComm() const override
Get the communicator used by this vector.
virtual void createWithLocalSize(localIndex const localSize, MPI_Comm const &comm) override
Create a vector based on local number of elements.
virtual real64 const * extractLocalVector() const override
Extract a view of the local portion of the array.
const Vec & unwrapped() const
Returns a const pointer to the underlying Vec.
virtual void print(std::ostream &os=std::cout) const override
Print the vector in Trilinos format to the terminal.
virtual void reciprocal() override
Replace vector elements by their reciprocals.
bool ready() const
Query vector ready status.
virtual void axpby(real64 const alpha, PetscVector const &x, real64 const beta) override
Update vector y as y = alpha*x + beta*y.