IFEM  90A354
Public Member Functions | Private Attributes | List of all members
PETScVectors Class Reference

Class for representing a set of system vectors in PETSc format. More...

#include <PETScMatrix.h>

Inheritance diagram for PETScVectors:
Inheritance graph
[legend]
Collaboration diagram for PETScVectors:
Collaboration graph
[legend]

Public Member Functions

 PETScVectors (const PETScMatrix &A, int nvec)
 Constructor creating a set of system vectors. More...
 
 ~PETScVectors ()
 Destructor frees up the dynamically allocated vectors.
 
LinAlg::MatrixType getType () const override
 Returns the vector type.
 
SystemVectorcopy () const override
 Creates a copy of the system vector and returns a pointer to it.
 
size_t dim () const override
 Returns the dimension of the system vector.
 
void redim (size_t) override
 Sets the dimension of the system vector.
 
RealgetPtr () override
 Access through pointer.
 
const RealgetRef () const override
 Reference through pointer.
 
const Vectorvec () const override
 Reference to underlying utl::vector.
 
void init (Real) override
 Initializes the vector to a given scalar value.
 
void mult (Real) override
 Multiplication with a scalar.
 
void add (const SystemVector &, Real) override
 Addition of another system vector to this one.
 
Real L1norm () const override
 L1-norm of the vector.
 
Real L2norm () const override
 L2-norm of the vector.
 
Real Linfnorm () const override
 Linfinity-norm of the vector.
 
void assemble (const Vectors &vecs, const IntVec &meqn, int=0) override
 Adds element vectors into the system vector. More...
 
Vec get (size_t idx)
 Returns a particular vector. More...
 
size_t size () const
 Returns number of vectors.
 
- Public Member Functions inherited from SystemVector
virtual ~SystemVector ()
 Empty destructor.
 
virtual void resize (size_t n, bool=false)
 Resizes the vector to length n.
 
bool empty () const
 Checks if the vector is empty.
 
SystemVectorcopy (const SystemVector &x)
 Copies entries from input vector x into *this.
 
virtual bool endAssembly ()
 Finalizes the system vector assembly.
 
virtual void dump (std::ostream &, LinAlg::StorageFormat, const char *=nullptr) const
 Dumps the system vector on a specified format.
 

Private Attributes

size_t myDim
 Global dimension of vectors.
 
std::vector< Vec > vectors
 Array of vectors.
 
const PETScMatrixmyA
 Reference to matrix vectors are associated with.
 

Additional Inherited Members

- Static Public Member Functions inherited from SystemVector
static SystemVectorcreate (const ProcessAdm *adm, LinAlg::MatrixType vtype)
 Static method creating a vector of the given type.
 
- Protected Member Functions inherited from SystemVector
 SystemVector ()
 The default constructor is protected to allow sub-classes only.
 
virtual std::ostream & write (std::ostream &os) const
 Writes the system vector to the given output stream.
 

Detailed Description

Class for representing a set of system vectors in PETSc format.

Used for solving systems with multiple RHS vectors.

Constructor & Destructor Documentation

◆ PETScVectors()

PETScVectors::PETScVectors ( const PETScMatrix A,
int  nvec 
)

Constructor creating a set of system vectors.

Parameters
AMatrix with vector layout to use
nvecNumber of RHS vectors

References PETScMatrix::getMatrix(), myDim, size(), and vectors.

Member Function Documentation

◆ assemble()

void PETScVectors::assemble ( const Vectors vecs,
const IntVec meqn,
int  = 0 
)
overridevirtual

Adds element vectors into the system vector.

Parameters
[in]vecsThe element vectors
[in]meqnMatrix of element equation numbers (0 based)

Implements SystemVector.

References PETScMatrix::getDD(), DomainDecomposition::getGlobalEq(), myA, and vectors.

◆ get()

Vec PETScVectors::get ( size_t  idx)
inline

Returns a particular vector.

Parameters
idxIndex of vector to return

References vectors.

Referenced by PETScMatrix::solveMultipleRhs().


The documentation for this class was generated from the following files: