19 #ifndef GEOSX_LINEARALGEBRA_INTERFACES_VECTORBASE_HPP_ 20 #define GEOSX_LINEARALGEBRA_INTERFACES_VECTORBASE_HPP_ 23 #include "mpiCommunications/MpiWrapper.hpp" 24 #include "rajaInterface/GEOS_RAJA_Interface.hpp" 46 template<
typename VECTOR >
110 virtual bool created()
const = 0;
164 virtual void open() = 0;
171 virtual void close() = 0;
216 virtual void set(
globalIndex const * globalIndices,
257 virtual void set(
real64 const value ) = 0;
262 virtual void zero() = 0;
268 virtual void rand(
unsigned const seed = 1984 ) = 0;
281 virtual void scale(
real64 const scalingFactor ) = 0;
428 localVector[k] = data[k];
436 virtual MPI_Comm
getComm()
const = 0;
449 virtual void print( std::ostream & os = std::cout )
const = 0;
456 virtual void write(
string const & filename,
479 #endif //GEOSX_LINEARALGEBRA_INTERFACES_VECTORBASE_HPP_ Common base template for all vector wrapper types.
virtual globalIndex ilower() const =0
Get lower bound of local partition.
VectorBase & operator=(VectorBase const &)=default
Copy assignment.
virtual void copy(Vector const &x)=0
Update vector y as y = x.
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).
virtual void createWithGlobalSize(globalIndex const globalSize, MPI_Comm const &comm)=0
Create a vector based on global number of elements.
virtual void print(std::ostream &os=std::cout) const override
Print the vector in Trilinos format to the terminal.
virtual real64 norm2() const =0
2-norm of the vector.
virtual void reciprocal()=0
Replace vector elements by their reciprocals.
This class serves to provide a sliced multidimensional interface to the family of LvArray classes...
virtual real64 const * extractLocalVector() const =0
Extract a view of the local portion of the array.
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.
~VectorBase()=default
Destructor.
virtual localIndex getLocalRowID(globalIndex const globalRow) const =0
Map a global row index to local row index.
virtual globalIndex globalSize() const =0
Returns the global of the vector.
virtual globalIndex getGlobalRowID(localIndex const localRow) const =0
Map a local row index to global row index.
This class serves to provide a "view" of a multidimensional array.
virtual void axpby(real64 const alpha, Vector const &x, real64 const beta)=0
Update vector y as y = alpha*x + beta*y.
double real64
64-bit floating point type.
virtual real64 dot(Vector const &vec) const =0
Dot product with the vector vec.
virtual void open()=0
Open the vector for modifying entries.
virtual void add(globalIndex const globalRow, real64 const value)=0
Add into vector value.
virtual localIndex localSize() const =0
Returns the local size of the vector.
virtual void scale(real64 const scalingFactor)=0
Multiply all elements by scalingFactor.
virtual real64 normInf() const =0
Infinity-norm of the vector.
virtual void axpy(real64 const alpha, Vector const &x)=0
Update vector y as y = alpha*x + y.
virtual void createWithLocalSize(localIndex const localSize, MPI_Comm const &comm)=0
Create a vector based on local number of elements.
bool m_closed
Flag indicating whether the vector is closed.
virtual void pointwiseProduct(Vector const &x, Vector &y) const =0
Compute the componentwise multiplication y = v * x.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
VectorBase()
Constructs a vector in default state.
virtual void print(std::ostream &os=std::cout) const =0
Print the vector in Trilinos format to the terminal.
virtual globalIndex iupper() const =0
Get upper bound of local partition.
virtual void create(arrayView1d< real64 const > const &localValues, MPI_Comm const &comm)=0
Construct parallel vector from a local array.
virtual void zero()=0
Set vector elements to zero.
virtual void rand(unsigned const seed=1984)=0
Set vector elements to random entries.
virtual void reset()
Reset the matrix to default state.
virtual void write(string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const =0
Write the vector to a file.
This class creates and provides basic support for the Epetra_FEVector vector object type used in Tril...
virtual MPI_Comm getComm() const =0
Get the communicator used by this vector.
virtual void close()=0
Assemble vector.
virtual real64 norm1() const =0
1-norm of the vector.
friend std::ostream & operator<<(std::ostream &os, Vector const &vec)
Stream insertion operator for all vector types.
bool ready() const
Query vector ready status.
virtual bool created() const =0
Query vector creation status.