20 #ifndef GEOS_LINEARALGEBRA_INTERFACES_VECTORBASE_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_VECTORBASE_HPP_
25 #include "common/GEOS_RAJA_Interface.hpp"
47 template<
typename VECTOR >
190 virtual void rand(
unsigned const seed ) = 0;
315 virtual MPI_Comm
comm()
const = 0;
328 virtual void print( std::ostream & os = std::cout )
const = 0;
335 virtual void write(
string const & filename,
336 LAIOutputFormat const format = LAIOutputFormat::MATRIX_MARKET )
const = 0;
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Common base template for all vector wrapper types.
virtual void axpy(real64 const alpha, Vector const &x)=0
Update vector y as y = alpha*x + y.
virtual void touch()=0
Notify the vector about external modification through direct data pointer.
virtual void axpby(real64 const alpha, Vector const &x, real64 const beta)=0
Update vector y as y = alpha*x + beta*y.
bool ready() const
Query vector ready status.
virtual void write(string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const =0
Write the vector to a file.
virtual void close()=0
Close vector for modification.
virtual void pointwiseProduct(Vector const &x, Vector &y) const =0
Compute the component-wise multiplication y = v * x.
VECTOR Vector
Alias for VECTOR.
virtual void rand(unsigned const seed)=0
Set vector elements to random entries.
friend std::ostream & operator<<(std::ostream &os, Vector const &vec)
Stream insertion operator for all vector types.
bool m_closed
Flag indicating whether the vector is closed.
virtual bool created() const =0
Query vector creation status.
array1d< real64 > m_values
Actual storage for the local vector values.
virtual void reciprocal()=0
Replace vector elements by their reciprocals.
virtual arrayView1d< real64 > open()
Open the vector for modifying entries.
virtual real64 normInf() const =0
Infinity-norm of the vector.
virtual globalIndex ilower() const =0
Get lower bound of local partition.
virtual void scale(real64 const factor)=0
Multiply all elements by factor.
virtual MPI_Comm comm() const =0
Get the communicator used by this vector.
arrayView1d< real64 const > values() const
virtual globalIndex globalSize() const =0
Returns the global of the vector.
virtual localIndex localSize() const =0
Returns the local size of the vector.
virtual real64 dot(Vector const &vec) const =0
Dot product with the vector vec.
virtual void set(real64 const value)=0
Set all elements to a constant value.
virtual void zero()
Set vector elements to zero.
virtual globalIndex iupper() const =0
Get upper bound of local partition.
virtual real64 norm2() const =0
2-norm of the vector.
virtual real64 norm1() const =0
1-norm of the vector.
virtual void create(localIndex const localSize, MPI_Comm const &comm)
Create a vector based on local number of elements.
virtual void reset()
Reset the vector to default state.
bool closed() const
Query vector closed status.
virtual void print(std::ostream &os=std::cout) const =0
Print the vector in Trilinos format to the terminal.
virtual void copy(Vector const &x)=0
Update vector y as y = x.
void setName(string const &name)
Set a name for the vector (mainly used during various logging).
#define GEOS_LAI_ASSERT_GE(lhs, rhs)
#define GEOS_LAI_ASSERT(expr)
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
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).
Array< T, 1 > array1d
Alias for 1D array.