DOLFIN
DOLFIN C++ interface
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
dolfin::TpetraVector Class Reference

#include <TpetraVector.h>

Inheritance diagram for dolfin::TpetraVector:
Inheritance graph
[legend]
Collaboration diagram for dolfin::TpetraVector:
Collaboration graph
[legend]

Public Types

typedef Tpetra::MultiVector ::node_type node_type
 Node type.
 
typedef Tpetra::Map< int, dolfin::la_index, node_typemap_type
 TpetraVector map type (local index, global index)
 
typedef Tpetra::MultiVector< double, int, dolfin::la_index, node_typevector_type
 TpetraVector vector type (scalar, local index, global index, node)
 

Public Member Functions

 TpetraVector (MPI_Comm comm=MPI_COMM_WORLD)
 Create empty vector.
 
 TpetraVector (MPI_Comm comm, std::size_t N)
 Create vector of size N.
 
 TpetraVector (const TpetraVector &x)
 Copy constructor.
 
virtual ~TpetraVector ()
 Create vector wrapper of Tpetra Vec pointer. More...
 
virtual void zero ()
 Set all entries to zero and keep any sparse structure.
 
virtual void apply (std::string mode)
 Finalize assembly of tensor.
 
virtual MPI_Comm mpi_comm () const
 Return MPI communicator.
 
virtual std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 
virtual std::shared_ptr< GenericVectorcopy () const
 Return copy of vector.
 
virtual void init (std::size_t N)
 Initialize vector to global size N.
 
virtual void init (std::pair< std::size_t, std::size_t > range)
 Initialize vector with given ownership range.
 
virtual void init (std::pair< std::size_t, std::size_t > range, const std::vector< std::size_t > &local_to_global_map, const std::vector< la_index > &ghost_indices)
 
virtual bool empty () const
 Return true if vector is empty.
 
virtual std::size_t size () const
 Return size of vector.
 
virtual std::size_t local_size () const
 Return local size of vector.
 
virtual std::pair< std::int64_t, std::int64_t > local_range () const
 Return ownership range of a vector.
 
virtual bool owns_index (std::size_t i) const
 Determine whether global vector index is owned by this process.
 
virtual void get (double *block, std::size_t m, const dolfin::la_index *rows) const
 
virtual void get_local (double *block, std::size_t m, const dolfin::la_index *rows) const
 Get block of values using local indices.
 
virtual void set (const double *block, std::size_t m, const dolfin::la_index *rows)
 Set block of values using global indices.
 
virtual void set_local (const double *block, std::size_t m, const dolfin::la_index *rows)
 Set block of values using local indices.
 
virtual void add (const double *block, std::size_t m, const dolfin::la_index *rows)
 Add block of values using global indices.
 
virtual void add_local (const double *block, std::size_t m, const dolfin::la_index *rows)
 Add block of values using local indices.
 
virtual void get_local (std::vector< double > &values) const
 Get all values on local process.
 
virtual void set_local (const std::vector< double > &values)
 Set all values on local process.
 
virtual void add_local (const Array< double > &values)
 Add values to each entry on local process.
 
virtual void gather (GenericVector &y, const std::vector< dolfin::la_index > &indices) const
 
virtual void gather (std::vector< double > &x, const std::vector< dolfin::la_index > &indices) const
 
virtual void gather_on_zero (std::vector< double > &x) const
 
virtual void axpy (double a, const GenericVector &x)
 Add multiple of given vector (AXPY operation)
 
virtual void abs ()
 Replace all entries in the vector by their absolute values.
 
virtual double inner (const GenericVector &v) const
 Return inner product with given vector.
 
virtual double norm (std::string norm_type) const
 Return norm of vector.
 
virtual double min () const
 Return minimum value of vector.
 
virtual double max () const
 Return maximum value of vector.
 
virtual double sum () const
 Return sum of values of vector.
 
virtual double sum (const Array< std::size_t > &rows) const
 Return sum of selected rows in vector.
 
virtual const TpetraVectoroperator*= (double a)
 Multiply vector by given number.
 
virtual const TpetraVectoroperator*= (const GenericVector &x)
 Multiply vector by another vector pointwise.
 
virtual const TpetraVectoroperator/= (double a)
 Divide vector by given number.
 
virtual const TpetraVectoroperator+= (const GenericVector &x)
 Add given vector.
 
virtual const TpetraVectoroperator+= (double a)
 Add number to all components of a vector.
 
virtual const TpetraVectoroperator-= (const GenericVector &x)
 Subtract given vector.
 
virtual const TpetraVectoroperator-= (double a)
 Subtract number from all components of a vector.
 
virtual const GenericVectoroperator= (const GenericVector &x)
 Assignment operator.
 
virtual const TpetraVectoroperator= (double a)
 Assignment operator.
 
virtual void update_ghost_values ()
 Update ghost values in vector.
 
virtual GenericLinearAlgebraFactoryfactory () const
 Return linear algebra backend factory.
 
Teuchos::RCP< vector_typevec () const
 Return pointer to Tpetra vector object.
 
const TpetraVectoroperator= (const TpetraVector &x)
 Assignment operator.
 
void mapdump (const std::string desc)
 Dump x.map and ghost_map for debugging.
 
- Public Member Functions inherited from dolfin::GenericVector
virtual ~GenericVector ()
 Destructor.
 
virtual void init (const TensorLayout &tensor_layout)
 
virtual std::size_t rank () const
 Return tensor rank (number of dimensions)
 
virtual std::size_t size (std::size_t dim) const
 Return size of given dimension.
 
virtual std::pair< std::int64_t, std::int64_t > local_range (std::size_t dim) const
 Return local ownership range.
 
virtual void get (double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const
 Get block of values using global indices.
 
virtual void get_local (double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const
 Get block of values using local indices.
 
virtual void set (const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)
 Set block of values using global indices.
 
virtual void set_local (const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)
 Set block of values using local indices.
 
virtual void add (const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)
 Add block of values using global indices.
 
virtual void add_local (const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)
 Add block of values using local indices.
 
virtual void add (const double *block, const std::vector< ArrayView< const dolfin::la_index >> &rows)
 Add block of values using global indices.
 
virtual void add_local (const double *block, const std::vector< ArrayView< const dolfin::la_index >> &rows)
 Add block of values using local indices.
 
std::shared_ptr< GenericVectoroperator+ (const GenericVector &x)
 Sum two vectors (returns a new vector)
 
std::shared_ptr< GenericVectoroperator+ (double a)
 Add scalar to a vector (returns a new vector)
 
std::shared_ptr< GenericVectoroperator* (double a)
 Multiply vector by a scalar (returns a new vector)
 
virtual double operator[] (dolfin::la_index i) const
 Get value of given entry.
 
virtual double getitem (dolfin::la_index i) const
 Get value of given entry.
 
virtual void setitem (dolfin::la_index i, double value)
 
- Public Member Functions inherited from dolfin::GenericTensor
virtual ~GenericTensor ()
 Destructor.
 
- Public Member Functions inherited from dolfin::LinearAlgebraObject
virtual const LinearAlgebraObjectinstance () const
 Return concrete instance / unwrap (const version)
 
virtual LinearAlgebraObjectinstance ()
 Return concrete instance / unwrap (non-const version)
 
virtual std::shared_ptr< const LinearAlgebraObjectshared_instance () const
 Return concrete shared ptr instance / unwrap (const version)
 
virtual std::shared_ptr< LinearAlgebraObjectshared_instance ()
 Return concrete shared ptr instance / unwrap (non-const version)
 
- Public Member Functions inherited from dolfin::Variable
 Variable ()
 Create unnamed variable.
 
 Variable (const std::string name, const std::string label)
 Create variable with given name and label.
 
 Variable (const Variable &variable)
 Copy constructor.
 
virtual ~Variable ()
 Destructor.
 
const Variableoperator= (const Variable &variable)
 Assignment operator.
 
void rename (const std::string name, const std::string label)
 Rename variable.
 
std::string name () const
 Return name.
 
std::string label () const
 Return label (description)
 
std::size_t id () const
 

Static Public Member Functions

static void mapdump (Teuchos::RCP< const map_type > xmap, const std::string desc)
 output map for debugging
 

Friends

class TpetraMatrix
 

Additional Inherited Members

- Public Attributes inherited from dolfin::Variable
Parameters parameters
 Parameters.
 

Detailed Description

This class provides a simple vector class based on Tpetra. It is a wrapper for Teuchos::RCP<Tpetra::MultiVector> implementing the GenericVector interface.

The interface is intentionally simple. For advanced usage, access the Teuchos::RCP<Tpetra::MultiVector> using the function vec() and use the standard Tpetra interface.

Constructor & Destructor Documentation

◆ ~TpetraVector()

TpetraVector::~TpetraVector ( )
virtual

Create vector wrapper of Tpetra Vec pointer.

Destructor

Member Function Documentation

◆ gather() [1/2]

void TpetraVector::gather ( GenericVector y,
const std::vector< dolfin::la_index > &  indices 
) const
virtual

Gather entries (given by global indices) into local (MPI_COMM_SELF) vector x. Provided x must be empty or of correct dimension (same as provided indices). This operation is collective

Implements dolfin::GenericVector.

◆ gather() [2/2]

void TpetraVector::gather ( std::vector< double > &  x,
const std::vector< dolfin::la_index > &  indices 
) const
virtual

Gather entries (given by global indices) into x. This operation is collective

Implements dolfin::GenericVector.

◆ gather_on_zero()

void TpetraVector::gather_on_zero ( std::vector< double > &  x) const
virtual

Gather all entries into x on process 0. This operation is collective

Implements dolfin::GenericVector.

◆ get()

void TpetraVector::get ( double *  block,
std::size_t  m,
const dolfin::la_index rows 
) const
virtual

Get block of values using global indices (all values must be owned by local process, ghosts cannot be accessed)

Implements dolfin::GenericVector.

◆ init()

void TpetraVector::init ( std::pair< std::size_t, std::size_t >  range,
const std::vector< std::size_t > &  local_to_global_map,
const std::vector< la_index > &  ghost_indices 
)
virtual

Initialize vector with given ownership range and with ghost values

Implements dolfin::GenericVector.


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