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

This class provides a nice interface to the Laspack C-based data structures for serial vectors. More...

#include <laspack_matrix.h>

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

Public Member Functions

 LaspackVector (const Parallel::Communicator &comm, const ParallelType=AUTOMATIC)
 Dummy-Constructor. More...
 
 LaspackVector (const Parallel::Communicator &comm, const numeric_index_type n, const ParallelType=AUTOMATIC)
 Constructor. More...
 
 LaspackVector (const Parallel::Communicator &comm, const numeric_index_type n, const numeric_index_type n_local, const ParallelType=AUTOMATIC)
 Constructor. More...
 
 LaspackVector (const Parallel::Communicator &comm, const numeric_index_type N, const numeric_index_type n_local, const std::vector< numeric_index_type > &ghost, const ParallelType=AUTOMATIC)
 Constructor. More...
 
LaspackVector< T > & operator= (const LaspackVector< T > &v)
 Copy assignment operator. More...
 
 LaspackVector (LaspackVector &&)=delete
 This class manages a C-style struct (QVector) manually, so we don't want to allow any automatic copy/move functions to be generated, and we can't default the destructor. More...
 
 LaspackVector (const LaspackVector &)=delete
 
LaspackVectoroperator= (LaspackVector &&)=delete
 
virtual ~LaspackVector ()
 
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 ptype=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 ptype=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 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 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 swap (NumericVector< T > &v) override
 Swaps the contents of this with v. More...
 
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...
 
virtual void add_vector (const T *v, const std::vector< numeric_index_type > &dof_indices)
 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...
 
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...
 
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. 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...
 
virtual void create_subvector (NumericVector< T > &, const std::vector< numeric_index_type > &) const
 Fills in subvector from this vector using the indices in rows. 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 Attributes

QVector _vec
 Actual Laspack vector datatype to hold vector entries. More...
 

Friends

class LaspackLinearSolver< T >
 Make other Laspack datatypes friends. More...
 

Detailed Description

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

This class provides a nice interface to the Laspack C-based data structures for serial vectors.

All overridden virtual functions are documented in numeric_vector.h.

Author
Benjamin S. Kirk
Date
2002

Definition at line 42 of file laspack_matrix.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

◆ LaspackVector() [1/6]

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

Dummy-Constructor.

Dimension=0

Definition at line 248 of file laspack_vector.h.

References libMesh::NumericVector< T >::_type.

250  : NumericVector<T>(comm, ptype)
251 {
252  this->_type = ptype;
253 }
const Parallel::Communicator & comm() const
ParallelType _type
Type of vector.

◆ LaspackVector() [2/6]

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

Constructor.

Set dimension to n and initialize all elements with zero.

Definition at line 259 of file laspack_vector.h.

References libMesh::LaspackVector< T >::init().

262  : NumericVector<T>(comm, ptype)
263 {
264  this->init(n, n, false, ptype);
265 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
Change the dimension of the vector to N.
const Parallel::Communicator & comm() const

◆ LaspackVector() [3/6]

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

Constructor.

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

Definition at line 271 of file laspack_vector.h.

References libMesh::LaspackVector< T >::init().

275  : NumericVector<T>(comm, ptype)
276 {
277  this->init(n, n_local, false, ptype);
278 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
Change the dimension of the vector to N.
const Parallel::Communicator & comm() const

◆ LaspackVector() [4/6]

template<typename T >
libMesh::LaspackVector< T >::LaspackVector ( const Parallel::Communicator comm,
const numeric_index_type  N,
const numeric_index_type  n_local,
const std::vector< numeric_index_type > &  ghost,
const ParallelType  ptype = 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 284 of file laspack_vector.h.

References libMesh::LaspackVector< T >::init().

289  : NumericVector<T>(comm, ptype)
290 {
291  this->init(N, n_local, ghost, false, ptype);
292 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
Change the dimension of the vector to N.
const Parallel::Communicator & comm() const

◆ LaspackVector() [5/6]

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

This class manages a C-style struct (QVector) manually, so we don't want to allow any automatic copy/move functions to be generated, and we can't default the destructor.

◆ LaspackVector() [6/6]

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

◆ ~LaspackVector()

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

Definition at line 298 of file laspack_vector.h.

299 {
300  this->clear ();
301 }
virtual void clear() override
Restores the NumericVector<T> to a pristine state.

Member Function Documentation

◆ abs()

template<typename T >
virtual void libMesh::LaspackVector< 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 >
void libMesh::LaspackVector< T >::add ( const numeric_index_type  i,
const T  value 
)
overridevirtual

Adds value to each entry of the vector.

Implements libMesh::NumericVector< T >.

Definition at line 510 of file laspack_vector.h.

References libMesh::initialized().

511 {
512  libmesh_assert (this->initialized());
513  libmesh_assert_less (i, this->size());
514 
515  V_AddCmp (&_vec, i+1, value);
516 
517 #ifndef NDEBUG
518  this->_is_closed = false;
519 #endif
520 }
virtual numeric_index_type size() const override
virtual bool initialized() const
QVector _vec
Actual Laspack vector datatype to hold vector entries.
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...

◆ add() [2/4]

template<typename T >
virtual void libMesh::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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() [2/6]

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

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 in libMesh::PetscVector< T >, and libMesh::EpetraVector< 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::LaspackVector< 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::LaspackVector< T >::clear ( )
overridevirtual

Restores the NumericVector<T> to a pristine state.

Reimplemented from libMesh::NumericVector< T >.

Definition at line 394 of file laspack_vector.h.

References libMesh::initialized().

395 {
396  if (this->initialized())
397  {
398  V_Destr (&_vec);
399  }
400 
401  this->_is_initialized = false;
402 #ifndef NDEBUG
403  this->_is_closed = false;
404 #endif
405 }
virtual bool initialized() const
bool _is_initialized
true once init() has been called.
QVector _vec
Actual Laspack vector datatype to hold vector entries.
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::LaspackVector< 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 435 of file laspack_vector.h.

References libMesh::NumericVector< T >::init().

436 {
437  NumericVector<T> * cloned_vector = new LaspackVector<T>(this->comm());
438 
439  cloned_vector->init(*this, true);
440 
441  *cloned_vector = *this;
442 
443  return std::unique_ptr<NumericVector<T>>(cloned_vector);
444 }
const Parallel::Communicator & comm() const

◆ close()

template<typename T >
void libMesh::LaspackVector< 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 381 of file laspack_vector.h.

References libMesh::initialized().

382 {
383  libmesh_assert (this->initialized());
384 
385 #ifndef NDEBUG
386  this->_is_closed = true;
387 #endif
388 }
virtual bool initialized() const
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::LaspackVector< 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::NumericVector< T >::create_subvector ( NumericVector< T > &  ,
const std::vector< numeric_index_type > &   
) const
virtualinherited

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 in libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.

Definition at line 686 of file numeric_vector.h.

688  {
689  libmesh_not_implemented();
690  }

◆ disable_print_counter_info()

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

◆ dot()

template<typename T >
virtual T libMesh::LaspackVector< 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()

◆ first_local_index()

template<typename T >
numeric_index_type libMesh::LaspackVector< 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 472 of file laspack_vector.h.

References libMesh::initialized().

473 {
474  libmesh_assert (this->initialized());
475 
476  return 0;
477 }
virtual bool initialized() const

◆ 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.

◆ 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 >
virtual void libMesh::LaspackVector< 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 >.

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

◆ init() [2/4]

template<typename T >
void libMesh::LaspackVector< 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 346 of file laspack_vector.h.

References libMesh::TriangleWrapper::init().

349 {
350  this->init(n,n,fast,ptype);
351 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
Change the dimension of the vector to N.

◆ init() [3/4]

template<typename T >
virtual void libMesh::LaspackVector< 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 >.

◆ init() [4/4]

template<class T >
void libMesh::LaspackVector< 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 371 of file laspack_vector.h.

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

373 {
374  this->init(other.size(),other.local_size(),fast,other.type());
375 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=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.

◆ insert() [1/5]

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

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

Reimplemented in libMesh::PetscVector< T >, and libMesh::EpetraVector< 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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 483 of file laspack_vector.h.

References libMesh::initialized().

484 {
485  libmesh_assert (this->initialized());
486 
487  return this->size();
488 }
virtual numeric_index_type size() const override
virtual bool initialized() const

◆ linfty_norm()

template<typename T >
virtual Real libMesh::LaspackVector< 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::LaspackVector< 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 461 of file laspack_vector.h.

References libMesh::initialized().

462 {
463  libmesh_assert (this->initialized());
464 
465  return this->size();
466 }
virtual numeric_index_type size() const override
virtual bool initialized() const

◆ localize() [1/5]

template<typename T >
virtual void libMesh::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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 >
virtual Real libMesh::LaspackVector< 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 >.

◆ min()

template<typename T >
virtual Real libMesh::LaspackVector< 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 >.

◆ 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::LaspackVector< 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 526 of file laspack_vector.h.

References libMesh::initialized().

527 {
528  libmesh_assert (this->initialized());
529  libmesh_assert ( ((i >= this->first_local_index()) &&
530  (i < this->last_local_index())) );
531 
532 
533  return static_cast<T>(V_GetCmp(const_cast<QVector*>(&_vec), i+1));
534 }
virtual bool initialized() const
virtual numeric_index_type last_local_index() const override
virtual numeric_index_type first_local_index() const override
QVector _vec
Actual Laspack vector datatype to hold vector entries.

◆ 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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 >
LaspackVector<T>& libMesh::LaspackVector< T >::operator= ( const LaspackVector< T > &  v)

Copy assignment operator.

Calls Asgn_VV() to assign the contents of one vector to another.

Returns
A reference to *this as the derived type.

◆ operator=() [2/5]

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

◆ operator=() [3/5]

template<typename T >
virtual NumericVector<T>& libMesh::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< 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::LaspackVector< T >::reciprocal ( )
overridevirtual

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

Implements libMesh::NumericVector< T >.

◆ scale()

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

Scale each element of the vector by the given factor.

Implements libMesh::NumericVector< T >.

◆ set()

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

Sets v(i) = value.

Implements libMesh::NumericVector< T >.

Definition at line 494 of file laspack_vector.h.

References libMesh::initialized().

495 {
496  libmesh_assert (this->initialized());
497  libmesh_assert_less (i, this->size());
498 
499  V_SetCmp (&_vec, i+1, value);
500 
501 #ifndef NDEBUG
502  this->_is_closed = false;
503 #endif
504 }
virtual numeric_index_type size() const override
virtual bool initialized() const
QVector _vec
Actual Laspack vector datatype to hold vector entries.
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...

◆ size()

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

Implements libMesh::NumericVector< T >.

Definition at line 450 of file laspack_vector.h.

References libMesh::initialized().

451 {
452  libmesh_assert (this->initialized());
453 
454  return static_cast<numeric_index_type>(V_GetDim(const_cast<QVector*>(&_vec)));
455 }
virtual bool initialized() const
dof_id_type numeric_index_type
Definition: id_types.h:92
QVector _vec
Actual Laspack 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::LaspackVector< T >::sum ( ) const
overridevirtual
Returns
The sum of all values in the vector.

Implements libMesh::NumericVector< T >.

◆ swap()

template<typename T >
void libMesh::LaspackVector< 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 540 of file laspack_vector.h.

References swap().

541 {
542  LaspackVector<T> & v = cast_ref<LaspackVector<T> &>(other);
543 
544  // This is all grossly dependent on Laspack version...
545 
546  std::swap(_vec.Name, v._vec.Name);
547  std::swap(_vec.Dim, v._vec.Dim);
548  std::swap(_vec.Instance, v._vec.Instance);
549  std::swap(_vec.LockLevel, v._vec.LockLevel);
550  std::swap(_vec.Multipl, v._vec.Multipl);
551  std::swap(_vec.OwnData, v._vec.OwnData);
552 
553  // This should still be O(1), since _vec.Cmp is just a pointer to
554  // data on the heap
555 
556  std::swap(_vec.Cmp, v._vec.Cmp);
557 }
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=
QVector _vec
Actual Laspack vector datatype to hold vector entries.

◆ 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.

◆ zero()

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

Set all entries to zero.

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

Implements libMesh::NumericVector< T >.

Definition at line 410 of file laspack_vector.h.

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

411 {
412  libmesh_assert (this->initialized());
413  libmesh_assert (this->closed());
414 
415  V_SetAllCmp (&_vec, 0.);
416 }
virtual bool initialized() const
virtual bool closed() const
QVector _vec
Actual Laspack vector datatype to hold vector entries.

◆ zero_clone()

template<typename T >
std::unique_ptr< NumericVector< T > > libMesh::LaspackVector< 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 422 of file laspack_vector.h.

References libMesh::NumericVector< T >::init().

423 {
424  NumericVector<T> * cloned_vector = new LaspackVector<T>(this->comm());
425 
426  cloned_vector->init(*this);
427 
428  return std::unique_ptr<NumericVector<T>>(cloned_vector);
429 }
const Parallel::Communicator & comm() const

Friends And Related Function Documentation

◆ LaspackLinearSolver< T >

template<typename T >
friend class LaspackLinearSolver< T >
friend

Make other Laspack datatypes friends.

Definition at line 239 of file laspack_vector.h.

Member Data Documentation

◆ _communicator

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

◆ _counts

Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

◆ _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

◆ _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 >
QVector libMesh::LaspackVector< T >::_vec
private

Actual Laspack vector datatype to hold vector entries.

Definition at line 234 of file laspack_vector.h.


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