libMesh
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
libMesh::EpetraVector< T > Class Template Referencefinal

This class provides a nice interface to the Trilinos Epetra_Vector object. More...

#include <trilinos_epetra_vector.h>

Inheritance diagram for libMesh::EpetraVector< T >:
[legend]

Public Member Functions

 EpetraVector (const Parallel::Communicator &comm, const ParallelType type=AUTOMATIC)
 Dummy-Constructor. More...
 
 EpetraVector (const Parallel::Communicator &comm, const numeric_index_type n, const ParallelType type=AUTOMATIC)
 Constructor. More...
 
 EpetraVector (const Parallel::Communicator &comm, const numeric_index_type n, const numeric_index_type n_local, const ParallelType type=AUTOMATIC)
 Constructor. More...
 
 EpetraVector (const Parallel::Communicator &comm, const numeric_index_type N, const numeric_index_type n_local, const std::vector< numeric_index_type > &ghost, const ParallelType type=AUTOMATIC)
 Constructor. More...
 
 EpetraVector (Epetra_Vector &v, const Parallel::Communicator &comm)
 Constructor. More...
 
 EpetraVector (EpetraVector &&)=delete
 This class manages the lifetime of an Epetra_Vector manually, so we don't want to allow any automatic copy/move functions to be generated, and we can't default the destructor. More...
 
 EpetraVector (const EpetraVector &)=delete
 
EpetraVectoroperator= (const EpetraVector &)=delete
 
EpetraVectoroperator= (EpetraVector &&)=delete
 
virtual ~EpetraVector ()
 
virtual void close () override
 Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across processors. More...
 
virtual void clear () override
 Restores the NumericVector<T> to a pristine state. More...
 
virtual void zero () override
 Set all entries to zero. More...
 
virtual std::unique_ptr< NumericVector< T > > zero_clone () const override
 
virtual std::unique_ptr< NumericVector< T > > clone () const override
 
virtual void init (const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
 Change the dimension of the vector to N. More...
 
virtual void init (const numeric_index_type N, const bool fast=false, const ParallelType type=AUTOMATIC) override
 Call init() with n_local = N. More...
 
virtual void init (const numeric_index_type N, const numeric_index_type n_local, const std::vector< numeric_index_type > &ghost, const bool fast=false, const ParallelType=AUTOMATIC) override
 Create a vector that holds tha local indices plus those specified in the ghost argument. More...
 
virtual void init (const NumericVector< T > &other, const bool fast=false) override
 Creates a vector that has the same dimension and storage type as other, including ghost dofs. More...
 
virtual NumericVector< T > & operator= (const T s) override
 Sets all entries of the vector to the value s. More...
 
virtual NumericVector< T > & operator= (const NumericVector< T > &v) override
 This looks like a copy assignment operator, but note that, unlike normal copy assignment operators, it is pure virtual. More...
 
virtual NumericVector< T > & operator= (const std::vector< T > &v) override
 Sets (*this)(i) = v(i) for each entry of the vector. More...
 
virtual Real min () const override
 
virtual Real max () const override
 
virtual T sum () const override
 
virtual Real l1_norm () const override
 
virtual Real l2_norm () const override
 
virtual Real linfty_norm () const override
 
virtual numeric_index_type size () const override
 
virtual numeric_index_type local_size () const override
 
virtual numeric_index_type first_local_index () const override
 
virtual numeric_index_type last_local_index () const override
 
virtual T operator() (const numeric_index_type i) const override
 
virtual NumericVector< T > & operator+= (const NumericVector< T > &v) override
 Adds v to *this, $ \vec{u} \leftarrow \vec{u} + \vec{v} $. More...
 
virtual NumericVector< T > & operator-= (const NumericVector< T > &v) override
 Subtracts v from *this, $ \vec{u} \leftarrow \vec{u} - \vec{v} $. More...
 
virtual NumericVector< T > & operator/= (const NumericVector< T > &v) override
 Computes the pointwise division of this vector's entries by another's, $ u_i \leftarrow \frac{u_i}{v_i} \, \forall i$. More...
 
virtual void reciprocal () override
 Computes the pointwise reciprocal, $ u_i \leftarrow \frac{1}{u_i} \, \forall i$. More...
 
virtual void conjugate () override
 Negates the imaginary component of each entry in the vector. More...
 
virtual void set (const numeric_index_type i, const T value) override
 Sets v(i) = value. More...
 
virtual void add (const numeric_index_type i, const T value) override
 Adds value to each entry of the vector. More...
 
virtual void add (const T s) override
 Adds s to each entry of the vector, $ u_i \leftarrow u_i + s $. More...
 
virtual void add (const NumericVector< T > &v) override
 Adds v to this, $ \vec{u} \leftarrow \vec{u} + \vec{v} $. More...
 
virtual void add (const T a, const NumericVector< T > &v) override
 Vector addition with a scalar multiple, $ \vec{u} \leftarrow \vec{u} + a\vec{v} $. More...
 
virtual void add_vector (const T *v, const std::vector< numeric_index_type > &dof_indices) override
 Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a pointer and each dof_indices[i] specifies where to add value v[i]. More...
 
virtual void add_vector (const NumericVector< T > &v, const SparseMatrix< T > &A) override
 Computes $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, i.e. More...
 
virtual void add_vector_transpose (const NumericVector< T > &v, const SparseMatrix< T > &A) override
 Computes $ \vec{u} \leftarrow \vec{u} + A^T \vec{v} $, i.e. More...
 
virtual void insert (const T *v, const std::vector< numeric_index_type > &dof_indices) override
 Inserts the entries of v in *this at the locations specified by v. More...
 
virtual void scale (const T factor) override
 Scale each element of the vector by the given factor. More...
 
virtual void abs () override
 Sets $ u_i \leftarrow |u_i| $ for each entry in the vector. More...
 
virtual T dot (const NumericVector< T > &v) const override
 
virtual void localize (std::vector< T > &v_local) const override
 Creates a copy of the global vector in the local vector v_local. More...
 
virtual void localize (NumericVector< T > &v_local) const override
 Same, but fills a NumericVector<T> instead of a std::vector. More...
 
virtual void localize (NumericVector< T > &v_local, const std::vector< numeric_index_type > &send_list) const override
 Creates a local vector v_local containing only information relevant to this processor, as defined by the send_list. More...
 
virtual void localize (std::vector< T > &v_local, const std::vector< numeric_index_type > &indices) const override
 
Fill in the local std::vector "v_local" with the global indices given in "indices". More...
 
virtual void localize (const numeric_index_type first_local_idx, const numeric_index_type last_local_idx, const std::vector< numeric_index_type > &send_list) override
 Updates a local vector with selected values from neighboring processors, as defined by send_list. More...
 
virtual void localize_to_one (std::vector< T > &v_local, const processor_id_type proc_id=0) const override
 Creates a local copy of the global vector in v_local only on processor proc_id. More...
 
virtual void pointwise_mult (const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
 Computes $ u_i \leftarrow u_i v_i $ (summation not implied) i.e. More...
 
virtual void create_subvector (NumericVector< T > &subvector, const std::vector< numeric_index_type > &rows) const override
 Fills in subvector from this vector using the indices in rows. More...
 
virtual void swap (NumericVector< T > &v) override
 Swaps the contents of this with v. More...
 
Epetra_Vector * vec ()
 
virtual bool initialized () const
 
ParallelType type () const
 
ParallelTypetype ()
 
virtual bool closed () const
 
virtual Real subset_l1_norm (const std::set< numeric_index_type > &indices) const
 
virtual Real subset_l2_norm (const std::set< numeric_index_type > &indices) const
 
virtual Real subset_linfty_norm (const std::set< numeric_index_type > &indices) const
 
virtual T el (const numeric_index_type i) const
 
virtual void get (const std::vector< numeric_index_type > &index, T *values) const
 Access multiple components at once. More...
 
void get (const std::vector< numeric_index_type > &index, std::vector< T > &values) const
 Access multiple components at once. More...
 
NumericVector< T > & operator*= (const T a)
 Scales the vector by a, $ \vec{u} \leftarrow a\vec{u} $. More...
 
NumericVector< T > & operator/= (const T a)
 Scales the vector by 1/a, $ \vec{u} \leftarrow \frac{1}{a}\vec{u} $. More...
 
void add_vector (const std::vector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a std::vector and each dof_indices[i] specifies where to add value v[i]. More...
 
virtual void add_vector (const NumericVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a NumericVector and each dof_indices[i] specifies where to add value v(i). More...
 
void add_vector (const DenseVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a DenseVector and each dof_indices[i] specifies where to add value v(i). More...
 
void add_vector (const NumericVector< T > &v, const ShellMatrix< T > &A)
 Computes $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, i.e. More...
 
void insert (const std::vector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 Inserts the entries of v in *this at the locations specified by v. More...
 
virtual void insert (const NumericVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 Inserts the entries of v in *this at the locations specified by v. More...
 
void insert (const DenseVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 Inserts the entries of v in *this at the locations specified by v. More...
 
void insert (const DenseSubVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 Inserts the entries of v in *this at the locations specified by v. More...
 
virtual int compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
 
virtual int local_relative_compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
 
virtual int global_relative_compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
 
virtual void print (std::ostream &os=libMesh::out) const
 Prints the local contents of the vector, by default to libMesh::out. More...
 
template<>
void print (std::ostream &os) const
 
virtual void print_global (std::ostream &os=libMesh::out) const
 Prints the global contents of the vector, by default to libMesh::out. More...
 
template<>
void print_global (std::ostream &os) const
 
virtual void print_matlab (const std::string &="") const
 Print the contents of the vector in Matlab's sparse matrix format. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static std::unique_ptr< NumericVector< T > > build (const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
 Builds a NumericVector on the processors in communicator comm using the linear solver package specified by solver_package. More...
 
static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

void increment_constructor_count (const std::string &name)
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name)
 Increments the destruction counter. More...
 

Protected Attributes

bool _is_closed
 Flag which tracks whether the vector's values are consistent on all processors after insertion or addition of values has occurred on some or all processors. More...
 
bool _is_initialized
 true once init() has been called. More...
 
ParallelType _type
 Type of vector. More...
 
const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int > _n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Member Functions

int SumIntoGlobalValues (int numIDs, const int *GIDs, const double *values)
 Accumulate values into the vector, adding them to any values that already exist for the specified indices. More...
 
int SumIntoGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values)
 Accumulate values into the vector, adding them to any values that already exist for the specified GIDs. More...
 
int ReplaceGlobalValues (int numIDs, const int *GIDs, const double *values)
 Copy values into the vector overwriting any values that already exist for the specified indices. More...
 
int ReplaceGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values)
 Copy values into the vector, replacing any values that already exist for the specified GIDs. More...
 
int SumIntoGlobalValues (int numIDs, const int *GIDs, const int *numValuesPerID, const double *values)
 
int ReplaceGlobalValues (int numIDs, const int *GIDs, const int *numValuesPerID, const double *values)
 
int GlobalAssemble (Epetra_CombineMode mode=Add)
 Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was passed to this vector at construction time. More...
 
void setIgnoreNonLocalEntries (bool flag)
 Set whether or not non-local data values should be ignored. More...
 
void FEoperatorequals (const EpetraVector &source)
 
int inputValues (int numIDs, const int *GIDs, const double *values, bool accumulate)
 
int inputValues (int numIDs, const int *GIDs, const int *numValuesPerID, const double *values, bool accumulate)
 
int inputNonlocalValue (int GID, double value, bool accumulate)
 
int inputNonlocalValues (int GID, int numValues, const double *values, bool accumulate)
 
void destroyNonlocalData ()
 

Private Attributes

Epetra_Vector * _vec
 Actual Epetra vector datatype to hold vector entries. More...
 
std::unique_ptr< Epetra_Map > _map
 Holds the distributed Map. More...
 
bool _destroy_vec_on_exit
 This boolean value should only be set to false for the constructor which takes a Epetra Vec object. More...
 
int myFirstID_
 
int myNumIDs_
 
double * myCoefs_
 
int * nonlocalIDs_
 
int * nonlocalElementSize_
 
int numNonlocalIDs_
 
int allocatedNonlocalLength_
 
double ** nonlocalCoefs_
 
unsigned char last_edit
 Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add (2), so we can decide how to do the GlobalAssemble() More...
 
bool ignoreNonLocalEntries_
 

Detailed Description

template<typename T>
class libMesh::EpetraVector< T >

This class provides a nice interface to the Trilinos Epetra_Vector object.

All overridden virtual functions are documented in numeric_vector.h.

Author
Derek R. Gaston
Date
2008

Definition at line 62 of file trilinos_epetra_vector.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 117 of file reference_counter.h.

Constructor & Destructor Documentation

◆ EpetraVector() [1/7]

template<typename T >
libMesh::EpetraVector< T >::EpetraVector ( const Parallel::Communicator comm,
const ParallelType  type = AUTOMATIC 
)
explicit

Dummy-Constructor.

Dimension=0

Definition at line 406 of file trilinos_epetra_vector.h.

References libMesh::NumericVector< T >::_type, and libMesh::NumericVector< T >::type().

407  :
408  NumericVector<T>(comm, type),
409  _destroy_vec_on_exit(true),
410  myFirstID_(0),
411  myNumIDs_(0),
412  myCoefs_(nullptr),
413  nonlocalIDs_(nullptr),
414  nonlocalElementSize_(nullptr),
415  numNonlocalIDs_(0),
417  nonlocalCoefs_(nullptr),
418  last_edit(0),
420 {
421  this->_type = type;
422 }
const Parallel::Communicator & comm() const
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
ParallelType _type
Type of vector.
ParallelType type() const

◆ EpetraVector() [2/7]

template<typename T >
libMesh::EpetraVector< T >::EpetraVector ( const Parallel::Communicator comm,
const numeric_index_type  n,
const ParallelType  type = AUTOMATIC 
)
explicit

Constructor.

Set dimension to n and initialize all elements with zero.

Definition at line 428 of file trilinos_epetra_vector.h.

References libMesh::EpetraVector< T >::init(), and libMesh::NumericVector< T >::type().

430  :
431  NumericVector<T>(comm, type),
432  _destroy_vec_on_exit(true),
433  myFirstID_(0),
434  myNumIDs_(0),
435  myCoefs_(nullptr),
436  nonlocalIDs_(nullptr),
437  nonlocalElementSize_(nullptr),
438  numNonlocalIDs_(0),
440  nonlocalCoefs_(nullptr),
441  last_edit(0),
443 
444 {
445  this->init(n, n, false, type);
446 }
const Parallel::Communicator & comm() const
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
Change the dimension of the vector to N.
ParallelType type() const

◆ EpetraVector() [3/7]

template<typename T >
libMesh::EpetraVector< T >::EpetraVector ( const Parallel::Communicator comm,
const numeric_index_type  n,
const numeric_index_type  n_local,
const ParallelType  type = AUTOMATIC 
)

Constructor.

Set local dimension to n_local, the global dimension to n, and initialize all elements with zero.

Definition at line 452 of file trilinos_epetra_vector.h.

References libMesh::EpetraVector< T >::init(), and libMesh::NumericVector< T >::type().

455  :
456  NumericVector<T>(comm, type),
457  _destroy_vec_on_exit(true),
458  myFirstID_(0),
459  myNumIDs_(0),
460  myCoefs_(nullptr),
461  nonlocalIDs_(nullptr),
462  nonlocalElementSize_(nullptr),
463  numNonlocalIDs_(0),
465  nonlocalCoefs_(nullptr),
466  last_edit(0),
468 {
469  this->init(n, n_local, false, type);
470 }
const Parallel::Communicator & comm() const
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
Change the dimension of the vector to N.
ParallelType type() const

◆ EpetraVector() [4/7]

template<typename T >
libMesh::EpetraVector< T >::EpetraVector ( const Parallel::Communicator comm,
const numeric_index_type  N,
const numeric_index_type  n_local,
const std::vector< numeric_index_type > &  ghost,
const ParallelType  type = AUTOMATIC 
)

Constructor.

Set local dimension to n_local, the global dimension to n, but additionally reserve memory for the indices specified by the ghost argument.

Definition at line 517 of file trilinos_epetra_vector.h.

References libMesh::EpetraVector< T >::init(), and libMesh::NumericVector< T >::type().

521  :
522  NumericVector<T>(comm, AUTOMATIC),
523  _destroy_vec_on_exit(true),
524  myFirstID_(0),
525  myNumIDs_(0),
526  myCoefs_(nullptr),
527  nonlocalIDs_(nullptr),
528  nonlocalElementSize_(nullptr),
529  numNonlocalIDs_(0),
531  nonlocalCoefs_(nullptr),
532  last_edit(0),
534 {
535  this->init(n, n_local, ghost, false, type);
536 }
const Parallel::Communicator & comm() const
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
Change the dimension of the vector to N.
ParallelType type() const

◆ EpetraVector() [5/7]

template<typename T >
libMesh::EpetraVector< T >::EpetraVector ( Epetra_Vector &  v,
const Parallel::Communicator comm 
)

Constructor.

Creates a EpetraVector assuming you already have a valid Epetra Vec object. In this case, v is NOT destroyed by the EpetraVector constructor when this object goes out of scope. This allows ownership of v to remain with the original creator, and to simply provide additional functionality with the EpetraVector.

Definition at line 477 of file trilinos_epetra_vector.h.

References libMesh::NumericVector< T >::_is_closed, libMesh::NumericVector< T >::_is_initialized, libMesh::EpetraVector< T >::_map, libMesh::NumericVector< T >::_type, libMesh::EpetraVector< T >::_vec, libMesh::ParallelObject::comm(), libMesh::EpetraVector< T >::myCoefs_, libMesh::EpetraVector< T >::myFirstID_, libMesh::EpetraVector< T >::myNumIDs_, and libMesh::PARALLEL.

478  :
479  NumericVector<T>(comm, AUTOMATIC),
480  _destroy_vec_on_exit(false),
481  myFirstID_(0),
482  myNumIDs_(0),
483  myCoefs_(nullptr),
484  nonlocalIDs_(nullptr),
485  nonlocalElementSize_(nullptr),
486  numNonlocalIDs_(0),
488  nonlocalCoefs_(nullptr),
489  last_edit(0),
491 {
492  _vec = &v;
493 
494  this->_type = PARALLEL; // FIXME - need to determine this from v!
495 
496  myFirstID_ = _vec->Map().MinMyGID();
497  myNumIDs_ = _vec->Map().NumMyElements();
498 
499  _map.reset(new Epetra_Map(_vec->GlobalLength(),
500  _vec->MyLength(),
501  0, // IndexBase = 0 for C/C++, 1 for Fortran.
502  Epetra_MpiComm (this->comm().get())));
503 
504  //Currently we impose the restriction that NumVectors==1, so we won't
505  //need the LDA argument when calling ExtractView. Hence the "dummy" arg.
506  int dummy;
507  _vec->ExtractView(&myCoefs_, &dummy);
508 
509  this->_is_closed = true;
510  this->_is_initialized = true;
511 }
std::unique_ptr< Epetra_Map > _map
Holds the distributed Map.
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
const Parallel::Communicator & comm() const
bool _is_initialized
true once init() has been called.
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
ParallelType _type
Type of vector.
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...

◆ EpetraVector() [6/7]

template<typename T>
libMesh::EpetraVector< T >::EpetraVector ( EpetraVector< T > &&  )
delete

This class manages the lifetime of an Epetra_Vector manually, so we don't want to allow any automatic copy/move functions to be generated, and we can't default the destructor.

◆ EpetraVector() [7/7]

template<typename T>
libMesh::EpetraVector< T >::EpetraVector ( const EpetraVector< T > &  )
delete

◆ ~EpetraVector()

template<typename T >
libMesh::EpetraVector< T >::~EpetraVector ( )
virtual

Definition at line 553 of file trilinos_epetra_vector.h.

554 {
555  this->clear ();
556 }
virtual void clear() override
Restores the NumericVector<T> to a pristine state.

Member Function Documentation

◆ abs()

template<typename T>
virtual void libMesh::EpetraVector< T >::abs ( )
overridevirtual

Sets $ u_i \leftarrow |u_i| $ for each entry in the vector.

Implements libMesh::NumericVector< T >.

◆ add() [1/4]

template<typename T>
virtual void libMesh::EpetraVector< T >::add ( const numeric_index_type  i,
const T  value 
)
overridevirtual

Adds value to each entry of the vector.

Implements libMesh::NumericVector< T >.

◆ add() [2/4]

template<typename T>
virtual void libMesh::EpetraVector< T >::add ( const T  s)
overridevirtual

Adds s to each entry of the vector, $ u_i \leftarrow u_i + s $.

Implements libMesh::NumericVector< T >.

◆ add() [3/4]

template<typename T>
virtual void libMesh::EpetraVector< T >::add ( const NumericVector< T > &  v)
overridevirtual

Adds v to this, $ \vec{u} \leftarrow \vec{u} + \vec{v} $.

Equivalent to calling operator+=().

Implements libMesh::NumericVector< T >.

◆ add() [4/4]

template<typename T>
virtual void libMesh::EpetraVector< T >::add ( const T  a,
const NumericVector< T > &  v 
)
overridevirtual

Vector addition with a scalar multiple, $ \vec{u} \leftarrow \vec{u} + a\vec{v} $.

Equivalent to calling operator+=().

Implements libMesh::NumericVector< T >.

◆ add_vector() [1/6]

template<typename T>
virtual void libMesh::EpetraVector< T >::add_vector ( const T *  v,
const std::vector< numeric_index_type > &  dof_indices 
)
overridevirtual

Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a pointer and each dof_indices[i] specifies where to add value v[i].

This should be overridden in subclasses for efficiency.

Reimplemented from libMesh::NumericVector< T >.

◆ add_vector() [2/6]

template<typename T>
virtual void libMesh::EpetraVector< T >::add_vector ( const NumericVector< T > &  v,
const SparseMatrix< T > &  A 
)
overridevirtual

Computes $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, i.e.

adds the product of a SparseMatrix A and a NumericVector v to this.

Implements libMesh::NumericVector< T >.

◆ add_vector() [3/6]

template<typename T>
void libMesh::NumericVector< T >::add_vector ( const std::vector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inherited

Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a std::vector and each dof_indices[i] specifies where to add value v[i].

Definition at line 829 of file numeric_vector.h.

831 {
832  libmesh_assert(v.size() == dof_indices.size());
833  if (!v.empty())
834  this->add_vector(&v[0], dof_indices);
835 }
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i]...

◆ add_vector() [4/6]

template<typename T>
virtual void libMesh::NumericVector< T >::add_vector ( const NumericVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
virtualinherited

Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a NumericVector and each dof_indices[i] specifies where to add value v(i).

◆ add_vector() [5/6]

template<typename T>
void libMesh::NumericVector< T >::add_vector ( const DenseVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inherited

Computes $ \vec{u} \leftarrow \vec{u} + \vec{v} $, where v is a DenseVector and each dof_indices[i] specifies where to add value v(i).

Definition at line 841 of file numeric_vector.h.

843 {
844  libmesh_assert(v.size() == dof_indices.size());
845  if (!v.empty())
846  this->add_vector(&v(0), dof_indices);
847 }
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i]...

◆ add_vector() [6/6]

template<typename T>
void libMesh::NumericVector< T >::add_vector ( const NumericVector< T > &  v,
const ShellMatrix< T > &  A 
)
inherited

Computes $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, i.e.

adds the product of a ShellMatrix A and a NumericVector v to this.

◆ add_vector_transpose()

template<typename T>
virtual void libMesh::EpetraVector< T >::add_vector_transpose ( const NumericVector< T > &  v,
const SparseMatrix< T > &  A 
)
overridevirtual

Computes $ \vec{u} \leftarrow \vec{u} + A^T \vec{v} $, i.e.

adds the product of the transpose of a SparseMatrix A and a NumericVector v to this.

Implements libMesh::NumericVector< T >.

◆ build()

template<typename T>
static std::unique_ptr<NumericVector<T> > libMesh::NumericVector< T >::build ( const Parallel::Communicator comm,
const SolverPackage  solver_package = libMesh::default_solver_package() 
)
staticinherited

Builds a NumericVector on the processors in communicator comm using the linear solver package specified by solver_package.

◆ clear()

template<typename T >
void libMesh::EpetraVector< T >::clear ( )
overridevirtual

Restores the NumericVector<T> to a pristine state.

Reimplemented from libMesh::NumericVector< T >.

Definition at line 666 of file trilinos_epetra_vector.h.

References libMesh::initialized().

667 {
668  if (this->initialized())
669  {
670  // We might just be an interface to a user-provided _vec
671  if (this->_destroy_vec_on_exit)
672  {
673  delete _vec;
674  _vec = nullptr;
675  }
676 
677  // But we currently always own our own _map
678  _map.reset();
679  }
680 
681  this->_is_closed = this->_is_initialized = false;
682 }
std::unique_ptr< Epetra_Map > _map
Holds the distributed Map.
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
bool _is_initialized
true once init() has been called.
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...

◆ clone()

template<typename T >
std::unique_ptr< NumericVector< T > > libMesh::EpetraVector< T >::clone ( ) const
overridevirtual
Returns
A copy of this vector wrapped in a smart pointer.
Note
This must be overridden in the derived classes.

Implements libMesh::NumericVector< T >.

Definition at line 711 of file trilinos_epetra_vector.h.

References libMesh::AUTOMATIC, and libMesh::NumericVector< T >::init().

712 {
713  NumericVector<T> * cloned_vector = new EpetraVector<T>(this->comm(), AUTOMATIC);
714  cloned_vector->init(*this, true);
715  *cloned_vector = *this;
716  return std::unique_ptr<NumericVector<T>>(cloned_vector);
717 }
const Parallel::Communicator & comm() const

◆ close()

template<typename T >
void libMesh::EpetraVector< T >::close ( )
overridevirtual

Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across processors.

Implements libMesh::NumericVector< T >.

Definition at line 642 of file trilinos_epetra_vector.h.

References libMesh::initialized().

643 {
644  libmesh_assert (this->initialized());
645 
646  // Are we adding or inserting?
647  unsigned char global_last_edit = last_edit;
648  this->comm().max(global_last_edit);
649  libmesh_assert(!last_edit || last_edit == global_last_edit);
650 
651  if (global_last_edit == 1)
652  this->GlobalAssemble(Insert);
653  else if (global_last_edit == 2)
654  this->GlobalAssemble(Add);
655  else
656  libmesh_assert(!global_last_edit);
657 
658  this->_is_closed = true;
659  this->last_edit = 0;
660 }
void max(T &r) const
Take a local variable and replace it with the maximum of it&#39;s values on all processors.
virtual bool initialized() const
const Parallel::Communicator & comm() const
int GlobalAssemble(Epetra_CombineMode mode=Add)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...

◆ closed()

template<typename T>
virtual bool libMesh::NumericVector< T >::closed ( ) const
virtualinherited
Returns
true if the vector is closed and ready for computation, false otherwise.

Definition at line 159 of file numeric_vector.h.

159 { return _is_closed; }
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited

◆ compare()

template<typename T>
virtual int libMesh::NumericVector< T >::compare ( const NumericVector< T > &  other_vector,
const Real  threshold = TOLERANCE 
) const
virtualinherited
Returns
-1 when this is equivalent to other_vector (up to the given threshold), or the first index where abs(a[i]-b[i]) exceeds the threshold.

◆ conjugate()

template<typename T>
virtual void libMesh::EpetraVector< T >::conjugate ( )
overridevirtual

Negates the imaginary component of each entry in the vector.

Implements libMesh::NumericVector< T >.

◆ create_subvector()

template<typename T>
virtual void libMesh::EpetraVector< T >::create_subvector ( NumericVector< T > &  ,
const std::vector< numeric_index_type > &   
) const
overridevirtual

Fills in subvector from this vector using the indices in rows.

Similar to the create_submatrix() routine for the SparseMatrix class, it is currently only implemented for PetscVectors.

Reimplemented from libMesh::NumericVector< T >.

◆ destroyNonlocalData()

template<typename T>
void libMesh::EpetraVector< T >::destroyNonlocalData ( )
private

◆ disable_print_counter_info()

static void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

◆ dot()

template<typename T>
virtual T libMesh::EpetraVector< T >::dot ( const NumericVector< T > &  v) const
overridevirtual
Returns
$ \vec{u} \cdot \vec{v} $, the dot product of (*this) with the vector v.

Uses the complex-conjugate of v in the complex-valued case.

Implements libMesh::NumericVector< T >.

◆ el()

template<typename T>
virtual T libMesh::NumericVector< T >::el ( const numeric_index_type  i) const
virtualinherited
Returns
(*this)(i).

Definition at line 340 of file numeric_vector.h.

340 { return (*this)(i); }

◆ enable_print_counter_info()

static void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

◆ FEoperatorequals()

template<typename T>
void libMesh::EpetraVector< T >::FEoperatorequals ( const EpetraVector< T > &  source)
private

◆ first_local_index()

template<typename T >
numeric_index_type libMesh::EpetraVector< T >::first_local_index ( ) const
overridevirtual
Returns
The index of the first vector element actually stored on this processor.
Note
The minimum for this index is 0.

Implements libMesh::NumericVector< T >.

Definition at line 743 of file trilinos_epetra_vector.h.

References libMesh::initialized().

744 {
745  libmesh_assert (this->initialized());
746 
747  return _vec->Map().MinMyGID();
748 }
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.

◆ get() [1/2]

template<typename T>
void libMesh::NumericVector< T >::get ( const std::vector< numeric_index_type > &  index,
T *  values 
) const
virtualinherited

Access multiple components at once.

values will not be reallocated; it should already have enough space. The default implementation calls operator() for each index, but some implementations may supply faster methods here.

Reimplemented in libMesh::PetscVector< T >.

Definition at line 800 of file numeric_vector.h.

802 {
803  const std::size_t num = index.size();
804  for (std::size_t i=0; i<num; i++)
805  {
806  values[i] = (*this)(index[i]);
807  }
808 }

◆ get() [2/2]

template<typename T>
void libMesh::NumericVector< T >::get ( const std::vector< numeric_index_type > &  index,
std::vector< T > &  values 
) const
inherited

Access multiple components at once.

values will be resized, if necessary, and filled. The default implementation calls operator() for each index, but some implementations may supply faster methods here.

Definition at line 814 of file numeric_vector.h.

816 {
817  const std::size_t num = index.size();
818  values.resize(num);
819  if (!num)
820  return;
821 
822  this->get(index, &values[0]);
823 }

◆ get_info()

static std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

◆ global_relative_compare()

template<typename T>
virtual int libMesh::NumericVector< T >::global_relative_compare ( const NumericVector< T > &  other_vector,
const Real  threshold = TOLERANCE 
) const
virtualinherited
Returns
-1 when this is equivalent to other_vector (up to the given global relative threshold), or the first index where abs(a[i]-b[i])/max_j(a[j],b[j]) exceeds the threshold.

◆ GlobalAssemble()

template<typename T>
int libMesh::EpetraVector< T >::GlobalAssemble ( Epetra_CombineMode  mode = Add)
private

Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was passed to this vector at construction time.

Data imported from other processors is stored on the owning processor with a "sumInto" or accumulate operation. This is a collective method – every processor must enter it before any will complete it.

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
protectedinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 181 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
protectedinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 194 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ init() [1/4]

template<typename T >
void libMesh::EpetraVector< T >::init ( const numeric_index_type  ,
const numeric_index_type  ,
const bool  = false,
const ParallelType  = AUTOMATIC 
)
overridevirtual

Change the dimension of the vector to N.

The reserved memory for this vector remains unchanged if possible. If N==0, all memory is freed. Therefore, if you want to resize the vector and release the memory not needed, you have to first call init(0) and then init(N). This behaviour is analogous to that of the STL containers.

On fast==false, the vector is filled by zeros.

Implements libMesh::NumericVector< T >.

Definition at line 562 of file trilinos_epetra_vector.h.

References libMesh::AUTOMATIC, libMesh::GHOSTED, libMesh::PARALLEL, libMesh::SERIAL, and libMesh::zero.

Referenced by libMesh::EpetraVector< T >::EpetraVector().

566 {
567  // We default to allocating n_local local storage
568  numeric_index_type my_n_local = n_local;
569 
570  if (type == AUTOMATIC)
571  {
572  if (n == n_local)
573  this->_type = SERIAL;
574  else
575  this->_type = PARALLEL;
576  }
577  else if (type == GHOSTED)
578  {
579  // We don't yet support GHOSTED Epetra vectors, so to get the
580  // same functionality we need a SERIAL vector with local
581  // storage allocated for every entry.
582  this->_type = SERIAL;
583  my_n_local = n;
584  }
585  else
586  this->_type = type;
587 
588  libmesh_assert ((this->_type==SERIAL && n==my_n_local) ||
589  this->_type==PARALLEL);
590 
591  _map.reset(new Epetra_Map(static_cast<int>(n),
592  my_n_local,
593  0,
594  Epetra_MpiComm (this->comm().get())));
595 
596  _vec = new Epetra_Vector(*_map);
597 
598  myFirstID_ = _vec->Map().MinMyGID();
599  myNumIDs_ = _vec->Map().NumMyElements();
600 
601  // Currently we impose the restriction that NumVectors==1, so we won't
602  // need the LDA argument when calling ExtractView. Hence the "dummy" arg.
603  int dummy;
604  _vec->ExtractView(&myCoefs_, &dummy);
605 
606  this->_is_initialized = true;
607  this->_is_closed = true;
608  this->last_edit = 0;
609 
610  if (fast == false)
611  this->zero ();
612 }
std::unique_ptr< Epetra_Map > _map
Holds the distributed Map.
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
const Parallel::Communicator & comm() const
bool _is_initialized
true once init() has been called.
virtual void zero() override
Set all entries to zero.
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
dof_id_type numeric_index_type
Definition: id_types.h:92
ParallelType _type
Type of vector.
ParallelType type() const
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...

◆ init() [2/4]

template<typename T >
void libMesh::EpetraVector< T >::init ( const numeric_index_type  ,
const bool  = false,
const ParallelType  = AUTOMATIC 
)
overridevirtual

Call init() with n_local = N.

Implements libMesh::NumericVector< T >.

Definition at line 631 of file trilinos_epetra_vector.h.

References libMesh::TriangleWrapper::init().

634 {
635  this->init(n,n,fast,type);
636 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
Change the dimension of the vector to N.
ParallelType type() const

◆ init() [3/4]

template<typename T >
void libMesh::EpetraVector< T >::init ( const numeric_index_type  ,
const numeric_index_type  ,
const std::vector< numeric_index_type > &  ,
const bool  = false,
const ParallelType  = AUTOMATIC 
)
overridevirtual

Create a vector that holds tha local indices plus those specified in the ghost argument.

Implements libMesh::NumericVector< T >.

Definition at line 617 of file trilinos_epetra_vector.h.

References libMesh::TriangleWrapper::init().

622 {
623  // TODO: we shouldn't ignore the ghost sparsity pattern
624  this->init(n, n_local, fast, type);
625 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
Change the dimension of the vector to N.
ParallelType type() const

◆ init() [4/4]

template<class T >
void libMesh::EpetraVector< T >::init ( const NumericVector< T > &  other,
const bool  fast = false 
)
overridevirtual

Creates a vector that has the same dimension and storage type as other, including ghost dofs.

Implements libMesh::NumericVector< T >.

Definition at line 543 of file trilinos_epetra_vector.h.

References libMesh::TriangleWrapper::init(), libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::size(), and libMesh::NumericVector< T >::type().

545 {
546  this->init(other.size(),other.local_size(),fast,other.type());
547 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
Change the dimension of the vector to N.

◆ initialized()

template<typename T>
virtual bool libMesh::NumericVector< T >::initialized ( ) const
virtualinherited
Returns
true if the vector has been initialized, false otherwise.

Definition at line 143 of file numeric_vector.h.

Referenced by libMesh::PetscVector< T >::init().

143 { return _is_initialized; }
bool _is_initialized
true once init() has been called.

◆ inputNonlocalValue()

template<typename T>
int libMesh::EpetraVector< T >::inputNonlocalValue ( int  GID,
double  value,
bool  accumulate 
)
private

◆ inputNonlocalValues()

template<typename T>
int libMesh::EpetraVector< T >::inputNonlocalValues ( int  GID,
int  numValues,
const double *  values,
bool  accumulate 
)
private

◆ inputValues() [1/2]

template<typename T>
int libMesh::EpetraVector< T >::inputValues ( int  numIDs,
const int *  GIDs,
const double *  values,
bool  accumulate 
)
private

◆ inputValues() [2/2]

template<typename T>
int libMesh::EpetraVector< T >::inputValues ( int  numIDs,
const int *  GIDs,
const int *  numValuesPerID,
const double *  values,
bool  accumulate 
)
private

◆ insert() [1/5]

template<typename T>
virtual void libMesh::EpetraVector< T >::insert ( const T *  v,
const std::vector< numeric_index_type > &  dof_indices 
)
overridevirtual

Inserts the entries of v in *this at the locations specified by v.

Reimplemented from libMesh::NumericVector< T >.

◆ insert() [2/5]

template<typename T>
void libMesh::NumericVector< T >::insert ( const std::vector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inherited

Inserts the entries of v in *this at the locations specified by v.

Definition at line 853 of file numeric_vector.h.

855 {
856  libmesh_assert(v.size() == dof_indices.size());
857  if (!v.empty())
858  this->insert(&v[0], dof_indices);
859 }
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
Inserts the entries of v in *this at the locations specified by v.

◆ insert() [3/5]

template<typename T>
virtual void libMesh::NumericVector< T >::insert ( const NumericVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
virtualinherited

Inserts the entries of v in *this at the locations specified by v.

◆ insert() [4/5]

template<typename T>
void libMesh::NumericVector< T >::insert ( const DenseVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inherited

Inserts the entries of v in *this at the locations specified by v.

Definition at line 865 of file numeric_vector.h.

867 {
868  libmesh_assert(v.size() == dof_indices.size());
869  if (!v.empty())
870  this->insert(&v(0), dof_indices);
871 }
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
Inserts the entries of v in *this at the locations specified by v.

◆ insert() [5/5]

template<typename T>
void libMesh::NumericVector< T >::insert ( const DenseSubVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inherited

Inserts the entries of v in *this at the locations specified by v.

Definition at line 877 of file numeric_vector.h.

879 {
880  libmesh_assert(v.size() == dof_indices.size());
881  if (!v.empty())
882  this->insert(&v(0), dof_indices);
883 }
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
Inserts the entries of v in *this at the locations specified by v.

◆ l1_norm()

template<typename T>
virtual Real libMesh::EpetraVector< T >::l1_norm ( ) const
overridevirtual
Returns
The $ \ell_1 $-norm of the vector, i.e. the sum of the absolute values of the entries.

Implements libMesh::NumericVector< T >.

◆ l2_norm()

template<typename T>
virtual Real libMesh::EpetraVector< T >::l2_norm ( ) const
overridevirtual
Returns
The $ \ell_2 $-norm of the vector, i.e. the square root of the sum of the squares of the entries.

Implements libMesh::NumericVector< T >.

◆ last_local_index()

template<typename T >
numeric_index_type libMesh::EpetraVector< T >::last_local_index ( ) const
overridevirtual
Returns
The index+1 of the last vector element actually stored on this processor.
Note
The maximum for this index is size().

Implements libMesh::NumericVector< T >.

Definition at line 754 of file trilinos_epetra_vector.h.

References libMesh::initialized().

755 {
756  libmesh_assert (this->initialized());
757 
758  return _vec->Map().MaxMyGID()+1;
759 }
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.

◆ linfty_norm()

template<typename T>
virtual Real libMesh::EpetraVector< T >::linfty_norm ( ) const
overridevirtual
Returns
The $ \ell_{\infty} $-norm of the vector, i.e. the maximum absolute value of the entries of the vector.

Implements libMesh::NumericVector< T >.

◆ local_relative_compare()

template<typename T>
virtual int libMesh::NumericVector< T >::local_relative_compare ( const NumericVector< T > &  other_vector,
const Real  threshold = TOLERANCE 
) const
virtualinherited
Returns
-1 when this is equivalent to other_vector, (up to the given local relative threshold), or the first index where abs(a[i]-b[i])/max(a[i],b[i]) exceeds the threshold.

◆ local_size()

template<typename T >
numeric_index_type libMesh::EpetraVector< T >::local_size ( ) const
overridevirtual
Returns
The local size of the vector, i.e. index_stop - index_start.

Implements libMesh::NumericVector< T >.

Definition at line 734 of file trilinos_epetra_vector.h.

References libMesh::initialized().

735 {
736  libmesh_assert (this->initialized());
737 
738  return _vec->MyLength();
739 }
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.

◆ localize() [1/5]

template<typename T>
virtual void libMesh::EpetraVector< T >::localize ( std::vector< T > &  v_local) const
overridevirtual

Creates a copy of the global vector in the local vector v_local.

Implements libMesh::NumericVector< T >.

◆ localize() [2/5]

template<typename T>
virtual void libMesh::EpetraVector< T >::localize ( NumericVector< T > &  v_local) const
overridevirtual

Same, but fills a NumericVector<T> instead of a std::vector.

Implements libMesh::NumericVector< T >.

◆ localize() [3/5]

template<typename T>
virtual void libMesh::EpetraVector< T >::localize ( NumericVector< T > &  v_local,
const std::vector< numeric_index_type > &  send_list 
) const
overridevirtual

Creates a local vector v_local containing only information relevant to this processor, as defined by the send_list.

Implements libMesh::NumericVector< T >.

◆ localize() [4/5]

template<typename T>
virtual void libMesh::EpetraVector< T >::localize ( std::vector< T > &  v_local,
const std::vector< numeric_index_type > &  indices 
) const
overridevirtual


Fill in the local std::vector "v_local" with the global indices given in "indices".

Note
The indices can be different on every processor, and the same index can be localized to more than one processor. The resulting v_local can be shorter than the original, and the entries will be in the order specified by indices.

Example:

*   On 4 procs *this = {a, b, c, d, e, f, g, h, i} is a parallel vector.
*   On each proc, the indices arrays are set up as:
*   proc0, indices = {1,2,4,5}
*   proc1, indices = {2,5,6,8}
*   proc2, indices = {2,3,6,7}
*   proc3, indices = {0,1,2,3}
*
*   After calling this version of localize, the v_local vectors are:
*   proc0, v_local = {b,c,e,f}
*   proc1, v_local = {c,f,g,i}
*   proc2, v_local = {c,d,g,h}
*   proc3, v_local = {a,b,c,d}
* 

This function is useful in parallel I/O routines, when you have a parallel vector of solution values which you want to write a subset of.

Implements libMesh::NumericVector< T >.

◆ localize() [5/5]

template<typename T>
virtual void libMesh::EpetraVector< T >::localize ( const numeric_index_type  first_local_idx,
const numeric_index_type  last_local_idx,
const std::vector< numeric_index_type > &  send_list 
)
overridevirtual

Updates a local vector with selected values from neighboring processors, as defined by send_list.

Implements libMesh::NumericVector< T >.

◆ localize_to_one()

template<typename T>
virtual void libMesh::EpetraVector< T >::localize_to_one ( std::vector< T > &  v_local,
const processor_id_type  proc_id = 0 
) const
overridevirtual

Creates a local copy of the global vector in v_local only on processor proc_id.

By default the data is sent to processor 0. This method is useful for outputting data from one processor.

Implements libMesh::NumericVector< T >.

◆ max()

template<typename T >
Real libMesh::EpetraVector< T >::max ( ) const
overridevirtual
Returns
The maximum entry in the vector, or the maximum real part in the case of complex numbers.

Implements libMesh::NumericVector< T >.

Definition at line 792 of file trilinos_epetra_vector.h.

References libMesh::initialized().

793 {
794  libmesh_assert (this->initialized());
795 
796  T value;
797 
798  _vec->MaxValue(&value);
799 
800  return value;
801 }
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.

◆ min()

template<typename T >
Real libMesh::EpetraVector< T >::min ( ) const
overridevirtual
Returns
The minimum entry in the vector, or the minimum real part in the case of complex numbers.

Implements libMesh::NumericVector< T >.

Definition at line 777 of file trilinos_epetra_vector.h.

References libMesh::initialized().

778 {
779  libmesh_assert (this->initialized());
780 
781  T value;
782 
783  _vec->MinValue(&value);
784 
785  return value;
786 }
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
staticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 83 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

84  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().

Referenced by libMesh::MeshBase::partition().

94  { return cast_int<processor_id_type>(_communicator.size()); }
processor_id_type size() const
Definition: communicator.h:175
const Parallel::Communicator & _communicator

◆ operator()()

template<typename T >
T libMesh::EpetraVector< T >::operator() ( const numeric_index_type  i) const
overridevirtual
Returns
A copy of the ith entry of the vector.

Implements libMesh::NumericVector< T >.

Definition at line 764 of file trilinos_epetra_vector.h.

References libMesh::initialized().

765 {
766  libmesh_assert (this->initialized());
767  libmesh_assert ( ((i >= this->first_local_index()) &&
768  (i < this->last_local_index())) );
769 
770  return (*_vec)[i-this->first_local_index()];
771 }
virtual numeric_index_type last_local_index() const override
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
virtual numeric_index_type first_local_index() const override

◆ operator*=()

template<typename T>
NumericVector<T>& libMesh::NumericVector< T >::operator*= ( const T  a)
inherited

Scales the vector by a, $ \vec{u} \leftarrow a\vec{u} $.

Equivalent to u.scale(a)

Returns
A reference to *this.

Definition at line 385 of file numeric_vector.h.

385 { this->scale(a); return *this; }
virtual void scale(const T factor)=0
Scale each element of the vector by the given factor.

◆ operator+=()

template<typename T>
virtual NumericVector<T>& libMesh::EpetraVector< T >::operator+= ( const NumericVector< T > &  v)
overridevirtual

Adds v to *this, $ \vec{u} \leftarrow \vec{u} + \vec{v} $.

Equivalent to u.add(1, v).

Returns
A reference to *this.

Implements libMesh::NumericVector< T >.

◆ operator-=()

template<typename T>
virtual NumericVector<T>& libMesh::EpetraVector< T >::operator-= ( const NumericVector< T > &  v)
overridevirtual

Subtracts v from *this, $ \vec{u} \leftarrow \vec{u} - \vec{v} $.

Equivalent to u.add(-1, v).

Returns
A reference to *this.

Implements libMesh::NumericVector< T >.

◆ operator/=() [1/2]

template<typename T>
virtual NumericVector<T>& libMesh::EpetraVector< T >::operator/= ( const NumericVector< T > &  )
overridevirtual

Computes the pointwise division of this vector's entries by another's, $ u_i \leftarrow \frac{u_i}{v_i} \, \forall i$.

Returns
A reference to *this.

Implements libMesh::NumericVector< T >.

◆ operator/=() [2/2]

template<typename T>
NumericVector<T>& libMesh::NumericVector< T >::operator/= ( const T  a)
inherited

Scales the vector by 1/a, $ \vec{u} \leftarrow \frac{1}{a}\vec{u} $.

Equivalent to u.scale(1./a)

Returns
A reference to *this.

Definition at line 394 of file numeric_vector.h.

394 { this->scale(1./a); return *this; }
virtual void scale(const T factor)=0
Scale each element of the vector by the given factor.

◆ operator=() [1/5]

template<typename T>
EpetraVector& libMesh::EpetraVector< T >::operator= ( const EpetraVector< T > &  )
delete

◆ operator=() [2/5]

template<typename T>
EpetraVector& libMesh::EpetraVector< T >::operator= ( EpetraVector< T > &&  )
delete

◆ operator=() [3/5]

template<typename T>
virtual NumericVector<T>& libMesh::EpetraVector< T >::operator= ( const T  s)
overridevirtual

Sets all entries of the vector to the value s.

Returns
A reference to *this.

Implements libMesh::NumericVector< T >.

◆ operator=() [4/5]

template<typename T>
virtual NumericVector<T>& libMesh::EpetraVector< T >::operator= ( const NumericVector< T > &  v)
overridevirtual

This looks like a copy assignment operator, but note that, unlike normal copy assignment operators, it is pure virtual.

This function should be overridden in derived classes so that they can be copied correctly via references to the base class. This design usually isn't a good idea in general, but in this context it works because we usually don't have a mix of different kinds of NumericVectors active in the library at a single time.

Returns
A reference to *this as the base type.

Implements libMesh::NumericVector< T >.

◆ operator=() [5/5]

template<typename T>
virtual NumericVector<T>& libMesh::EpetraVector< T >::operator= ( const std::vector< T > &  v)
overridevirtual

Sets (*this)(i) = v(i) for each entry of the vector.

Returns
A reference to *this as the base type.

Implements libMesh::NumericVector< T >.

◆ pointwise_mult()

template<typename T>
virtual void libMesh::EpetraVector< T >::pointwise_mult ( const NumericVector< T > &  vec1,
const NumericVector< T > &  vec2 
)
overridevirtual

Computes $ u_i \leftarrow u_i v_i $ (summation not implied) i.e.

the pointwise (component-wise) product of vec1 and vec2, and stores the result in *this.

Implements libMesh::NumericVector< T >.

◆ print() [1/2]

template<typename T >
void libMesh::NumericVector< T >::print ( std::ostream &  os = libMesh::out) const
virtualinherited

Prints the local contents of the vector, by default to libMesh::out.

Definition at line 910 of file numeric_vector.h.

911 {
912  libmesh_assert (this->initialized());
913  os << "Size\tglobal = " << this->size()
914  << "\t\tlocal = " << this->local_size() << std::endl;
915 
916  os << "#\tValue" << std::endl;
917  for (numeric_index_type i=this->first_local_index(); i<this->last_local_index(); i++)
918  os << i << "\t" << (*this)(i) << std::endl;
919 }
virtual bool initialized() const
virtual numeric_index_type size() const =0
dof_id_type numeric_index_type
Definition: id_types.h:92
virtual numeric_index_type first_local_index() const =0
virtual numeric_index_type local_size() const =0
virtual numeric_index_type last_local_index() const =0

◆ print() [2/2]

template<>
void libMesh::NumericVector< Complex >::print ( std::ostream &  os) const
inherited

Definition at line 892 of file numeric_vector.h.

893 {
894  libmesh_assert (this->initialized());
895  os << "Size\tglobal = " << this->size()
896  << "\t\tlocal = " << this->local_size() << std::endl;
897 
898  // std::complex<>::operator<<() is defined, but use this form
899  os << "#\tReal part\t\tImaginary part" << std::endl;
900  for (numeric_index_type i=this->first_local_index(); i<this->last_local_index(); i++)
901  os << i << "\t"
902  << (*this)(i).real() << "\t\t"
903  << (*this)(i).imag() << std::endl;
904 }
virtual bool initialized() const
virtual numeric_index_type size() const =0
dof_id_type numeric_index_type
Definition: id_types.h:92
virtual numeric_index_type first_local_index() const =0
virtual numeric_index_type local_size() const =0
virtual numeric_index_type last_local_index() const =0

◆ print_global() [1/2]

template<typename T >
void libMesh::NumericVector< T >::print_global ( std::ostream &  os = libMesh::out) const
virtualinherited

Prints the global contents of the vector, by default to libMesh::out.

Definition at line 947 of file numeric_vector.h.

948 {
949  libmesh_assert (this->initialized());
950 
951  std::vector<T> v(this->size());
952  this->localize(v);
953 
954  // Right now we only want one copy of the output
955  if (this->processor_id())
956  return;
957 
958  os << "Size\tglobal = " << this->size() << std::endl;
959  os << "#\tValue" << std::endl;
960  for (numeric_index_type i=0; i!=v.size(); i++)
961  os << i << "\t" << v[i] << std::endl;
962 }
virtual bool initialized() const
virtual numeric_index_type size() const =0
dof_id_type numeric_index_type
Definition: id_types.h:92
processor_id_type processor_id() const
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.

◆ print_global() [2/2]

template<>
void libMesh::NumericVector< Complex >::print_global ( std::ostream &  os) const
inherited

Definition at line 925 of file numeric_vector.h.

926 {
927  libmesh_assert (this->initialized());
928 
929  std::vector<Complex> v(this->size());
930  this->localize(v);
931 
932  // Right now we only want one copy of the output
933  if (this->processor_id())
934  return;
935 
936  os << "Size\tglobal = " << this->size() << std::endl;
937  os << "#\tReal part\t\tImaginary part" << std::endl;
938  for (numeric_index_type i=0; i!=v.size(); i++)
939  os << i << "\t"
940  << v[i].real() << "\t\t"
941  << v[i].imag() << std::endl;
942 }
virtual bool initialized() const
virtual numeric_index_type size() const =0
dof_id_type numeric_index_type
Definition: id_types.h:92
processor_id_type processor_id() const
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.

◆ print_info()

static void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

◆ print_matlab()

template<typename T>
virtual void libMesh::NumericVector< T >::print_matlab ( const std::string &  = "") const
virtualinherited

Print the contents of the vector in Matlab's sparse matrix format.

Optionally prints the vector to the file named name. If name is not specified it is dumped to the screen.

Reimplemented in libMesh::PetscVector< T >.

Definition at line 675 of file numeric_vector.h.

676  {
677  libmesh_not_implemented();
678  }

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited

◆ reciprocal()

template<typename T>
virtual void libMesh::EpetraVector< T >::reciprocal ( )
overridevirtual

Computes the pointwise reciprocal, $ u_i \leftarrow \frac{1}{u_i} \, \forall i$.

Implements libMesh::NumericVector< T >.

◆ ReplaceGlobalValues() [1/3]

template<typename T>
int libMesh::EpetraVector< T >::ReplaceGlobalValues ( int  numIDs,
const int *  GIDs,
const double *  values 
)
private

Copy values into the vector overwriting any values that already exist for the specified indices.

◆ ReplaceGlobalValues() [2/3]

template<typename T>
int libMesh::EpetraVector< T >::ReplaceGlobalValues ( const Epetra_IntSerialDenseVector &  GIDs,
const Epetra_SerialDenseVector &  values 
)
private

Copy values into the vector, replacing any values that already exist for the specified GIDs.

Parameters
GIDsList of global ids. Must be the same length as the accompanying list of values.
valuesList of coefficient values. Must be the same length as the accompanying list of GIDs.

◆ ReplaceGlobalValues() [3/3]

template<typename T>
int libMesh::EpetraVector< T >::ReplaceGlobalValues ( int  numIDs,
const int *  GIDs,
const int *  numValuesPerID,
const double *  values 
)
private

◆ scale()

template<typename T>
virtual void libMesh::EpetraVector< T >::scale ( const T  factor)
overridevirtual

Scale each element of the vector by the given factor.

Implements libMesh::NumericVector< T >.

◆ set()

template<typename T>
virtual void libMesh::EpetraVector< T >::set ( const numeric_index_type  i,
const T  value 
)
overridevirtual

Sets v(i) = value.

Implements libMesh::NumericVector< T >.

◆ setIgnoreNonLocalEntries()

template<typename T>
void libMesh::EpetraVector< T >::setIgnoreNonLocalEntries ( bool  flag)
private

Set whether or not non-local data values should be ignored.

Definition at line 351 of file trilinos_epetra_vector.h.

References libMesh::EpetraVector< T >::ignoreNonLocalEntries_.

351  {
352  ignoreNonLocalEntries_ = flag;
353  }

◆ size()

template<typename T >
numeric_index_type libMesh::EpetraVector< T >::size ( ) const
overridevirtual
Returns
The size of the vector.

Implements libMesh::NumericVector< T >.

Definition at line 723 of file trilinos_epetra_vector.h.

References libMesh::initialized().

724 {
725  libmesh_assert (this->initialized());
726 
727  return _vec->GlobalLength();
728 }
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.

◆ subset_l1_norm()

template<typename T>
virtual Real libMesh::NumericVector< T >::subset_l1_norm ( const std::set< numeric_index_type > &  indices) const
virtualinherited
Returns
The $ \ell_1 $-norm of the vector, i.e. the sum of the absolute values for the specified entries in the vector.
Note
The indices must necessarily live on this processor.

◆ subset_l2_norm()

template<typename T>
virtual Real libMesh::NumericVector< T >::subset_l2_norm ( const std::set< numeric_index_type > &  indices) const
virtualinherited
Returns
The $ \ell_2 $-norm of the vector, i.e. the square root of the sum of the squares of the elements for the specified entries in the vector.
Note
The indices must necessarily live on this processor.

◆ subset_linfty_norm()

template<typename T>
virtual Real libMesh::NumericVector< T >::subset_linfty_norm ( const std::set< numeric_index_type > &  indices) const
virtualinherited
Returns
The maximum absolute value of the specified entries of this vector, which is the $ \ell_{\infty} $-norm of a vector.
Note
The indices must necessarily live on this processor.

◆ sum()

template<typename T>
virtual T libMesh::EpetraVector< T >::sum ( ) const
overridevirtual
Returns
The sum of all values in the vector.

Implements libMesh::NumericVector< T >.

◆ SumIntoGlobalValues() [1/3]

template<typename T>
int libMesh::EpetraVector< T >::SumIntoGlobalValues ( int  numIDs,
const int *  GIDs,
const double *  values 
)
private

Accumulate values into the vector, adding them to any values that already exist for the specified indices.

◆ SumIntoGlobalValues() [2/3]

template<typename T>
int libMesh::EpetraVector< T >::SumIntoGlobalValues ( const Epetra_IntSerialDenseVector &  GIDs,
const Epetra_SerialDenseVector &  values 
)
private

Accumulate values into the vector, adding them to any values that already exist for the specified GIDs.

Parameters
GIDsList of global ids. Must be the same length as the accompanying list of values.
valuesList of coefficient values. Must be the same length as the accompanying list of GIDs.

◆ SumIntoGlobalValues() [3/3]

template<typename T>
int libMesh::EpetraVector< T >::SumIntoGlobalValues ( int  numIDs,
const int *  GIDs,
const int *  numValuesPerID,
const double *  values 
)
private

◆ swap()

template<typename T >
void libMesh::EpetraVector< T >::swap ( NumericVector< T > &  v)
overridevirtual

Swaps the contents of this with v.

There should be enough indirection in subclasses to make this an O(1) header-swap operation.

Reimplemented from libMesh::NumericVector< T >.

Definition at line 807 of file trilinos_epetra_vector.h.

References libMesh::EpetraVector< T >::_destroy_vec_on_exit, libMesh::EpetraVector< T >::_map, libMesh::EpetraVector< T >::_vec, libMesh::EpetraVector< T >::allocatedNonlocalLength_, libMesh::EpetraVector< T >::ignoreNonLocalEntries_, libMesh::EpetraVector< T >::last_edit, libMesh::EpetraVector< T >::myCoefs_, libMesh::EpetraVector< T >::myFirstID_, libMesh::EpetraVector< T >::myNumIDs_, libMesh::EpetraVector< T >::nonlocalCoefs_, libMesh::EpetraVector< T >::nonlocalElementSize_, libMesh::EpetraVector< T >::nonlocalIDs_, libMesh::EpetraVector< T >::numNonlocalIDs_, swap(), and libMesh::NumericVector< T >::swap().

808 {
809  NumericVector<T>::swap(other);
810 
811  EpetraVector<T> & v = cast_ref<EpetraVector<T> &>(other);
812 
813  std::swap(_vec, v._vec);
814  _map.swap(v._map);
815  std::swap(_destroy_vec_on_exit, v._destroy_vec_on_exit);
816  std::swap(myFirstID_, v.myFirstID_);
817  std::swap(myNumIDs_, v.myNumIDs_);
818  std::swap(myCoefs_, v.myCoefs_);
819  std::swap(nonlocalIDs_, v.nonlocalIDs_);
820  std::swap(nonlocalElementSize_, v.nonlocalElementSize_);
821  std::swap(numNonlocalIDs_, v.numNonlocalIDs_);
822  std::swap(allocatedNonlocalLength_, v.allocatedNonlocalLength_);
823  std::swap(nonlocalCoefs_, v.nonlocalCoefs_);
824  std::swap(last_edit, v.last_edit);
825  std::swap(ignoreNonLocalEntries_, v.ignoreNonLocalEntries_);
826 }
std::unique_ptr< Epetra_Map > _map
Holds the distributed Map.
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
virtual void swap(NumericVector< T > &v)
Swaps the contents of this with v.
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=

◆ type() [1/2]

template<typename T>
ParallelType libMesh::NumericVector< T >::type ( ) const
inherited
Returns
The type (SERIAL, PARALLEL, GHOSTED) of the vector.

Definition at line 148 of file numeric_vector.h.

Referenced by libMesh::EpetraVector< T >::EpetraVector(), libMesh::DistributedVector< T >::init(), libMesh::EigenSparseVector< T >::init(), libMesh::LaspackVector< T >::init(), and libMesh::EpetraVector< T >::init().

148 { return _type; }
ParallelType _type
Type of vector.

◆ type() [2/2]

template<typename T>
ParallelType& libMesh::NumericVector< T >::type ( )
inherited
Returns
The type (SERIAL, PARALLEL, GHOSTED) of the vector.

Definition at line 153 of file numeric_vector.h.

153 { return _type; }
ParallelType _type
Type of vector.

◆ vec()

template<typename T>
Epetra_Vector* libMesh::EpetraVector< T >::vec ( )
Returns
The raw Epetra_Vector pointer.
Note
This is generally not required in user-level code.
Don't do anything crazy like deleting the pointer, or very bad things will likely happen!

Definition at line 261 of file trilinos_epetra_vector.h.

References libMesh::EpetraVector< T >::_vec.

261 { libmesh_assert(_vec); return _vec; }
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.

◆ zero()

template<typename T >
void libMesh::EpetraVector< T >::zero ( )
overridevirtual

Set all entries to zero.

Equivalent to v = 0, but more obvious and faster.

Implements libMesh::NumericVector< T >.

Definition at line 688 of file trilinos_epetra_vector.h.

References libMesh::closed(), and libMesh::initialized().

689 {
690  libmesh_assert (this->initialized());
691  libmesh_assert (this->closed());
692 
693  _vec->PutScalar(0.0);
694 }
virtual bool initialized() const
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
virtual bool closed() const

◆ zero_clone()

template<typename T >
std::unique_ptr< NumericVector< T > > libMesh::EpetraVector< T >::zero_clone ( ) const
overridevirtual
Returns
A smart pointer to a copy of this vector with the same type, size, and partitioning, but with all zero entries.
Note
This must be overridden in the derived classes.

Implements libMesh::NumericVector< T >.

Definition at line 700 of file trilinos_epetra_vector.h.

References libMesh::AUTOMATIC, and libMesh::NumericVector< T >::init().

701 {
702  NumericVector<T> * cloned_vector = new EpetraVector<T>(this->comm(), AUTOMATIC);
703  cloned_vector->init(*this);
704  return std::unique_ptr<NumericVector<T>>(cloned_vector);
705 }
const Parallel::Communicator & comm() const

Member Data Documentation

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _counts

Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

◆ _destroy_vec_on_exit

template<typename T>
bool libMesh::EpetraVector< T >::_destroy_vec_on_exit
private

This boolean value should only be set to false for the constructor which takes a Epetra Vec object.

Definition at line 279 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::swap().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 141 of file reference_counter.h.

◆ _is_closed

template<typename T>
bool libMesh::NumericVector< T >::_is_closed
protectedinherited

Flag which tracks whether the vector's values are consistent on all processors after insertion or addition of values has occurred on some or all processors.

Definition at line 706 of file numeric_vector.h.

Referenced by libMesh::NumericVector< Number >::closed(), libMesh::EpetraVector< T >::EpetraVector(), and libMesh::PetscVector< T >::PetscVector().

◆ _is_initialized

template<typename T>
bool libMesh::NumericVector< T >::_is_initialized
protectedinherited

◆ _map

template<typename T>
std::unique_ptr<Epetra_Map> libMesh::EpetraVector< T >::_map
private

Holds the distributed Map.

Definition at line 273 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::EpetraVector(), and libMesh::EpetraVector< T >::swap().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 135 of file reference_counter.h.

◆ _n_objects

Threads::atomic<unsigned int> libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 130 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

◆ _type

template<typename T>
ParallelType libMesh::NumericVector< T >::_type
protectedinherited

◆ _vec

template<typename T>
Epetra_Vector* libMesh::EpetraVector< T >::_vec
private

Actual Epetra vector datatype to hold vector entries.

Definition at line 268 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::EpetraVector(), libMesh::EpetraVector< T >::swap(), and libMesh::EpetraVector< T >::vec().

◆ allocatedNonlocalLength_

template<typename T>
int libMesh::EpetraVector< T >::allocatedNonlocalLength_
private

Definition at line 386 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::swap().

◆ ignoreNonLocalEntries_

template<typename T>
bool libMesh::EpetraVector< T >::ignoreNonLocalEntries_
private

◆ last_edit

template<typename T>
unsigned char libMesh::EpetraVector< T >::last_edit
private

Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add (2), so we can decide how to do the GlobalAssemble()

Definition at line 394 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::swap().

◆ myCoefs_

template<typename T>
double* libMesh::EpetraVector< T >::myCoefs_
private

◆ myFirstID_

template<typename T>
int libMesh::EpetraVector< T >::myFirstID_
private

◆ myNumIDs_

template<typename T>
int libMesh::EpetraVector< T >::myNumIDs_
private

◆ nonlocalCoefs_

template<typename T>
double** libMesh::EpetraVector< T >::nonlocalCoefs_
private

Definition at line 387 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::swap().

◆ nonlocalElementSize_

template<typename T>
int* libMesh::EpetraVector< T >::nonlocalElementSize_
private

Definition at line 384 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::swap().

◆ nonlocalIDs_

template<typename T>
int* libMesh::EpetraVector< T >::nonlocalIDs_
private

Definition at line 383 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::swap().

◆ numNonlocalIDs_

template<typename T>
int libMesh::EpetraVector< T >::numNonlocalIDs_
private

Definition at line 385 of file trilinos_epetra_vector.h.

Referenced by libMesh::EpetraVector< T >::swap().


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