Reference documentation for deal.II version GIT b9c422a7ef 2022-07-03 21:00:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Modules | Classes | Typedefs | Enumerations | Enumerator | Functions | Variables | Friends
Collaboration diagram for Vector classes:

Modules

 Exceptions and assertions
 

Classes

class  BlockVector< Number >
 
struct  is_serial_vector< BlockVector< Number > >
 
struct  IsBlockVector< VectorType >
 
class  internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >
 
class  BlockVectorBase< VectorType >
 
class  LinearAlgebra::CUDAWrappers::Vector< Number >
 
class  LinearAlgebra::distributed::BlockVector< Number >
 
class  LinearAlgebra::distributed::Vector< Number, MemorySpace >
 
class  internal::LinearOperatorImplementation::ReinitHelper< Vector >
 
class  internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >
 
class  LinearAlgebra::Vector< Number >
 
class  PETScWrappers::MPI::BlockVector
 
class  PETScWrappers::MPI::Vector
 
class  LinearAlgebra::ReadWriteVector< Number >
 
class  LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >
 
class  LinearAlgebra::EpetraWrappers::Vector
 
class  TrilinosWrappers::MPI::BlockVector
 
class  LinearAlgebra::TpetraWrappers::Vector< Number >
 
class  TrilinosWrappers::MPI::Vector
 
class  Vector< Number >
 
struct  is_serial_vector< Vector< Number > >
 
struct  VectorOperation
 
class  LinearAlgebra::VectorSpaceVector< Number >
 

Typedefs

using BlockVector< Number >::BaseClass = BlockVectorBase< Vector< Number > >
 
using BlockVector< Number >::BlockType = typename BaseClass::BlockType
 
using BlockVector< Number >::value_type = typename BaseClass::value_type
 
using BlockVector< Number >::real_type = typename BaseClass::real_type
 
using BlockVector< Number >::pointer = typename BaseClass::pointer
 
using BlockVector< Number >::const_pointer = typename BaseClass::const_pointer
 
using BlockVector< Number >::reference = typename BaseClass::reference
 
using BlockVector< Number >::const_reference = typename BaseClass::const_reference
 
using BlockVector< Number >::size_type = typename BaseClass::size_type
 
using BlockVector< Number >::iterator = typename BaseClass::iterator
 
using BlockVector< Number >::const_iterator = typename BaseClass::const_iterator
 
template<typename T >
using internal::has_block_t = decltype(std::declval< T const >().block(0))
 
template<typename T >
using internal::has_n_blocks_t = decltype(std::declval< T const >().n_blocks())
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::size_type = types::global_dof_index
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::value_type = typename std::conditional< Constness, const typename BlockVectorType::value_type, typename BlockVectorType::value_type >::type
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::iterator_category = std::random_access_iterator_tag
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::difference_type = std::ptrdiff_t
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::reference = typename BlockVectorType::reference
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::pointer = value_type *
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::dereference_type = typename std::conditional< Constness, value_type, typename BlockVectorType::BlockType::reference >::type
 
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::BlockVector = typename std::conditional< Constness, const BlockVectorType, BlockVectorType >::type
 
using LinearAlgebra::distributed::BlockVector< Number >::BaseClass = BlockVectorBase< Vector< Number > >
 
using LinearAlgebra::distributed::BlockVector< Number >::BlockType = typename BaseClass::BlockType
 
using LinearAlgebra::distributed::BlockVector< Number >::value_type = typename BaseClass::value_type
 
using LinearAlgebra::distributed::BlockVector< Number >::real_type = typename BaseClass::real_type
 
using LinearAlgebra::distributed::BlockVector< Number >::pointer = typename BaseClass::pointer
 
using LinearAlgebra::distributed::BlockVector< Number >::const_pointer = typename BaseClass::const_pointer
 
using LinearAlgebra::distributed::BlockVector< Number >::reference = typename BaseClass::reference
 
using LinearAlgebra::distributed::BlockVector< Number >::const_reference = typename BaseClass::const_reference
 
using LinearAlgebra::distributed::BlockVector< Number >::size_type = typename BaseClass::size_type
 
using LinearAlgebra::distributed::BlockVector< Number >::iterator = typename BaseClass::iterator
 
using LinearAlgebra::distributed::BlockVector< Number >::const_iterator = typename BaseClass::const_iterator
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::memory_space = MemorySpace
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::value_type = Number
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::pointer = value_type *
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::const_pointer = const value_type *
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::iterator = value_type *
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::const_iterator = const value_type *
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::reference = value_type &
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::const_reference = const value_type &
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::size_type = types::global_dof_index
 
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::real_type = typename numbers::NumberTraits< Number >::real_type
 
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::get_mpi_communicator_t = decltype(std::declval< T >().get_mpi_communicator())
 
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::locally_owned_domain_indices_t = decltype(std::declval< T >().locally_owned_domain_indices())
 
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::locally_owned_range_indices_t = decltype(std::declval< T >().locally_owned_range_indices())
 
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::initialize_dof_vector_t = decltype(std::declval< T >().initialize_dof_vector(std::declval< LinearAlgebra::distributed::Vector< Number > & >()))
 
using LinearAlgebra::Vector< Number >::size_type = types::global_dof_index
 
using LinearAlgebra::Vector< Number >::value_type = typename ReadWriteVector< Number >::value_type
 
using LinearAlgebra::ReadWriteVector< Number >::value_type = Number
 
using LinearAlgebra::ReadWriteVector< Number >::pointer = value_type *
 
using LinearAlgebra::ReadWriteVector< Number >::const_pointer = const value_type *
 
using LinearAlgebra::ReadWriteVector< Number >::iterator = value_type *
 
using LinearAlgebra::ReadWriteVector< Number >::const_iterator = const value_type *
 
using LinearAlgebra::ReadWriteVector< Number >::reference = value_type &
 
using LinearAlgebra::ReadWriteVector< Number >::const_reference = const value_type &
 
using LinearAlgebra::ReadWriteVector< Number >::size_type = types::global_dof_index
 
using LinearAlgebra::ReadWriteVector< Number >::real_type = typename numbers::NumberTraits< Number >::real_type
 
using Vector< Number >::value_type = Number
 
using Vector< Number >::pointer = value_type *
 
using Vector< Number >::const_pointer = const value_type *
 
using Vector< Number >::iterator = value_type *
 
using Vector< Number >::const_iterator = const value_type *
 
using Vector< Number >::reference = value_type &
 
using Vector< Number >::const_reference = const value_type &
 
using Vector< Number >::size_type = types::global_dof_index
 
using Vector< Number >::real_type = typename numbers::NumberTraits< Number >::real_type
 
using LinearAlgebra::VectorSpaceVector< Number >::value_type = Number
 
using LinearAlgebra::VectorSpaceVector< Number >::size_type = types::global_dof_index
 
using LinearAlgebra::VectorSpaceVector< Number >::real_type = typename numbers::NumberTraits< Number >::real_type
 

Enumerations

enum  VectorOperation::values {
  VectorOperation::unknown , VectorOperation::insert , VectorOperation::add , VectorOperation::min ,
  VectorOperation::max
}
 

Functions

 BlockVector< Number >::BlockVector (const unsigned int n_blocks=0, const size_type block_size=0)
 
 BlockVector< Number >::BlockVector (const BlockVector< Number > &V)
 
 BlockVector< Number >::BlockVector (BlockVector< Number > &&) noexcept=default
 
template<typename OtherNumber >
 BlockVector< Number >::BlockVector (const BlockVector< OtherNumber > &v)
 
 BlockVector< Number >::BlockVector (const TrilinosWrappers::MPI::BlockVector &v)
 
 BlockVector< Number >::BlockVector (const std::vector< size_type > &block_sizes)
 
 BlockVector< Number >::BlockVector (const BlockIndices &block_indices)
 
template<typename InputIterator >
 BlockVector< Number >::BlockVector (const std::vector< size_type > &block_sizes, const InputIterator first, const InputIterator end)
 
 BlockVector< Number >::~BlockVector () override=default
 
void BlockVector< Number >::compress (::VectorOperation::values operation=::VectorOperation::unknown)
 
bool BlockVector< Number >::has_ghost_elements () const
 
BlockVectorBlockVector< Number >::operator= (const value_type s)
 
BlockVector< Number > & BlockVector< Number >::operator= (const BlockVector< Number > &v)
 
BlockVector< Number > & BlockVector< Number >::operator= (BlockVector< Number > &&)=default
 
template<class Number2 >
BlockVector< Number > & BlockVector< Number >::operator= (const BlockVector< Number2 > &V)
 
BlockVector< Number > & BlockVector< Number >::operator= (const Vector< Number > &V)
 
BlockVector< Number > & BlockVector< Number >::operator= (const TrilinosWrappers::MPI::BlockVector &V)
 
void BlockVector< Number >::reinit (const unsigned int n_blocks, const size_type block_size=0, const bool omit_zeroing_entries=false)
 
void BlockVector< Number >::reinit (const std::vector< size_type > &block_sizes, const bool omit_zeroing_entries=false)
 
void BlockVector< Number >::reinit (const BlockIndices &block_indices, const bool omit_zeroing_entries=false)
 
template<typename Number2 >
void BlockVector< Number >::reinit (const BlockVector< Number2 > &V, const bool omit_zeroing_entries=false)
 
template<class BlockVector2 >
void BlockVector< Number >::scale (const BlockVector2 &v)
 
void BlockVector< Number >::swap (BlockVector< Number > &v)
 
void BlockVector< Number >::print (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
 
void BlockVector< Number >::block_write (std::ostream &out) const
 
void BlockVector< Number >::block_read (std::istream &in)
 
template<typename Number >
void swap (BlockVector< Number > &u, BlockVector< Number > &v)
 
 internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator (BlockVector &parent, const size_type global_index)
 
 internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator (const Iterator< BlockVectorType, !Constness > &c)
 
 internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator (const Iterator &c)
 
 internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator (BlockVector &parent, const size_type global_index, const size_type current_block, const size_type index_within_block, const size_type next_break_forward, const size_type next_break_backward)
 
Iteratorinternal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator= (const Iterator &c)
 
dereference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator* () const
 
dereference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator[] (const difference_type d) const
 
Iteratorinternal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator++ ()
 
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator++ (int)
 
Iteratorinternal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-- ()
 
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-- (int)
 
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator== (const Iterator< BlockVectorType, OtherConstness > &i) const
 
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator!= (const Iterator< BlockVectorType, OtherConstness > &i) const
 
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator< (const Iterator< BlockVectorType, OtherConstness > &i) const
 
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator<= (const Iterator< BlockVectorType, OtherConstness > &i) const
 
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator> (const Iterator< BlockVectorType, OtherConstness > &i) const
 
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator>= (const Iterator< BlockVectorType, OtherConstness > &i) const
 
template<bool OtherConstness>
difference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator- (const Iterator< BlockVectorType, OtherConstness > &i) const
 
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator+ (const difference_type &d) const
 
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator- (const difference_type &d) const
 
Iteratorinternal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator+= (const difference_type &d)
 
Iteratorinternal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-= (const difference_type &d)
 
template<typename MatrixType , typename std::enable_if< has_get_mpi_communicator< MatrixType > &&has_locally_owned_domain_indices< MatrixType >, MatrixType >::type * = nullptr>
static void internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::reinit_domain_vector (MatrixType &mat, LinearAlgebra::distributed::Vector< Number > &vec, bool)
 
template<typename MatrixType , typename std::enable_if< has_get_mpi_communicator< MatrixType > &&has_locally_owned_range_indices< MatrixType >, MatrixType >::type * = nullptr>
static void internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::reinit_range_vector (MatrixType &mat, LinearAlgebra::distributed::Vector< Number > &vec, bool)
 
 LinearAlgebra::Vector< Number >::Vector ()=default
 
 LinearAlgebra::Vector< Number >::Vector (const Vector< Number > &V)
 
 LinearAlgebra::Vector< Number >::Vector (const size_type n)
 
template<typename InputIterator >
 LinearAlgebra::Vector< Number >::Vector (const InputIterator first, const InputIterator last)
 
virtual void LinearAlgebra::Vector< Number >::reinit (const size_type size, const bool omit_zeroing_entries=false) override
 
template<typename Number2 >
void LinearAlgebra::Vector< Number >::reinit (const ReadWriteVector< Number2 > &in_vector, const bool omit_zeroing_entries=false)
 
virtual void LinearAlgebra::Vector< Number >::reinit (const IndexSet &locally_stored_indices, const bool omit_zeroing_entries=false) override
 
virtual void LinearAlgebra::Vector< Number >::reinit (const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false) override
 
bool LinearAlgebra::Vector< Number >::has_ghost_elements () const
 
Vector< Number > & LinearAlgebra::Vector< Number >::operator= (const Vector< Number > &in_vector)
 
template<typename Number2 >
Vector< Number > & LinearAlgebra::Vector< Number >::operator= (const Vector< Number2 > &in_vector)
 
virtual Vector< Number > & LinearAlgebra::Vector< Number >::operator= (const Number s) override
 
virtual Vector< Number > & LinearAlgebra::Vector< Number >::operator*= (const Number factor) override
 
virtual Vector< Number > & LinearAlgebra::Vector< Number >::operator/= (const Number factor) override
 
virtual Vector< Number > & LinearAlgebra::Vector< Number >::operator+= (const VectorSpaceVector< Number > &V) override
 
virtual Vector< Number > & LinearAlgebra::Vector< Number >::operator-= (const VectorSpaceVector< Number > &V) override
 
virtual Number LinearAlgebra::Vector< Number >::operator* (const VectorSpaceVector< Number > &V) const override
 
virtual void LinearAlgebra::Vector< Number >::import (const ReadWriteVector< Number > &V, VectorOperation::values operation, std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > communication_pattern={}) override
 
virtual void LinearAlgebra::Vector< Number >::add (const Number a) override
 
virtual void LinearAlgebra::Vector< Number >::add (const Number a, const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::Vector< Number >::add (const Number a, const VectorSpaceVector< Number > &V, const Number b, const VectorSpaceVector< Number > &W) override
 
virtual void LinearAlgebra::Vector< Number >::sadd (const Number s, const Number a, const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::Vector< Number >::scale (const VectorSpaceVector< Number > &scaling_factors) override
 
virtual void LinearAlgebra::Vector< Number >::equ (const Number a, const VectorSpaceVector< Number > &V) override
 
virtual bool LinearAlgebra::Vector< Number >::all_zero () const override
 
virtual value_type LinearAlgebra::Vector< Number >::mean_value () const override
 
virtual VectorSpaceVector< Number >::real_type LinearAlgebra::Vector< Number >::l1_norm () const override
 
virtual VectorSpaceVector< Number >::real_type LinearAlgebra::Vector< Number >::l2_norm () const override
 
virtual VectorSpaceVector< Number >::real_type LinearAlgebra::Vector< Number >::linfty_norm () const override
 
virtual Number LinearAlgebra::Vector< Number >::add_and_dot (const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W) override
 
virtual size_type LinearAlgebra::Vector< Number >::size () const override
 
virtual ::IndexSet LinearAlgebra::Vector< Number >::locally_owned_elements () const override
 
virtual void LinearAlgebra::Vector< Number >::print (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
 
void LinearAlgebra::Vector< Number >::print_as_numpy_array (std::ostream &out, const unsigned int precision=9) const
 
void LinearAlgebra::Vector< Number >::block_write (std::ostream &out) const
 
void LinearAlgebra::Vector< Number >::block_read (std::istream &in)
 
virtual std::size_t LinearAlgebra::Vector< Number >::memory_consumption () const override
 
template<typename Archive >
void LinearAlgebra::Vector< Number >::serialize (Archive &ar, const unsigned int version)
 
 LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::FunctorTemplate (ReadWriteVector< Number > &parent, const Functor &functor)
 
virtual void LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::operator() (const size_type begin, const size_type end)
 
template<typename Number >
void swap (Vector< Number > &u, Vector< Number > &v)
 
template<typename number >
std::ostream & operator<< (std::ostream &out, const Vector< number > &v)
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::reinit (const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false)=0
 
virtual VectorSpaceVector< Number > & LinearAlgebra::VectorSpaceVector< Number >::operator= (const Number s)=0
 
virtual VectorSpaceVector< Number > & LinearAlgebra::VectorSpaceVector< Number >::operator*= (const Number factor)=0
 
virtual VectorSpaceVector< Number > & LinearAlgebra::VectorSpaceVector< Number >::operator/= (const Number factor)=0
 
virtual VectorSpaceVector< Number > & LinearAlgebra::VectorSpaceVector< Number >::operator+= (const VectorSpaceVector< Number > &V)=0
 
virtual VectorSpaceVector< Number > & LinearAlgebra::VectorSpaceVector< Number >::operator-= (const VectorSpaceVector< Number > &V)=0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::import (const ReadWriteVector< Number > &V, VectorOperation::values operation, std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > communication_pattern={})=0
 
virtual Number LinearAlgebra::VectorSpaceVector< Number >::operator* (const VectorSpaceVector< Number > &V) const =0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::add (const Number a)=0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::add (const Number a, const VectorSpaceVector< Number > &V)=0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::add (const Number a, const VectorSpaceVector< Number > &V, const Number b, const VectorSpaceVector< Number > &W)=0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::sadd (const Number s, const Number a, const VectorSpaceVector< Number > &V)=0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::scale (const VectorSpaceVector< Number > &scaling_factors)=0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::equ (const Number a, const VectorSpaceVector< Number > &V)=0
 
virtual bool LinearAlgebra::VectorSpaceVector< Number >::all_zero () const =0
 
virtual value_type LinearAlgebra::VectorSpaceVector< Number >::mean_value () const =0
 
virtual real_type LinearAlgebra::VectorSpaceVector< Number >::l1_norm () const =0
 
virtual real_type LinearAlgebra::VectorSpaceVector< Number >::l2_norm () const =0
 
virtual real_type LinearAlgebra::VectorSpaceVector< Number >::linfty_norm () const =0
 
virtual Number LinearAlgebra::VectorSpaceVector< Number >::add_and_dot (const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W)=0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::compress (VectorOperation::values)
 
virtual size_type LinearAlgebra::VectorSpaceVector< Number >::size () const =0
 
virtual ::IndexSet LinearAlgebra::VectorSpaceVector< Number >::locally_owned_elements () const =0
 
virtual void LinearAlgebra::VectorSpaceVector< Number >::print (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const =0
 
virtual std::size_t LinearAlgebra::VectorSpaceVector< Number >::memory_consumption () const =0
 
virtual LinearAlgebra::VectorSpaceVector< Number >::~VectorSpaceVector ()=default
 
template<typename Number >
void LinearAlgebra::set_zero_mean_value (VectorSpaceVector< Number > &vector)
 
template<typename Number >
void swap (BlockVector< Number > &u, BlockVector< Number > &v)
 
template<typename Number >
void swap (Vector< Number > &u, Vector< Number > &v)
 
template<typename number >
std::ostream & operator<< (std::ostream &out, const Vector< number > &v)
 

Variables

template<typename T >
constexpr bool internal::has_block = internal::is_supported_operation<has_block_t, T>
 
template<typename T >
constexpr bool internal::has_n_blocks
 
template<typename T >
constexpr bool internal::is_block_vector = has_block<T> &&has_n_blocks<T>
 
static const bool IsBlockVector< VectorType >::value = internal::is_block_vector<VectorType>
 
static constexpr unsigned int LinearAlgebra::distributed::BlockVector< Number >::communication_block_size = 20
 
template<typename T >
static constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_get_mpi_communicator
 
template<typename T >
static constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_locally_owned_domain_indices
 
template<typename T >
static constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_locally_owned_range_indices
 
template<typename T >
static constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_initialize_dof_vector
 
ReadWriteVectorLinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::parent
 
const Functor & LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::functor
 

Friends

template<typename Number2 >
class LinearAlgebra::Vector< Number >::Vector
 

6: Mixed stuff

std::shared_ptr< const Utilities::MPI::PartitionerLinearAlgebra::distributed::Vector< Number, MemorySpace >::partitioner
 
size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::allocated_size
 
mutable ::MemorySpace::MemorySpaceData< Number, MemorySpace > LinearAlgebra::distributed::Vector< Number, MemorySpace >::data
 
std::shared_ptr<::parallel::internal::TBBPartitionerLinearAlgebra::distributed::Vector< Number, MemorySpace >::thread_loop_partitioner
 
mutable ::MemorySpace::MemorySpaceData< Number, MemorySpace > LinearAlgebra::distributed::Vector< Number, MemorySpace >::import_data
 
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::vector_is_ghosted
 
std::vector< MPI_Request > LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress_requests
 
std::vector< MPI_Request > LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values_requests
 
std::mutex LinearAlgebra::distributed::Vector< Number, MemorySpace >::mutex
 
MPI_Comm LinearAlgebra::distributed::Vector< Number, MemorySpace >::comm_sm
 
template<typename Number2 , typename MemorySpace2 >
class LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector
 
template<typename Number2 >
class LinearAlgebra::distributed::Vector< Number, MemorySpace >::BlockVector
 
const MPI_Comm & LinearAlgebra::distributed::Vector< Number, MemorySpace >::get_mpi_communicator () const
 
const std::shared_ptr< const Utilities::MPI::Partitioner > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::get_partitioner () const
 
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::partitioners_are_compatible (const Utilities::MPI::Partitioner &part) const
 
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::partitioners_are_globally_compatible (const Utilities::MPI::Partitioner &part) const
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::set_ghost_state (const bool ghosted) const
 
const std::vector< ArrayView< const Number > > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::shared_vector_data () const
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add_local (const Number a, const VectorSpaceVector< Number > &V)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::sadd_local (const Number s, const Number a, const VectorSpaceVector< Number > &V)
 
template<typename Number2 >
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::inner_product_local (const Vector< Number2, MemorySpace > &V) const
 
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::norm_sqr_local () const
 
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::mean_value_local () const
 
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::l1_norm_local () const
 
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::lp_norm_local (const real_type p) const
 
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::linfty_norm_local () const
 
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::add_and_dot_local (const Number a, const Vector< Number, MemorySpace > &V, const Vector< Number, MemorySpace > &W)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::clear_mpi_requests ()
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::resize_val (const size_type new_allocated_size, const MPI_Comm &comm_sm=MPI_COMM_SELF)
 
static ::ExceptionBaseLinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcVectorTypeNotCompatible ()
 
static ::ExceptionBaseLinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcNotAllowedForCuda ()
 
static ::ExceptionBaseLinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcNonMatchingElements (Number arg1, Number arg2, unsigned int arg3)
 
static ::ExceptionBaseLinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcAccessToNonLocalElement (size_type arg1, size_type arg2, size_type arg3, size_type arg4)
 

3: Modification of vectors

IndexSet LinearAlgebra::ReadWriteVector< Number >::stored_elements
 
IndexSet LinearAlgebra::ReadWriteVector< Number >::source_stored_elements
 
std::shared_ptr< Utilities::MPI::CommunicationPatternBaseLinearAlgebra::ReadWriteVector< Number >::comm_pattern
 
std::unique_ptr< Number[], decltype(std::free) * > LinearAlgebra::ReadWriteVector< Number >::values
 
std::shared_ptr<::parallel::internal::TBBPartitionerLinearAlgebra::ReadWriteVector< Number >::thread_loop_partitioner
 
template<typename Number2 >
class LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector
 
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::add (const std::vector< size_type > &indices, const std::vector< Number2 > &values)
 
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::add (const std::vector< size_type > &indices, const ReadWriteVector< Number2 > &values)
 
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::add (const size_type n_elements, const size_type *indices, const Number2 *values)
 
void LinearAlgebra::ReadWriteVector< Number >::print (std::ostream &out, const unsigned int precision=3, const bool scientific=true) const
 
std::size_t LinearAlgebra::ReadWriteVector< Number >::memory_consumption () const
 
void LinearAlgebra::ReadWriteVector< Number >::import (const Tpetra::Vector< Number, int, types::global_dof_index > &tpetra_vector, const IndexSet &locally_owned_elements, VectorOperation::values operation, const MPI_Comm &mpi_comm, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern)
 
void LinearAlgebra::ReadWriteVector< Number >::import (const Epetra_MultiVector &multivector, const IndexSet &locally_owned_elements, VectorOperation::values operation, const MPI_Comm &mpi_comm, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern)
 
unsigned int LinearAlgebra::ReadWriteVector< Number >::global_to_local (const types::global_dof_index global_index) const
 
void LinearAlgebra::ReadWriteVector< Number >::resize_val (const size_type new_allocated_size)
 
TpetraWrappers::CommunicationPattern LinearAlgebra::ReadWriteVector< Number >::create_tpetra_comm_pattern (const IndexSet &source_index_set, const MPI_Comm &mpi_comm)
 
EpetraWrappers::CommunicationPattern LinearAlgebra::ReadWriteVector< Number >::create_epetra_comm_pattern (const IndexSet &source_index_set, const MPI_Comm &mpi_comm)
 

Information about the object

AlignedVector< Number > Vector< Number >::values
 
std::shared_ptr< parallel::internal::TBBPartitionerVector< Number >::thread_loop_partitioner
 
template<typename Number2 >
class Vector< Number >::Vector
 
bool Vector< Number >::in_local_range (const size_type global_index) const
 
IndexSet Vector< Number >::locally_owned_elements () const
 
size_type Vector< Number >::size () const
 
size_type Vector< Number >::locally_owned_size () const
 
bool Vector< Number >::all_zero () const
 
bool Vector< Number >::is_non_negative () const
 
std::size_t Vector< Number >::memory_consumption () const
 
bool Vector< Number >::has_ghost_elements () const
 
void Vector< Number >::maybe_reset_thread_partitioner ()
 
void Vector< Number >::do_reinit (const size_type new_size, const bool omit_zeroing_entries, const bool reset_partitioner)
 

1: Basic operations

 LinearAlgebra::distributed::BlockVector< Number >::BlockVector (const size_type num_blocks=0, const size_type block_size=0)
 
 LinearAlgebra::distributed::BlockVector< Number >::BlockVector (const BlockVector< Number > &V)
 
template<typename OtherNumber >
 LinearAlgebra::distributed::BlockVector< Number >::BlockVector (const BlockVector< OtherNumber > &v)
 
 LinearAlgebra::distributed::BlockVector< Number >::BlockVector (const std::vector< size_type > &block_sizes)
 
 LinearAlgebra::distributed::BlockVector< Number >::BlockVector (const std::vector< IndexSet > &local_ranges, const std::vector< IndexSet > &ghost_indices, const MPI_Comm &communicator)
 
 LinearAlgebra::distributed::BlockVector< Number >::BlockVector (const std::vector< IndexSet > &local_ranges, const MPI_Comm &communicator)
 
virtual LinearAlgebra::distributed::BlockVector< Number >::~BlockVector () override=default
 
virtual BlockVectorLinearAlgebra::distributed::BlockVector< Number >::operator= (const value_type s) override
 
BlockVectorLinearAlgebra::distributed::BlockVector< Number >::operator= (const BlockVector &V)
 
template<class Number2 >
BlockVectorLinearAlgebra::distributed::BlockVector< Number >::operator= (const BlockVector< Number2 > &V)
 
BlockVectorLinearAlgebra::distributed::BlockVector< Number >::operator= (const Vector< Number > &V)
 
BlockVector< Number > & LinearAlgebra::distributed::BlockVector< Number >::operator= (const PETScWrappers::MPI::BlockVector &petsc_vec)
 
BlockVector< Number > & LinearAlgebra::distributed::BlockVector< Number >::operator= (const TrilinosWrappers::MPI::BlockVector &trilinos_vec)
 
void LinearAlgebra::distributed::BlockVector< Number >::reinit (const size_type num_blocks, const size_type block_size=0, const bool omit_zeroing_entries=false)
 
void LinearAlgebra::distributed::BlockVector< Number >::reinit (const std::vector< size_type > &block_sizes, const bool omit_zeroing_entries=false)
 
template<typename Number2 >
void LinearAlgebra::distributed::BlockVector< Number >::reinit (const BlockVector< Number2 > &V, const bool omit_zeroing_entries=false)
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::compress (::VectorOperation::values operation) override
 
void LinearAlgebra::distributed::BlockVector< Number >::update_ghost_values () const
 
void LinearAlgebra::distributed::BlockVector< Number >::zero_out_ghosts () const
 
void LinearAlgebra::distributed::BlockVector< Number >::zero_out_ghost_values () const
 
bool LinearAlgebra::distributed::BlockVector< Number >::has_ghost_elements () const
 
void LinearAlgebra::distributed::BlockVector< Number >::set_ghost_state (const bool ghosted) const
 
template<typename Number2 >
void LinearAlgebra::distributed::BlockVector< Number >::copy_locally_owned_data_from (const BlockVector< Number2 > &src)
 
template<typename OtherNumber >
void LinearAlgebra::distributed::BlockVector< Number >::add (const std::vector< size_type > &indices, const ::Vector< OtherNumber > &values)
 
void LinearAlgebra::distributed::BlockVector< Number >::sadd (const Number s, const BlockVector< Number > &V)
 
virtual bool LinearAlgebra::distributed::BlockVector< Number >::all_zero () const override
 
virtual Number LinearAlgebra::distributed::BlockVector< Number >::mean_value () const override
 
real_type LinearAlgebra::distributed::BlockVector< Number >::lp_norm (const real_type p) const
 
void LinearAlgebra::distributed::BlockVector< Number >::swap (BlockVector< Number > &v)
 

2: Implementation of VectorSpaceVector

virtual void LinearAlgebra::distributed::BlockVector< Number >::reinit (const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false) override
 
virtual BlockVector< Number > & LinearAlgebra::distributed::BlockVector< Number >::operator*= (const Number factor) override
 
virtual BlockVector< Number > & LinearAlgebra::distributed::BlockVector< Number >::operator/= (const Number factor) override
 
virtual BlockVector< Number > & LinearAlgebra::distributed::BlockVector< Number >::operator+= (const VectorSpaceVector< Number > &V) override
 
virtual BlockVector< Number > & LinearAlgebra::distributed::BlockVector< Number >::operator-= (const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::import (const LinearAlgebra::ReadWriteVector< Number > &V, VectorOperation::values operation, std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > communication_pattern={}) override
 
virtual Number LinearAlgebra::distributed::BlockVector< Number >::operator* (const VectorSpaceVector< Number > &V) const override
 
template<typename FullMatrixType >
void LinearAlgebra::distributed::BlockVector< Number >::multivector_inner_product (FullMatrixType &matrix, const BlockVector< Number > &V, const bool symmetric=false) const
 
template<typename FullMatrixType >
Number LinearAlgebra::distributed::BlockVector< Number >::multivector_inner_product_with_metric (const FullMatrixType &matrix, const BlockVector< Number > &V, const bool symmetric=false) const
 
template<typename FullMatrixType >
void LinearAlgebra::distributed::BlockVector< Number >::mmult (BlockVector< Number > &V, const FullMatrixType &matrix, const Number s=Number(0.), const Number b=Number(1.)) const
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::add (const Number a) override
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::add (const Number a, const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::add (const Number a, const VectorSpaceVector< Number > &V, const Number b, const VectorSpaceVector< Number > &W) override
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::add (const std::vector< size_type > &indices, const std::vector< Number > &values)
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::sadd (const Number s, const Number a, const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::scale (const VectorSpaceVector< Number > &scaling_factors) override
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::equ (const Number a, const VectorSpaceVector< Number > &V) override
 
virtual real_type LinearAlgebra::distributed::BlockVector< Number >::l1_norm () const override
 
virtual real_type LinearAlgebra::distributed::BlockVector< Number >::l2_norm () const override
 
real_type LinearAlgebra::distributed::BlockVector< Number >::norm_sqr () const
 
virtual real_type LinearAlgebra::distributed::BlockVector< Number >::linfty_norm () const override
 
virtual Number LinearAlgebra::distributed::BlockVector< Number >::add_and_dot (const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W) override
 
virtual size_type LinearAlgebra::distributed::BlockVector< Number >::size () const override
 
virtual ::IndexSet LinearAlgebra::distributed::BlockVector< Number >::locally_owned_elements () const override
 
virtual void LinearAlgebra::distributed::BlockVector< Number >::print (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
 
virtual std::size_t LinearAlgebra::distributed::BlockVector< Number >::memory_consumption () const override
 
static ::ExceptionBaseLinearAlgebra::distributed::BlockVector< Number >::ExcVectorTypeNotCompatible ()
 
static ::ExceptionBaseLinearAlgebra::distributed::BlockVector< Number >::ExcIteratorRangeDoesNotMatchVectorSize ()
 

1: Basic Object-handling

 LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ()
 
 LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector (const Vector< Number, MemorySpace > &in_vector)
 
 LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector (Vector< Number, MemorySpace > &&in_vector)
 
 LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector (const size_type size)
 
 LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector (const IndexSet &local_range, const IndexSet &ghost_indices, const MPI_Comm &communicator)
 
 LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector (const IndexSet &local_range, const MPI_Comm &communicator)
 
 LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector (const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner)
 
virtual LinearAlgebra::distributed::Vector< Number, MemorySpace >::~Vector () override
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit (const size_type size, const bool omit_zeroing_entries=false)
 
template<typename Number2 >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit (const Vector< Number2, MemorySpace > &in_vector, const bool omit_zeroing_entries=false)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit (const IndexSet &local_range, const IndexSet &ghost_indices, const MPI_Comm &communicator)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit (const IndexSet &local_range, const MPI_Comm &communicator)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit (const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner, const MPI_Comm &comm_sm=MPI_COMM_SELF)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit (const types::global_dof_index local_size, const types::global_dof_index ghost_size, const MPI_Comm &comm, const MPI_Comm &comm_sm=MPI_COMM_SELF)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::swap (Vector< Number, MemorySpace > &v)
 
Vector< Number, MemorySpace > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator= (const Vector< Number, MemorySpace > &in_vector)
 
template<typename Number2 >
Vector< Number, MemorySpace > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator= (const Vector< Number2, MemorySpace > &in_vector)
 

2: Parallel data exchange

virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress (::VectorOperation::values operation) override
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values () const
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress_start (const unsigned int communication_channel=0, ::VectorOperation::values operation=VectorOperation::add)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress_finish (::VectorOperation::values operation)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values_start (const unsigned int communication_channel=0) const
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values_finish () const
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::zero_out_ghosts () const
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::zero_out_ghost_values () const
 
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::has_ghost_elements () const
 
template<typename Number2 >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::copy_locally_owned_data_from (const Vector< Number2, MemorySpace > &src)
 
template<typename MemorySpace2 >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::import (const Vector< Number, MemorySpace2 > &src, VectorOperation::values operation)
 

3: Implementation of VectorSpaceVector

virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit (const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false) override
 
virtual Vector< Number, MemorySpace > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator*= (const Number factor) override
 
virtual Vector< Number, MemorySpace > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator/= (const Number factor) override
 
virtual Vector< Number, MemorySpace > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator+= (const VectorSpaceVector< Number > &V) override
 
virtual Vector< Number, MemorySpace > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator-= (const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::import (const LinearAlgebra::ReadWriteVector< Number > &V, VectorOperation::values operation, std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > communication_pattern={}) override
 
virtual Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator* (const VectorSpaceVector< Number > &V) const override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add (const Number a) override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add (const Number a, const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add (const Number a, const VectorSpaceVector< Number > &V, const Number b, const VectorSpaceVector< Number > &W) override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add (const std::vector< size_type > &indices, const std::vector< Number > &values)
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::sadd (const Number s, const Number a, const VectorSpaceVector< Number > &V) override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::scale (const VectorSpaceVector< Number > &scaling_factors) override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::equ (const Number a, const VectorSpaceVector< Number > &V) override
 
virtual real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::l1_norm () const override
 
virtual real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::l2_norm () const override
 
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::norm_sqr () const
 
virtual real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::linfty_norm () const override
 
virtual Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::add_and_dot (const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W) override
 
virtual size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::size () const override
 
virtual ::IndexSet LinearAlgebra::distributed::Vector< Number, MemorySpace >::locally_owned_elements () const override
 
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::print (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
 
virtual std::size_t LinearAlgebra::distributed::Vector< Number, MemorySpace >::memory_consumption () const override
 

4: Other vector operations not included in VectorSpaceVector

virtual Vector< Number, MemorySpace > & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator= (const Number s) override
 
template<typename OtherNumber >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add (const std::vector< size_type > &indices, const ::Vector< OtherNumber > &values)
 
template<typename OtherNumber >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add (const size_type n_elements, const size_type *indices, const OtherNumber *values)
 
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::sadd (const Number s, const Vector< Number, MemorySpace > &V)
 

5: Entry access and local data representation

size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::local_size () const
 
size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::locally_owned_size () const
 
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::in_local_range (const size_type global_index) const
 
iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::begin ()
 
const_iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::begin () const
 
iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::end ()
 
const_iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::end () const
 
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator() (const size_type global_index) const
 
Number & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator() (const size_type global_index)
 
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator[] (const size_type global_index) const
 
Number & LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator[] (const size_type global_index)
 
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::local_element (const size_type local_index) const
 
Number & LinearAlgebra::distributed::Vector< Number, MemorySpace >::local_element (const size_type local_index)
 
Number * LinearAlgebra::distributed::Vector< Number, MemorySpace >::get_values () const
 
template<typename OtherNumber >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::extract_subvector_to (const std::vector< size_type > &indices, std::vector< OtherNumber > &values) const
 
template<typename ForwardIterator , typename OutputIterator >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::extract_subvector_to (ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const
 
virtual bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::all_zero () const override
 
virtual Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::mean_value () const override
 
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::lp_norm (const real_type p) const
 

1: Basic Object-handling

 LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector ()
 
 LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector (const ReadWriteVector< Number > &in_vector)
 
 LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector (const size_type size)
 
 LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector (const IndexSet &locally_stored_indices)
 
 LinearAlgebra::ReadWriteVector< Number >::~ReadWriteVector () override=default
 
virtual void LinearAlgebra::ReadWriteVector< Number >::reinit (const size_type size, const bool omit_zeroing_entries=false)
 
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::reinit (const ReadWriteVector< Number2 > &in_vector, const bool omit_zeroing_entries=false)
 
virtual void LinearAlgebra::ReadWriteVector< Number >::reinit (const IndexSet &locally_stored_indices, const bool omit_zeroing_entries=false)
 
void LinearAlgebra::ReadWriteVector< Number >::reinit (const TrilinosWrappers::MPI::Vector &trilinos_vec)
 
template<typename Functor >
void LinearAlgebra::ReadWriteVector< Number >::apply (const Functor &func)
 
void LinearAlgebra::ReadWriteVector< Number >::swap (ReadWriteVector< Number > &v)
 
ReadWriteVector< Number > & LinearAlgebra::ReadWriteVector< Number >::operator= (const ReadWriteVector< Number > &in_vector)
 
template<typename Number2 >
ReadWriteVector< Number > & LinearAlgebra::ReadWriteVector< Number >::operator= (const ReadWriteVector< Number2 > &in_vector)
 
ReadWriteVector< Number > & LinearAlgebra::ReadWriteVector< Number >::operator= (const Number s)
 
void LinearAlgebra::ReadWriteVector< Number >::import (const ::Vector< Number > &vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
void LinearAlgebra::ReadWriteVector< Number >::import (const LinearAlgebra::Vector< Number > &vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
template<typename MemorySpace >
void LinearAlgebra::ReadWriteVector< Number >::import (const distributed::Vector< Number, MemorySpace > &vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
void LinearAlgebra::ReadWriteVector< Number >::import (const PETScWrappers::MPI::Vector &petsc_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
void LinearAlgebra::ReadWriteVector< Number >::import (const TrilinosWrappers::MPI::Vector &trilinos_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
void LinearAlgebra::ReadWriteVector< Number >::import (const TpetraWrappers::Vector< Number > &tpetra_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
void LinearAlgebra::ReadWriteVector< Number >::import (const EpetraWrappers::Vector &epetra_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
void LinearAlgebra::ReadWriteVector< Number >::import (const CUDAWrappers::Vector< Number > &cuda_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
 
size_type LinearAlgebra::ReadWriteVector< Number >::size () const
 
size_type LinearAlgebra::ReadWriteVector< Number >::n_elements () const
 
size_type LinearAlgebra::ReadWriteVector< Number >::locally_owned_size () const
 
const IndexSetLinearAlgebra::ReadWriteVector< Number >::get_stored_elements () const
 
iterator LinearAlgebra::ReadWriteVector< Number >::begin ()
 
const_iterator LinearAlgebra::ReadWriteVector< Number >::begin () const
 
iterator LinearAlgebra::ReadWriteVector< Number >::end ()
 
const_iterator LinearAlgebra::ReadWriteVector< Number >::end () const
 

2: Data-Access

Number LinearAlgebra::ReadWriteVector< Number >::operator() (const size_type global_index) const
 
Number & LinearAlgebra::ReadWriteVector< Number >::operator() (const size_type global_index)
 
Number LinearAlgebra::ReadWriteVector< Number >::operator[] (const size_type global_index) const
 
Number & LinearAlgebra::ReadWriteVector< Number >::operator[] (const size_type global_index)
 
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::extract_subvector_to (const std::vector< size_type > &indices, std::vector< Number2 > &values) const
 
template<typename ForwardIterator , typename OutputIterator >
void LinearAlgebra::ReadWriteVector< Number >::extract_subvector_to (ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const
 
Number LinearAlgebra::ReadWriteVector< Number >::local_element (const size_type local_index) const
 
Number & LinearAlgebra::ReadWriteVector< Number >::local_element (const size_type local_index)
 

Basic object handling

 Vector< Number >::Vector ()
 
 Vector< Number >::Vector (const Vector< Number > &v)
 
 Vector< Number >::Vector (Vector< Number > &&v) noexcept=default
 
template<typename OtherNumber >
 Vector< Number >::Vector (const Vector< OtherNumber > &v)
 
template<typename OtherNumber >
 Vector< Number >::Vector (const std::initializer_list< OtherNumber > &v)
 
 Vector< Number >::Vector (const PETScWrappers::VectorBase &v)
 
 Vector< Number >::Vector (const TrilinosWrappers::MPI::Vector &v)
 
 Vector< Number >::Vector (const size_type n)
 
template<typename InputIterator >
 Vector< Number >::Vector (const InputIterator first, const InputIterator last)
 
virtual Vector< Number >::~Vector () override=default
 
void Vector< Number >::compress (::VectorOperation::values operation=::VectorOperation::unknown) const
 
virtual void Vector< Number >::reinit (const size_type N, const bool omit_zeroing_entries=false)
 
void Vector< Number >::grow_or_shrink (const size_type N)
 
void Vector< Number >::apply_givens_rotation (const std::array< Number, 3 > &csr, const size_type i, const size_type k)
 
template<typename Number2 >
void Vector< Number >::reinit (const Vector< Number2 > &V, const bool omit_zeroing_entries=false)
 
virtual void Vector< Number >::swap (Vector< Number > &v)
 
Vector< Number > & Vector< Number >::operator= (const Number s)
 
Vector< Number > & Vector< Number >::operator= (const Vector< Number > &v)
 
Vector< Number > & Vector< Number >::operator= (Vector< Number > &&v) noexcept=default
 
template<typename Number2 >
Vector< Number > & Vector< Number >::operator= (const Vector< Number2 > &v)
 
Vector< Number > & Vector< Number >::operator= (const BlockVector< Number > &v)
 
Vector< Number > & Vector< Number >::operator= (const PETScWrappers::VectorBase &v)
 
Vector< Number > & Vector< Number >::operator= (const TrilinosWrappers::MPI::Vector &v)
 
template<typename Number2 >
bool Vector< Number >::operator== (const Vector< Number2 > &v) const
 
template<typename Number2 >
bool Vector< Number >::operator!= (const Vector< Number2 > &v) const
 

Scalar products, norms and related operations

template<typename Number2 >
Number Vector< Number >::operator* (const Vector< Number2 > &V) const
 
real_type Vector< Number >::norm_sqr () const
 
Number Vector< Number >::mean_value () const
 
real_type Vector< Number >::l1_norm () const
 
real_type Vector< Number >::l2_norm () const
 
real_type Vector< Number >::lp_norm (const real_type p) const
 
real_type Vector< Number >::linfty_norm () const
 
Number Vector< Number >::add_and_dot (const Number a, const Vector< Number > &V, const Vector< Number > &W)
 

Data access

pointer Vector< Number >::data ()
 
const_pointer Vector< Number >::data () const
 
iterator Vector< Number >::begin ()
 
const_iterator Vector< Number >::begin () const
 
iterator Vector< Number >::end ()
 
const_iterator Vector< Number >::end () const
 
Number Vector< Number >::operator() (const size_type i) const
 
Number & Vector< Number >::operator() (const size_type i)
 
Number Vector< Number >::operator[] (const size_type i) const
 
Number & Vector< Number >::operator[] (const size_type i)
 
template<typename OtherNumber >
void Vector< Number >::extract_subvector_to (const std::vector< size_type > &indices, std::vector< OtherNumber > &values) const
 
template<typename ForwardIterator , typename OutputIterator >
void Vector< Number >::extract_subvector_to (ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const
 

Modification of vectors

Vector< Number > & Vector< Number >::operator+= (const Vector< Number > &V)
 
Vector< Number > & Vector< Number >::operator-= (const Vector< Number > &V)
 
template<typename OtherNumber >
void Vector< Number >::add (const std::vector< size_type > &indices, const std::vector< OtherNumber > &values)
 
template<typename OtherNumber >
void Vector< Number >::add (const std::vector< size_type > &indices, const Vector< OtherNumber > &values)
 
template<typename OtherNumber >
void Vector< Number >::add (const size_type n_elements, const size_type *indices, const OtherNumber *values)
 
void Vector< Number >::add (const Number s)
 
void Vector< Number >::add (const Number a, const Vector< Number > &V, const Number b, const Vector< Number > &W)
 
void Vector< Number >::add (const Number a, const Vector< Number > &V)
 
void Vector< Number >::sadd (const Number s, const Vector< Number > &V)
 
void Vector< Number >::sadd (const Number s, const Number a, const Vector< Number > &V)
 
Vector< Number > & Vector< Number >::operator*= (const Number factor)
 
Vector< Number > & Vector< Number >::operator/= (const Number factor)
 
void Vector< Number >::scale (const Vector< Number > &scaling_factors)
 
template<typename Number2 >
void Vector< Number >::scale (const Vector< Number2 > &scaling_factors)
 
void Vector< Number >::equ (const Number a, const Vector< Number > &u)
 
template<typename Number2 >
void Vector< Number >::equ (const Number a, const Vector< Number2 > &u)
 
void Vector< Number >::update_ghost_values () const
 

Input and output

void Vector< Number >::print (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
 
void Vector< Number >::block_write (std::ostream &out) const
 
void Vector< Number >::block_read (std::istream &in)
 
template<class Archive >
void Vector< Number >::save (Archive &ar, const unsigned int version) const
 
template<class Archive >
void Vector< Number >::load (Archive &ar, const unsigned int version)
 
template<class Archive >
void Vector< Number >::serialize (Archive &archive, const unsigned int version)
 

Detailed Description

Here, we list all the classes that satisfy the VectorType concept and may be used in linear solvers (see Linear solver classes) and for matrix-vector operations.

Typedef Documentation

◆ BaseClass [1/2]

template<typename Number >
using BlockVector< Number >::BaseClass = BlockVectorBase<Vector<Number> >

Typedef the base class for simpler access to its own alias.

Definition at line 76 of file block_vector.h.

◆ BlockType [1/2]

template<typename Number >
using BlockVector< Number >::BlockType = typename BaseClass::BlockType

Typedef the type of the underlying vector.

Definition at line 81 of file block_vector.h.

◆ value_type [1/8]

template<typename Number >
using BlockVector< Number >::value_type = typename BaseClass::value_type

Import the alias from the base class.

Definition at line 86 of file block_vector.h.

◆ real_type [1/6]

template<typename Number >
using BlockVector< Number >::real_type = typename BaseClass::real_type

Definition at line 87 of file block_vector.h.

◆ pointer [1/6]

template<typename Number >
using BlockVector< Number >::pointer = typename BaseClass::pointer

Definition at line 88 of file block_vector.h.

◆ const_pointer [1/5]

template<typename Number >
using BlockVector< Number >::const_pointer = typename BaseClass::const_pointer

Definition at line 89 of file block_vector.h.

◆ reference [1/6]

template<typename Number >
using BlockVector< Number >::reference = typename BaseClass::reference

Definition at line 90 of file block_vector.h.

◆ const_reference [1/5]

template<typename Number >
using BlockVector< Number >::const_reference = typename BaseClass::const_reference

Definition at line 91 of file block_vector.h.

◆ size_type [1/8]

template<typename Number >
using BlockVector< Number >::size_type = typename BaseClass::size_type

Definition at line 92 of file block_vector.h.

◆ iterator [1/5]

template<typename Number >
using BlockVector< Number >::iterator = typename BaseClass::iterator

Definition at line 93 of file block_vector.h.

◆ const_iterator [1/5]

template<typename Number >
using BlockVector< Number >::const_iterator = typename BaseClass::const_iterator

Definition at line 94 of file block_vector.h.

◆ has_block_t

template<typename T >
using internal::has_block_t = typedef decltype(std::declval<T const>().block(0))

Definition at line 48 of file block_vector_base.h.

◆ has_n_blocks_t

template<typename T >
using internal::has_n_blocks_t = typedef decltype(std::declval<T const>().n_blocks())

Definition at line 54 of file block_vector_base.h.

◆ size_type [2/8]

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::size_type = types::global_dof_index

Declare the type for container size.

Definition at line 126 of file block_vector_base.h.

◆ value_type [2/8]

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::value_type = typename std::conditional<Constness, const typename BlockVectorType::value_type, typename BlockVectorType::value_type>::type

Type of the number this iterator points to. Depending on the value of the second template parameter, this is either a constant or non-const number.

Definition at line 133 of file block_vector_base.h.

◆ iterator_category

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::iterator_category = std::random_access_iterator_tag

Declare some aliases that are standard for iterators and are used by algorithms to enquire about the specifics of the iterators they work on. (Example: std::next(), which needs to know about a local type named difference_type.)

Definition at line 144 of file block_vector_base.h.

◆ difference_type

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::difference_type = std::ptrdiff_t

Definition at line 145 of file block_vector_base.h.

◆ reference [2/6]

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::reference = typename BlockVectorType::reference

Definition at line 146 of file block_vector_base.h.

◆ pointer [2/6]

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::pointer = value_type *

Definition at line 147 of file block_vector_base.h.

◆ dereference_type

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::dereference_type = typename std::conditional< Constness, value_type, typename BlockVectorType::BlockType::reference>::type

Definition at line 149 of file block_vector_base.h.

◆ BlockVector

template<class BlockVectorType , bool Constness>
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::BlockVector = typename std:: conditional<Constness, const BlockVectorType, BlockVectorType>::type

Typedef the type of the block vector (which differs in constness, depending on the second template parameter).

Definition at line 158 of file block_vector_base.h.

◆ BaseClass [2/2]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::BaseClass = BlockVectorBase<Vector<Number> >

Typedef the base class for simpler access to its own alias.

Definition at line 105 of file la_parallel_block_vector.h.

◆ BlockType [2/2]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::BlockType = typename BaseClass::BlockType

Typedef the type of the underlying vector.

Definition at line 110 of file la_parallel_block_vector.h.

◆ value_type [3/8]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::value_type = typename BaseClass::value_type

Import the alias from the base class.

Definition at line 115 of file la_parallel_block_vector.h.

◆ real_type [2/6]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::real_type = typename BaseClass::real_type

Definition at line 116 of file la_parallel_block_vector.h.

◆ pointer [3/6]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::pointer = typename BaseClass::pointer

Definition at line 117 of file la_parallel_block_vector.h.

◆ const_pointer [2/5]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::const_pointer = typename BaseClass::const_pointer

Definition at line 118 of file la_parallel_block_vector.h.

◆ reference [3/6]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::reference = typename BaseClass::reference

Definition at line 119 of file la_parallel_block_vector.h.

◆ const_reference [2/5]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::const_reference = typename BaseClass::const_reference

Definition at line 120 of file la_parallel_block_vector.h.

◆ size_type [3/8]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::size_type = typename BaseClass::size_type

Definition at line 121 of file la_parallel_block_vector.h.

◆ iterator [2/5]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::iterator = typename BaseClass::iterator

Definition at line 122 of file la_parallel_block_vector.h.

◆ const_iterator [2/5]

template<typename Number >
using LinearAlgebra::distributed::BlockVector< Number >::const_iterator = typename BaseClass::const_iterator

Definition at line 123 of file la_parallel_block_vector.h.

◆ memory_space

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::memory_space = MemorySpace

Definition at line 254 of file la_parallel_vector.h.

◆ value_type [4/8]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::value_type = Number

Definition at line 255 of file la_parallel_vector.h.

◆ pointer [4/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::pointer = value_type *

Definition at line 256 of file la_parallel_vector.h.

◆ const_pointer [3/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::const_pointer = const value_type *

Definition at line 257 of file la_parallel_vector.h.

◆ iterator [3/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::iterator = value_type *

Definition at line 258 of file la_parallel_vector.h.

◆ const_iterator [3/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::const_iterator = const value_type *

Definition at line 259 of file la_parallel_vector.h.

◆ reference [4/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::reference = value_type &

Definition at line 260 of file la_parallel_vector.h.

◆ const_reference [3/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::const_reference = const value_type &

Definition at line 261 of file la_parallel_vector.h.

◆ size_type [4/8]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::size_type = types::global_dof_index

Definition at line 262 of file la_parallel_vector.h.

◆ real_type [3/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
using LinearAlgebra::distributed::Vector< Number, MemorySpace >::real_type = typename numbers::NumberTraits<Number>::real_type

Definition at line 263 of file la_parallel_vector.h.

◆ get_mpi_communicator_t

template<typename Number >
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::get_mpi_communicator_t = decltype(std::declval<T>().get_mpi_communicator())

Definition at line 1896 of file la_parallel_vector.h.

◆ locally_owned_domain_indices_t

template<typename Number >
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::locally_owned_domain_indices_t = decltype(std::declval<T>().locally_owned_domain_indices())

Definition at line 1906 of file la_parallel_vector.h.

◆ locally_owned_range_indices_t

template<typename Number >
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::locally_owned_range_indices_t = decltype(std::declval<T>().locally_owned_range_indices())

Definition at line 1916 of file la_parallel_vector.h.

◆ initialize_dof_vector_t

template<typename Number >
template<typename T >
using internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::initialize_dof_vector_t = decltype(std::declval<T>().initialize_dof_vector( std::declval<LinearAlgebra::distributed::Vector<Number> &>()))

Definition at line 1926 of file la_parallel_vector.h.

◆ size_type [5/8]

template<typename Number >
using LinearAlgebra::Vector< Number >::size_type = types::global_dof_index

Definition at line 81 of file la_vector.h.

◆ value_type [5/8]

template<typename Number >
using LinearAlgebra::Vector< Number >::value_type = typename ReadWriteVector<Number>::value_type

Definition at line 82 of file la_vector.h.

◆ value_type [6/8]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::value_type = Number

Declare standard types used in all containers. These types parallel those in the C++ standard libraries vector<...> class.

Definition at line 141 of file read_write_vector.h.

◆ pointer [5/6]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::pointer = value_type *

Definition at line 142 of file read_write_vector.h.

◆ const_pointer [4/5]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::const_pointer = const value_type *

Definition at line 143 of file read_write_vector.h.

◆ iterator [4/5]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::iterator = value_type *

Definition at line 144 of file read_write_vector.h.

◆ const_iterator [4/5]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::const_iterator = const value_type *

Definition at line 145 of file read_write_vector.h.

◆ reference [5/6]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::reference = value_type &

Definition at line 146 of file read_write_vector.h.

◆ const_reference [4/5]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::const_reference = const value_type &

Definition at line 147 of file read_write_vector.h.

◆ size_type [6/8]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::size_type = types::global_dof_index

Definition at line 148 of file read_write_vector.h.

◆ real_type [4/6]

template<typename Number >
using LinearAlgebra::ReadWriteVector< Number >::real_type = typename numbers::NumberTraits<Number>::real_type

Definition at line 149 of file read_write_vector.h.

◆ value_type [7/8]

template<typename Number >
using Vector< Number >::value_type = Number

Declare standard types used in all containers. These types parallel those in the C++ standard libraries vector<...> class.

Definition at line 121 of file vector.h.

◆ pointer [6/6]

template<typename Number >
using Vector< Number >::pointer = value_type *

Definition at line 122 of file vector.h.

◆ const_pointer [5/5]

template<typename Number >
using Vector< Number >::const_pointer = const value_type *

Definition at line 123 of file vector.h.

◆ iterator [5/5]

template<typename Number >
using Vector< Number >::iterator = value_type *

Definition at line 124 of file vector.h.

◆ const_iterator [5/5]

template<typename Number >
using Vector< Number >::const_iterator = const value_type *

Definition at line 125 of file vector.h.

◆ reference [6/6]

template<typename Number >
using Vector< Number >::reference = value_type &

Definition at line 126 of file vector.h.

◆ const_reference [5/5]

template<typename Number >
using Vector< Number >::const_reference = const value_type &

Definition at line 127 of file vector.h.

◆ size_type [7/8]

template<typename Number >
using Vector< Number >::size_type = types::global_dof_index

Definition at line 128 of file vector.h.

◆ real_type [5/6]

template<typename Number >
using Vector< Number >::real_type = typename numbers::NumberTraits<Number>::real_type

Declare a type that has holds real-valued numbers with the same precision as the template argument to this class. If the template argument of this class is a real data type, then real_type equals the template argument. If the template argument is a std::complex type then real_type equals the type underlying the complex numbers.

This alias is used to represent the return type of norms.

Definition at line 139 of file vector.h.

◆ value_type [8/8]

template<typename Number >
using LinearAlgebra::VectorSpaceVector< Number >::value_type = Number

Definition at line 58 of file vector_space_vector.h.

◆ size_type [8/8]

template<typename Number >
using LinearAlgebra::VectorSpaceVector< Number >::size_type = types::global_dof_index

Definition at line 59 of file vector_space_vector.h.

◆ real_type [6/6]

template<typename Number >
using LinearAlgebra::VectorSpaceVector< Number >::real_type = typename numbers::NumberTraits<Number>::real_type

Definition at line 60 of file vector_space_vector.h.

Enumeration Type Documentation

◆ values

Enumerator
unknown 

The current operation is unknown.

insert 

The current operation is an insertion.

add 

The current operation is an addition.

min 

The current operation is a minimization.

max 

The current operation is a maximization.

Definition at line 40 of file vector_operation.h.

Function Documentation

◆ BlockVector() [1/14]

template<typename Number >
BlockVector< Number >::BlockVector ( const unsigned int  n_blocks = 0,
const size_type  block_size = 0 
)
explicit

Constructor. There are three ways to use this constructor. First, without any arguments, it generates an object with no blocks. Given one argument, it initializes n_blocks blocks, but these blocks have size zero. The third variant finally initializes all blocks to the same size block_size.

Confer the other constructor further down if you intend to use blocks of different sizes.

◆ BlockVector() [2/14]

template<typename Number >
BlockVector< Number >::BlockVector ( const BlockVector< Number > &  V)

Copy Constructor. Dimension set to that of v, all components are copied from v.

◆ BlockVector() [3/14]

template<typename Number >
BlockVector< Number >::BlockVector ( BlockVector< Number > &&  )
defaultnoexcept

Move constructor. Creates a new vector by stealing the internal data of the given argument vector.

◆ BlockVector() [4/14]

template<typename Number >
template<typename OtherNumber >
BlockVector< Number >::BlockVector ( const BlockVector< OtherNumber > &  v)
explicit

Copy constructor taking a BlockVector of another data type. This will fail if there is no conversion path from OtherNumber to Number. Note that you may lose accuracy when copying to a BlockVector with data elements with less accuracy.

◆ BlockVector() [5/14]

template<typename Number >
BlockVector< Number >::BlockVector ( const TrilinosWrappers::MPI::BlockVector< Number > &  v)

A copy constructor taking a (parallel) Trilinos block vector and copying it into the deal.II own format.

◆ BlockVector() [6/14]

template<typename Number >
BlockVector< Number >::BlockVector ( const std::vector< size_type > &  block_sizes)

Constructor. Set the number of blocks to block_sizes.size() and initialize each block with block_sizes[i] zero elements.

◆ BlockVector() [7/14]

template<typename Number >
BlockVector< Number >::BlockVector ( const BlockIndices block_indices)

Constructor. Initialize vector to the structure found in the BlockIndices argument.

◆ BlockVector() [8/14]

template<typename Number >
template<typename InputIterator >
BlockVector< Number >::BlockVector ( const std::vector< size_type > &  block_sizes,
const InputIterator  first,
const InputIterator  end 
)

Constructor. Set the number of blocks to block_sizes.size(). Initialize the vector with the elements pointed to by the range of iterators given as second and third argument. Apart from the first argument, this constructor is in complete analogy to the respective constructor of the std::vector class, but the first argument is needed in order to know how to subdivide the block vector into different blocks.

◆ ~BlockVector() [1/2]

template<typename Number >
BlockVector< Number >::~BlockVector ( )
overridedefault

Destructor. Clears memory

◆ compress() [1/5]

template<typename Number >
void BlockVector< Number >::compress ( ::VectorOperation::values  operation = ::VectorOperation::unknown)

Call the compress() function on all the subblocks.

This functionality only needs to be called if using MPI based vectors and exists in other objects for compatibility.

See Compressing distributed objects for more information.

◆ has_ghost_elements() [1/5]

template<typename Number >
bool BlockVector< Number >::has_ghost_elements ( ) const

Returns false as this is a serial block vector.

This functionality only needs to be called if using MPI based vectors and exists in other objects for compatibility.

◆ operator=() [1/30]

template<typename Number >
BlockVector& BlockVector< Number >::operator= ( const value_type  s)

Copy operator: fill all components of the vector with the given scalar value.

◆ operator=() [2/30]

template<typename Number >
BlockVector<Number>& BlockVector< Number >::operator= ( const BlockVector< Number > &  v)

Copy operator for arguments of the same type. Resize the present vector if necessary.

◆ operator=() [3/30]

template<typename Number >
BlockVector<Number>& BlockVector< Number >::operator= ( BlockVector< Number > &&  )
default

Move the given vector. This operator replaces the present vector with the contents of the given argument vector.

◆ operator=() [4/30]

template<typename Number >
template<class Number2 >
BlockVector<Number>& BlockVector< Number >::operator= ( const BlockVector< Number2 > &  V)

Copy operator for template arguments of different types. Resize the present vector if necessary.

◆ operator=() [5/30]

template<typename Number >
BlockVector<Number>& BlockVector< Number >::operator= ( const Vector< Number > &  V)

Copy a regular vector into a block vector.

◆ operator=() [6/30]

template<typename Number >
BlockVector<Number>& BlockVector< Number >::operator= ( const TrilinosWrappers::MPI::BlockVector< Number > &  V)

A copy constructor from a Trilinos block vector to a deal.II block vector.

◆ reinit() [1/26]

template<typename Number >
void BlockVector< Number >::reinit ( const unsigned int  n_blocks,
const size_type  block_size = 0,
const bool  omit_zeroing_entries = false 
)

Reinitialize the BlockVector to contain n_blocks blocks of size block_size each.

If the second argument is left at its default value, then the block vector allocates the specified number of blocks but leaves them at zero size. You then need to later reinitialize the individual blocks, and call collect_sizes() to update the block system's knowledge of its individual block's sizes.

If omit_zeroing_entries==false, the vector is filled with zeros.

◆ reinit() [2/26]

template<typename Number >
void BlockVector< Number >::reinit ( const std::vector< size_type > &  block_sizes,
const bool  omit_zeroing_entries = false 
)

Reinitialize the BlockVector such that it contains block_sizes.size() blocks. Each block is reinitialized to dimension block_sizes[i].

If the number of blocks is the same as before this function was called, all vectors remain the same and reinit() is called for each vector.

If omit_zeroing_entries==false, the vector is filled with zeros.

Note that you must call this (or the other reinit() functions) function, rather than calling the reinit() functions of an individual block, to allow the block vector to update its caches of vector sizes. If you call reinit() on one of the blocks, then subsequent actions on this object may yield unpredictable results since they may be routed to the wrong block.

◆ reinit() [3/26]

template<typename Number >
void BlockVector< Number >::reinit ( const BlockIndices block_indices,
const bool  omit_zeroing_entries = false 
)

Reinitialize the BlockVector to reflect the structure found in BlockIndices.

If the number of blocks is the same as before this function was called, all vectors remain the same and reinit() is called for each vector.

If omit_zeroing_entries==false, the vector is filled with zeros.

◆ reinit() [4/26]

template<typename Number >
template<typename Number2 >
void BlockVector< Number >::reinit ( const BlockVector< Number2 > &  V,
const bool  omit_zeroing_entries = false 
)

Change the dimension to that of the vector V. The same applies as for the other reinit() function.

The elements of V are not copied, i.e. this function is the same as calling reinit (V.size(), omit_zeroing_entries).

Note that you must call this (or the other reinit() functions) function, rather than calling the reinit() functions of an individual block, to allow the block vector to update its caches of vector sizes. If you call reinit() of one of the blocks, then subsequent actions of this object may yield unpredictable results since they may be routed to the wrong block.

◆ scale() [1/7]

template<typename Number >
template<class BlockVector2 >
void BlockVector< Number >::scale ( const BlockVector2 &  v)

Multiply each element of this vector by the corresponding element of v.

◆ swap() [1/9]

template<typename Number >
void BlockVector< Number >::swap ( BlockVector< Number > &  v)

Swap the contents of this vector and the other vector v. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.

This function is analogous to the swap() function of all C++ standard containers. Also, there is a global function swap(u,v) that simply calls u.swap(v), again in analogy to standard functions.

◆ print() [1/7]

template<typename Number >
void BlockVector< Number >::print ( std::ostream &  out,
const unsigned int  precision = 3,
const bool  scientific = true,
const bool  across = true 
) const

Print to a stream.

◆ block_write() [1/3]

template<typename Number >
void BlockVector< Number >::block_write ( std::ostream &  out) const

Write the vector en bloc to a stream. This is done in a binary mode, so the output is neither readable by humans nor (probably) by other computers using a different operating system or number format.

◆ block_read() [1/3]

template<typename Number >
void BlockVector< Number >::block_read ( std::istream &  in)

Read a vector en block from a file. This is done using the inverse operations to the above function, so it is reasonably fast because the bitstream is not interpreted.

The vector is resized if necessary.

A primitive form of error checking is performed which will recognize the bluntest attempts to interpret some data as a vector stored bitwise to a file, but not more.

◆ swap() [2/9]

template<typename Number >
void swap ( BlockVector< Number > &  u,
BlockVector< Number > &  v 
)
inline

Global function which overloads the default implementation of the C++ standard library which uses a temporary object. The function simply exchanges the data of the two vectors.

Definition at line 483 of file block_vector.h.

◆ Iterator() [1/4]

template<class BlockVectorType , bool Constness>
internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator ( BlockVector parent,
const size_type  global_index 
)

Construct an iterator from a vector to which we point and the global index of the element pointed to.

Depending on the value of the Constness template argument of this class, the first argument of this constructor is either is a const or non-const reference.

◆ Iterator() [2/4]

template<class BlockVectorType , bool Constness>
internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator ( const Iterator< BlockVectorType, !Constness > &  c)

Copy constructor from an iterator of different constness.

Note
Constructing a non-const iterator from a const iterator does not make sense. Attempting this will result in a compile-time error (via static_assert).

◆ Iterator() [3/4]

template<class BlockVectorType , bool Constness>
internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator ( const Iterator< BlockVectorType, Constness > &  c)

Copy constructor from an iterator with the same constness.

◆ Iterator() [4/4]

template<class BlockVectorType , bool Constness>
internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator ( BlockVector parent,
const size_type  global_index,
const size_type  current_block,
const size_type  index_within_block,
const size_type  next_break_forward,
const size_type  next_break_backward 
)
private

Constructor used internally in this class. The arguments match exactly the values of the respective member variables.

◆ operator=() [7/30]

template<class BlockVectorType , bool Constness>
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator= ( const Iterator< BlockVectorType, Constness > &  c)

Copy operator.

◆ operator*() [1/6]

template<class BlockVectorType , bool Constness>
dereference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator* ( ) const

Dereferencing operator. If the template argument Constness is true, then no writing to the result is possible, making this a const_iterator.

◆ operator[]() [1/7]

template<class BlockVectorType , bool Constness>
dereference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator[] ( const difference_type  d) const

Random access operator, grant access to arbitrary elements relative to the one presently pointed to.

◆ operator++() [1/2]

template<class BlockVectorType , bool Constness>
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator++ ( )

Prefix increment operator. This operator advances the iterator to the next element and returns a reference to *this.

◆ operator++() [2/2]

template<class BlockVectorType , bool Constness>
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator++ ( int  )

Postfix increment operator. This operator advances the iterator to the next element and returns a copy of the old value of this iterator.

◆ operator--() [1/2]

template<class BlockVectorType , bool Constness>
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-- ( )

Prefix decrement operator. This operator retracts the iterator to the previous element and returns a reference to *this.

◆ operator--() [2/2]

template<class BlockVectorType , bool Constness>
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-- ( int  )

Postfix decrement operator. This operator retracts the iterator to the previous element and returns a copy of the old value of this iterator.

◆ operator==() [1/2]

template<class BlockVectorType , bool Constness>
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator== ( const Iterator< BlockVectorType, OtherConstness > &  i) const

Compare for equality of iterators. This operator checks whether the vectors pointed to are the same, and if not it throws an exception.

◆ operator!=() [1/2]

template<class BlockVectorType , bool Constness>
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator!= ( const Iterator< BlockVectorType, OtherConstness > &  i) const

Compare for inequality of iterators. This operator checks whether the vectors pointed to are the same, and if not it throws an exception.

◆ operator<()

template<class BlockVectorType , bool Constness>
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator< ( const Iterator< BlockVectorType, OtherConstness > &  i) const

Check whether this iterators points to an element previous to the one pointed to by the given argument. This operator checks whether the vectors pointed to are the same, and if not it throws an exception.

◆ operator<=()

template<class BlockVectorType , bool Constness>
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator<= ( const Iterator< BlockVectorType, OtherConstness > &  i) const

Comparison operator alike to the one above.

◆ operator>()

template<class BlockVectorType , bool Constness>
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator> ( const Iterator< BlockVectorType, OtherConstness > &  i) const

Comparison operator alike to the one above.

◆ operator>=()

template<class BlockVectorType , bool Constness>
template<bool OtherConstness>
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator>= ( const Iterator< BlockVectorType, OtherConstness > &  i) const

Comparison operator alike to the one above.

◆ operator-() [1/2]

template<class BlockVectorType , bool Constness>
template<bool OtherConstness>
difference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator- ( const Iterator< BlockVectorType, OtherConstness > &  i) const

Return the distance between the two iterators, in elements.

◆ operator+()

template<class BlockVectorType , bool Constness>
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator+ ( const difference_type d) const

Return an iterator which is the given number of elements in front of the present one.

◆ operator-() [2/2]

template<class BlockVectorType , bool Constness>
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator- ( const difference_type d) const

Return an iterator which is the given number of elements behind the present one.

◆ operator+=() [1/6]

template<class BlockVectorType , bool Constness>
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator+= ( const difference_type d)

Move the iterator d elements forward at once, and return the result.

◆ operator-=() [1/6]

template<class BlockVectorType , bool Constness>
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-= ( const difference_type d)

Move the iterator d elements backward at once, and return the result.

◆ BlockVector() [9/14]

template<typename Number >
LinearAlgebra::distributed::BlockVector< Number >::BlockVector ( const size_type  num_blocks = 0,
const size_type  block_size = 0 
)
explicit

Constructor. There are three ways to use this constructor. First, without any arguments, it generates an object with no blocks. Given one argument, it initializes num_blocks blocks, but these blocks have size zero. The third variant finally initializes all blocks to the same size block_size.

Confer the other constructor further down if you intend to use blocks of different sizes.

◆ BlockVector() [10/14]

template<typename Number >
LinearAlgebra::distributed::BlockVector< Number >::BlockVector ( const BlockVector< Number > &  V)

Copy-Constructor. Dimension set to that of V, all components are copied from V

◆ BlockVector() [11/14]

template<typename Number >
template<typename OtherNumber >
LinearAlgebra::distributed::BlockVector< Number >::BlockVector ( const BlockVector< OtherNumber > &  v)
explicit

Copy constructor taking a BlockVector of another data type. This will fail if there is no conversion path from OtherNumber to Number. Note that you may lose accuracy when copying to a BlockVector with data elements with less accuracy.

◆ BlockVector() [12/14]

template<typename Number >
LinearAlgebra::distributed::BlockVector< Number >::BlockVector ( const std::vector< size_type > &  block_sizes)

Constructor. Set the number of blocks to block_sizes.size() and initialize each block with block_sizes[i] zero elements.

◆ BlockVector() [13/14]

template<typename Number >
LinearAlgebra::distributed::BlockVector< Number >::BlockVector ( const std::vector< IndexSet > &  local_ranges,
const std::vector< IndexSet > &  ghost_indices,
const MPI_Comm &  communicator 
)

Construct a block vector with an IndexSet for the local range and ghost entries for each block.

◆ BlockVector() [14/14]

template<typename Number >
LinearAlgebra::distributed::BlockVector< Number >::BlockVector ( const std::vector< IndexSet > &  local_ranges,
const MPI_Comm &  communicator 
)

Same as above but the ghost indices are assumed to be empty.

◆ ~BlockVector() [2/2]

template<typename Number >
virtual LinearAlgebra::distributed::BlockVector< Number >::~BlockVector ( )
overridevirtualdefault

Destructor.

Note
We need to explicitly provide a destructor, otherwise the linker may think it is unused and discards it, although required in a different section. The Intel compiler is prone to this behavior.

◆ operator=() [8/30]

template<typename Number >
virtual BlockVector& LinearAlgebra::distributed::BlockVector< Number >::operator= ( const value_type  s)
overridevirtual

Copy operator: fill all components of the vector with the given scalar value.

◆ operator=() [9/30]

template<typename Number >
BlockVector& LinearAlgebra::distributed::BlockVector< Number >::operator= ( const BlockVector< Number > &  V)

Copy operator for arguments of the same type. Resize the present vector if necessary.

◆ operator=() [10/30]

template<typename Number >
template<class Number2 >
BlockVector& LinearAlgebra::distributed::BlockVector< Number >::operator= ( const BlockVector< Number2 > &  V)

Copy operator for template arguments of different types. Resize the present vector if necessary.

◆ operator=() [11/30]

template<typename Number >
BlockVector& LinearAlgebra::distributed::BlockVector< Number >::operator= ( const Vector< Number > &  V)

Copy a regular vector into a block vector.

◆ operator=() [12/30]

template<typename Number >
BlockVector<Number>& LinearAlgebra::distributed::BlockVector< Number >::operator= ( const PETScWrappers::MPI::BlockVector< Number > &  petsc_vec)

Copy the content of a PETSc vector into the calling vector. This function assumes that the vectors layouts have already been initialized to match.

This operator is only available if deal.II was configured with PETSc.

◆ operator=() [13/30]

template<typename Number >
BlockVector<Number>& LinearAlgebra::distributed::BlockVector< Number >::operator= ( const TrilinosWrappers::MPI::BlockVector< Number > &  trilinos_vec)

Copy the content of a Trilinos vector into the calling vector. This function assumes that the vectors layouts have already been initialized to match.

This operator is only available if deal.II was configured with Trilinos.

◆ reinit() [5/26]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::reinit ( const size_type  num_blocks,
const size_type  block_size = 0,
const bool  omit_zeroing_entries = false 
)

Reinitialize the BlockVector to contain num_blocks blocks of size block_size each.

If the second argument is left at its default value, then the block vector allocates the specified number of blocks but leaves them at zero size. You then need to later reinitialize the individual blocks, and call collect_sizes() to update the block system's knowledge of its individual block's sizes.

If omit_zeroing_entries==false, the vector is filled with zeros.

◆ reinit() [6/26]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::reinit ( const std::vector< size_type > &  block_sizes,
const bool  omit_zeroing_entries = false 
)

Reinitialize the BlockVector such that it contains block_sizes.size() blocks. Each block is reinitialized to dimension block_sizes[i].

If the number of blocks is the same as before this function was called, all vectors remain the same and reinit() is called for each vector.

If omit_zeroing_entries==false, the vector is filled with zeros.

Note that you must call this (or the other reinit() functions) function, rather than calling the reinit() functions of an individual block, to allow the block vector to update its caches of vector sizes. If you call reinit() on one of the blocks, then subsequent actions on this object may yield unpredictable results since they may be routed to the wrong block.

◆ reinit() [7/26]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::distributed::BlockVector< Number >::reinit ( const BlockVector< Number2 > &  V,
const bool  omit_zeroing_entries = false 
)

Change the dimension to that of the vector V. The same applies as for the other reinit() function.

The elements of V are not copied, i.e. this function is the same as calling reinit (V.size(), omit_zeroing_entries).

Note that you must call this (or the other reinit() functions) function, rather than calling the reinit() functions of an individual block, to allow the block vector to update its caches of vector sizes. If you call reinit() of one of the blocks, then subsequent actions of this object may yield unpredictable results since they may be routed to the wrong block.

◆ compress() [2/5]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::compress ( ::VectorOperation::values  operation)
overridevirtual

This function copies the data that has accumulated in the data buffer for ghost indices to the owning processor. For the meaning of the argument operation, see the entry on Compressing distributed vectors and matrices in the glossary.

There are two variants for this function. If called with argument VectorOperation::add adds all the data accumulated in ghost elements to the respective elements on the owning processor and clears the ghost array afterwards. If called with argument VectorOperation::insert, a set operation is performed. Since setting elements in a vector with ghost elements is ambiguous (as one can set both the element on the ghost site as well as the owning site), this operation makes the assumption that all data is set correctly on the owning processor. Upon call of compress(VectorOperation::insert), all ghost entries are therefore simply zeroed out (using zero_ghost_values()). In debug mode, a check is performed that makes sure that the data set is actually consistent between processors, i.e., whenever a non-zero ghost element is found, it is compared to the value on the owning processor and an exception is thrown if these elements do not agree.

◆ update_ghost_values() [1/3]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::update_ghost_values ( ) const

Fills the data field for ghost indices with the values stored in the respective positions of the owning processor. This function is needed before reading from ghosts. The function is const even though ghost data is changed. This is needed to allow functions with a const vector to perform the data exchange without creating temporaries.

◆ zero_out_ghosts() [1/2]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::zero_out_ghosts ( ) const

This method zeros the entries on ghost dofs, but does not touch locally owned DoFs.

After calling this method, read access to ghost elements of the vector is forbidden and an exception is thrown. Only write access to ghost elements is allowed in this state.

Deprecated:
Use zero_out_ghost_values() instead.

◆ zero_out_ghost_values() [1/2]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::zero_out_ghost_values ( ) const

This method zeros the entries on ghost dofs, but does not touch locally owned DoFs.

After calling this method, read access to ghost elements of the vector is forbidden and an exception is thrown. Only write access to ghost elements is allowed in this state.

◆ has_ghost_elements() [2/5]

template<typename Number >
bool LinearAlgebra::distributed::BlockVector< Number >::has_ghost_elements ( ) const

Return if any of the blocks in this vector contains ghost elements.

◆ set_ghost_state() [1/2]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::set_ghost_state ( const bool  ghosted) const

Change the ghost state of all blocks in this vector to ghosted.

◆ copy_locally_owned_data_from() [1/2]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::distributed::BlockVector< Number >::copy_locally_owned_data_from ( const BlockVector< Number2 > &  src)

This method copies the data in the locally owned range from another distributed vector src into the calling vector. As opposed to operator= that also includes ghost entries, this operation ignores the ghost range. The only prerequisite is that the local range on the calling vector and the given vector src are the same on all processors. It is explicitly allowed that the two vectors have different ghost elements that might or might not be related to each other.

Since no data exchange is performed, make sure that neither src nor the calling vector have pending communications in order to obtain correct results.

◆ add() [1/26]

template<typename Number >
template<typename OtherNumber >
void LinearAlgebra::distributed::BlockVector< Number >::add ( const std::vector< size_type > &  indices,
const ::Vector< OtherNumber > &  values 
)

This is a collective add operation that adds a whole set of values stored in values to the vector components specified by indices.

◆ sadd() [1/8]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::sadd ( const Number  s,
const BlockVector< Number > &  V 
)

Scaling and simple vector addition, i.e. this = s(*this)+V.

◆ all_zero() [1/5]

template<typename Number >
virtual bool LinearAlgebra::distributed::BlockVector< Number >::all_zero ( ) const
overridevirtual

Return whether the vector contains only elements with value zero. This function is mainly for internal consistency checks and should seldom be used when not in debug mode since it uses quite some time.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ mean_value() [1/5]

template<typename Number >
virtual Number LinearAlgebra::distributed::BlockVector< Number >::mean_value ( ) const
overridevirtual

Compute the mean value of all the entries in the vector.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ lp_norm() [1/3]

template<typename Number >
real_type LinearAlgebra::distributed::BlockVector< Number >::lp_norm ( const real_type  p) const

\(l_p\)-norm of the vector. The pth root of the sum of the pth powers of the absolute values of the elements.

◆ swap() [3/9]

template<typename Number >
void LinearAlgebra::distributed::BlockVector< Number >::swap ( BlockVector< Number > &  v)

Swap the contents of this vector and the other vector v. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.

Limitation: right now this function only works if both vectors have the same number of blocks. If needed, the numbers of blocks should be exchanged, too.

This function is analogous to the swap() function of all C++ standard containers. Also, there is a global function swap(u,v) that simply calls u.swap(v), again in analogy to standard functions.

◆ reinit() [8/26]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::reinit ( const VectorSpaceVector< Number > &  V,
const bool  omit_zeroing_entries = false 
)
overridevirtual

Change the dimension to that of the vector V. The elements of V are not copied.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator*=() [1/5]

template<typename Number >
virtual BlockVector<Number>& LinearAlgebra::distributed::BlockVector< Number >::operator*= ( const Number  factor)
overridevirtual

Multiply the entire vector by a fixed factor.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator/=() [1/5]

template<typename Number >
virtual BlockVector<Number>& LinearAlgebra::distributed::BlockVector< Number >::operator/= ( const Number  factor)
overridevirtual

Divide the entire vector by a fixed factor.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator+=() [2/6]

template<typename Number >
virtual BlockVector<Number>& LinearAlgebra::distributed::BlockVector< Number >::operator+= ( const VectorSpaceVector< Number > &  V)
overridevirtual

Add the vector V to the present one.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator-=() [2/6]

template<typename Number >
virtual BlockVector<Number>& LinearAlgebra::distributed::BlockVector< Number >::operator-= ( const VectorSpaceVector< Number > &  V)
overridevirtual

Subtract the vector V from the present one.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ import() [1/15]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::import ( const LinearAlgebra::ReadWriteVector< Number > &  V,
VectorOperation::values  operation,
std::shared_ptr< const Utilities::MPI::CommunicationPatternBase communication_pattern = {} 
)
overridevirtual

Import all the elements present in the vector's IndexSet from the input vector V. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator*() [2/6]

template<typename Number >
virtual Number LinearAlgebra::distributed::BlockVector< Number >::operator* ( const VectorSpaceVector< Number > &  V) const
overridevirtual

Return the scalar product of two vectors.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ multivector_inner_product()

template<typename Number >
template<typename FullMatrixType >
void LinearAlgebra::distributed::BlockVector< Number >::multivector_inner_product ( FullMatrixType &  matrix,
const BlockVector< Number > &  V,
const bool  symmetric = false 
) const

Calculate the scalar product between each block of this vector and V and store the result in a full matrix matrix. This function computes the result by forming \(A_{ij}=U_i \cdot V_j\) where \(U_i\) and \(V_j\) indicate the \(i\)th block (not element!) of \(U\) and the \(j\)th block of \(V\), respectively. If symmetric is true, it is assumed that inner product results in a square symmetric matrix and almost half of the scalar products can be avoided.

Obviously, this function can only be used if all blocks of both vectors are of the same size.

Note
Internally, a single global reduction will be called to accumulate scalar product between locally owned degrees of freedom.

◆ multivector_inner_product_with_metric()

template<typename Number >
template<typename FullMatrixType >
Number LinearAlgebra::distributed::BlockVector< Number >::multivector_inner_product_with_metric ( const FullMatrixType &  matrix,
const BlockVector< Number > &  V,
const bool  symmetric = false 
) const

Calculate the scalar product between each block of this vector and V using a metric tensor matrix. This function computes the result of \( \sum_{ij} A^{ij} U_i \cdot V_j\) where \(U_i\) and \(V_j\) indicate the \(i\)th block (not element) of \(U\) and the \(j\)th block of \(V\), respectively. If symmetric is true, it is assumed that \(U_i \cdot V_j\) and \(A^{ij}\) are symmetric matrices and almost half of the scalar products can be avoided.

Obviously, this function can only be used if all blocks of both vectors are of the same size.

Note
Internally, a single global reduction will be called to accumulate the scalar product between locally owned degrees of freedom.

◆ mmult()

template<typename Number >
template<typename FullMatrixType >
void LinearAlgebra::distributed::BlockVector< Number >::mmult ( BlockVector< Number > &  V,
const FullMatrixType &  matrix,
const Number  s = Number(0.),
const Number  b = Number(1.) 
) const

Set each block of this vector as follows: \(V^i = s V^i + b \sum_{j} U_j A^{ji}\) where \(V^i\) and \(U_j\) indicate the \(i\)th block (not element) of \(V\) and the \(j\)th block of \(U\), respectively.

Obviously, this function can only be used if all blocks of both vectors are of the same size.

◆ add() [2/26]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::add ( const Number  a)
overridevirtual

Add a to all components. Note that a is a scalar not a vector.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [3/26]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::add ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Simple addition of a multiple of a vector, i.e. *this += a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [4/26]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::add ( const Number  a,
const VectorSpaceVector< Number > &  V,
const Number  b,
const VectorSpaceVector< Number > &  W 
)
overridevirtual

Multiple addition of scaled vectors, i.e. *this += a*V+b*W.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [5/26]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::add ( const std::vector< size_type > &  indices,
const std::vector< Number > &  values 
)
virtual

A collective add operation: This function adds a whole set of values stored in values to the vector components specified by indices.

◆ sadd() [2/8]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::sadd ( const Number  s,
const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Scaling and simple addition of a multiple of a vector, i.e. this = s(*this)+a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ scale() [2/7]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::scale ( const VectorSpaceVector< Number > &  scaling_factors)
overridevirtual

Scale each element of this vector by the corresponding element in the argument. This function is mostly meant to simulate multiplication (and immediate re-assignment) by a diagonal scaling matrix.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ equ() [1/6]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::equ ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Assignment *this = a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ l1_norm() [1/5]

template<typename Number >
virtual real_type LinearAlgebra::distributed::BlockVector< Number >::l1_norm ( ) const
overridevirtual

Return the l1 norm of the vector (i.e., the sum of the absolute values of all entries among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ l2_norm() [1/5]

template<typename Number >
virtual real_type LinearAlgebra::distributed::BlockVector< Number >::l2_norm ( ) const
overridevirtual

Return the \(l_2\) norm of the vector (i.e., the square root of the sum of the square of all entries among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ norm_sqr() [1/3]

template<typename Number >
real_type LinearAlgebra::distributed::BlockVector< Number >::norm_sqr ( ) const

Return the square of the \(l_2\) norm of the vector.

◆ linfty_norm() [1/5]

template<typename Number >
virtual real_type LinearAlgebra::distributed::BlockVector< Number >::linfty_norm ( ) const
overridevirtual

Return the maximum norm of the vector (i.e., the maximum absolute value among all entries and among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add_and_dot() [1/5]

template<typename Number >
virtual Number LinearAlgebra::distributed::BlockVector< Number >::add_and_dot ( const Number  a,
const VectorSpaceVector< Number > &  V,
const VectorSpaceVector< Number > &  W 
)
overridevirtual

Perform a combined operation of a vector addition and a subsequent inner product, returning the value of the inner product. In other words, the result of this function is the same as if the user called

this->add(a, V);
return_value = *this * W;
void add(const std::vector< size_type > &indices, const ::Vector< OtherNumber > &values)
static const char V

The reason this function exists is that this operation involves less memory transfer than calling the two functions separately. This method only needs to load three vectors, this, V, W, whereas calling separate methods means to load the calling vector this twice. Since most vector operations are memory transfer limited, this reduces the time by 25% (or 50% if W equals this).

For complex-valued vectors, the scalar product in the second step is implemented as \(\left<v,w\right>=\sum_i v_i \bar{w_i}\).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ size() [1/6]

template<typename Number >
virtual size_type LinearAlgebra::distributed::BlockVector< Number >::size ( ) const
overridevirtual

Return the global size of the vector, equal to the sum of the number of locally owned indices among all processors.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ locally_owned_elements() [1/5]

template<typename Number >
virtual ::IndexSet LinearAlgebra::distributed::BlockVector< Number >::locally_owned_elements ( ) const
overridevirtual

Return an index set that describes which elements of this vector are owned by the current processor. As a consequence, the index sets returned on different processors if this is a distributed vector will form disjoint sets that add up to the complete index set. Obviously, if a vector is created on only one processor, then the result would satisfy

vec.locally_owned_elements() == complete_index_set(vec.size())
IndexSet complete_index_set(const IndexSet::size_type N)
Definition: index_set.h:1063

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ print() [2/7]

template<typename Number >
virtual void LinearAlgebra::distributed::BlockVector< Number >::print ( std::ostream &  out,
const unsigned int  precision = 3,
const bool  scientific = true,
const bool  across = true 
) const
overridevirtual

Print the vector to the output stream out.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ memory_consumption() [1/6]

template<typename Number >
virtual std::size_t LinearAlgebra::distributed::BlockVector< Number >::memory_consumption ( ) const
overridevirtual

Return the memory consumption of this class in bytes.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ Vector() [1/20]

template<typename Number , typename MemorySpace = MemorySpace::Host>
LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ( )

Empty constructor.

◆ Vector() [2/20]

template<typename Number , typename MemorySpace = MemorySpace::Host>
LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ( const Vector< Number, MemorySpace > &  in_vector)

Copy constructor. Uses the parallel partitioning of in_vector. It should be noted that this constructor automatically sets ghost values to zero. Call update_ghost_values() directly following construction if a ghosted vector is required.

◆ Vector() [3/20]

template<typename Number , typename MemorySpace = MemorySpace::Host>
LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ( Vector< Number, MemorySpace > &&  in_vector)

Move constructor. Uses the swap method.

Note
In order for this constructor to leave the moved-from object in a valid state it must allocate memory (in this case, an empty partitioner) - hence it cannot be marked as noexcept.

◆ Vector() [4/20]

template<typename Number , typename MemorySpace = MemorySpace::Host>
LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ( const size_type  size)

Construct a parallel vector of the given global size without any actual parallel distribution.

◆ Vector() [5/20]

template<typename Number , typename MemorySpace = MemorySpace::Host>
LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ( const IndexSet local_range,
const IndexSet ghost_indices,
const MPI_Comm &  communicator 
)

Construct a parallel vector. The local range is specified by locally_owned_set (note that this must be a contiguous interval, multiple intervals are not possible). The IndexSet ghost_indices specifies ghost indices, i.e., indices which one might need to read data from or accumulate data from. It is allowed that the set of ghost indices also contains the local range, but it does not need to.

This function involves global communication, so it should only be called once for a given layout. Use the constructor with Vector<Number> argument to create additional vectors with the same parallel layout.

See also
vectors with ghost elements

◆ Vector() [6/20]

template<typename Number , typename MemorySpace = MemorySpace::Host>
LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ( const IndexSet local_range,
const MPI_Comm &  communicator 
)

Same constructor as above but without any ghost indices.

◆ Vector() [7/20]

template<typename Number , typename MemorySpace = MemorySpace::Host>
LinearAlgebra::distributed::Vector< Number, MemorySpace >::Vector ( const std::shared_ptr< const Utilities::MPI::Partitioner > &  partitioner)

Create the vector based on the parallel partitioning described in partitioner. The input argument is a shared pointer, which stores the partitioner data only once and share it between several vectors with the same layout.

◆ ~Vector() [1/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual LinearAlgebra::distributed::Vector< Number, MemorySpace >::~Vector ( )
overridevirtual

Destructor.

◆ reinit() [9/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit ( const size_type  size,
const bool  omit_zeroing_entries = false 
)

Set the global size of the vector to size without any actual parallel distribution.

◆ reinit() [10/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename Number2 >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit ( const Vector< Number2, MemorySpace > &  in_vector,
const bool  omit_zeroing_entries = false 
)

Uses the parallel layout of the input vector in_vector and allocates memory for this vector. Recommended initialization function when several vectors with the same layout should be created.

If the flag omit_zeroing_entries is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it).

◆ reinit() [11/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit ( const IndexSet local_range,
const IndexSet ghost_indices,
const MPI_Comm &  communicator 
)

Initialize the vector. The local range is specified by locally_owned_set (note that this must be a contiguous interval, multiple intervals are not possible). The IndexSet ghost_indices specifies ghost indices, i.e., indices which one might need to read data from or accumulate data from. It is allowed that the set of ghost indices also contains the local range, but it does not need to.

This function involves global communication, so it should only be called once for a given layout. Use the reinit function with Vector<Number> argument to create additional vectors with the same parallel layout.

See also
vectors with ghost elements

◆ reinit() [12/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit ( const IndexSet local_range,
const MPI_Comm &  communicator 
)

Same as above, but without ghost entries.

◆ reinit() [13/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit ( const std::shared_ptr< const Utilities::MPI::Partitioner > &  partitioner,
const MPI_Comm &  comm_sm = MPI_COMM_SELF 
)

Initialize the vector given to the parallel partitioning described in partitioner. The input argument is a shared pointer, which stores the partitioner data only once and share it between several vectors with the same layout.

The optional argument comm_sm, which consists of processes on the same shared-memory domain, allows users have read-only access to both locally-owned and ghost values of processes combined in the shared-memory communicator. See the general documentation of this class for more information about this argument.

◆ reinit() [14/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit ( const types::global_dof_index  local_size,
const types::global_dof_index  ghost_size,
const MPI_Comm &  comm,
const MPI_Comm &  comm_sm = MPI_COMM_SELF 
)

Initialize vector with local_size locally-owned and ghost_size ghost degrees of freedoms.

The optional argument comm_sm, which consists of processes on the same shared-memory domain, allows users have read-only access to both locally-owned and ghost values of processes combined in the shared-memory communicator. See the general documentation of this class for more information about this argument.

Note
In the created underlying partitioner, the local index range is translated to global indices in an ascending and one-to-one fashion, i.e., the indices of process \(p\) sit exactly between the indices of the processes \(p-1\) and \(p+1\), respectively. Setting the ghost_size variable to an appropriate value provides memory space for the ghost data in a vector's memory allocation as and allows access to it via local_element(). However, the associated global indices must be handled externally in this case.

◆ swap() [4/9]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::swap ( Vector< Number, MemorySpace > &  v)

Swap the contents of this vector and the other vector v. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.

This function is analogous to the swap function of all C++ standard containers. Also, there is a global function swap(u,v) that simply calls u.swap(v), again in analogy to standard functions.

◆ operator=() [14/30]

template<typename Number , typename MemorySpace = MemorySpace::Host>
Vector<Number, MemorySpace>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator= ( const Vector< Number, MemorySpace > &  in_vector)

Assigns the vector to the parallel partitioning of the input vector in_vector, and copies all the data.

If one of the input vector or the calling vector (to the left of the assignment operator) had ghost elements set before this operation, the calling vector will have ghost values set. Otherwise, it will be in write mode. If the input vector does not have any ghost elements at all, the vector will also update its ghost values in analogy to the respective setting the Trilinos and PETSc vectors.

◆ operator=() [15/30]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename Number2 >
Vector<Number, MemorySpace>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator= ( const Vector< Number2, MemorySpace > &  in_vector)

Assigns the vector to the parallel partitioning of the input vector in_vector, and copies all the data.

If one of the input vector or the calling vector (to the left of the assignment operator) had ghost elements set before this operation, the calling vector will have ghost values set. Otherwise, it will be in write mode. If the input vector does not have any ghost elements at all, the vector will also update its ghost values in analogy to the respective setting the Trilinos and PETSc vectors.

◆ compress() [3/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress ( ::VectorOperation::values  operation)
overridevirtual

This function copies the data that has accumulated in the data buffer for ghost indices to the owning processor. For the meaning of the argument operation, see the entry on Compressing distributed vectors and matrices in the glossary.

There are four variants for this function. If called with argument VectorOperation::add adds all the data accumulated in ghost elements to the respective elements on the owning processor and clears the ghost array afterwards. If called with argument VectorOperation::insert, a set operation is performed. Since setting elements in a vector with ghost elements is ambiguous (as one can set both the element on the ghost site as well as the owning site), this operation makes the assumption that all data is set correctly on the owning processor. Upon call of compress(VectorOperation::insert), all ghost entries are thus simply zeroed out (using zero_ghost_values()). In debug mode, a check is performed for whether the data set is actually consistent between processors, i.e., whenever a non-zero ghost element is found, it is compared to the value on the owning processor and an exception is thrown if these elements do not agree. If called with VectorOperation::min or VectorOperation::max, the minimum or maximum on all elements across the processors is set.

Note
This vector class has a fixed set of ghost entries attached to the local representation. As a consequence, all ghost entries are assumed to be valid and will be exchanged unconditionally according to the given VectorOperation. Make sure to initialize all ghost entries with the neutral element of the given VectorOperation or touch all ghost entries. The neutral element is zero for VectorOperation::add and VectorOperation::insert, +inf for VectorOperation::min, and -inf for VectorOperation::max. If all values are initialized with values below zero and compress is called with VectorOperation::max two times subsequently, the maximal value after the second calculation will be zero.

◆ update_ghost_values() [2/3]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values ( ) const

Fills the data field for ghost indices with the values stored in the respective positions of the owning processor. This function is needed before reading from ghosts. The function is const even though ghost data is changed. This is needed to allow functions with a const vector to perform the data exchange without creating temporaries.

After calling this method, write access to ghost elements of the vector is forbidden and an exception is thrown. Only read access to ghost elements is allowed in this state. Note that all subsequent operations on this vector, like global vector addition, etc., will also update the ghost values by a call to this method after the operation. However, global reduction operations like norms or the inner product will always ignore ghost elements in order to avoid counting the ghost data more than once. To allow writing to ghost elements again, call zero_out_ghost_values().

See also
vectors with ghost elements

◆ compress_start()

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress_start ( const unsigned int  communication_channel = 0,
::VectorOperation::values  operation = VectorOperation::add 
)

Initiates communication for the compress() function with non- blocking communication. This function does not wait for the transfer to finish, in order to allow for other computations during the time it takes until all data arrives.

Before the data is actually exchanged, the function must be followed by a call to compress_finish().

In case this function is called for more than one vector before compress_finish() is invoked, it is mandatory to specify a unique communication channel to each such call, in order to avoid several messages with the same ID that will corrupt this operation. Any communication channel less than 100 is a valid value (in particular, the range \([100, 200)\) is reserved for LinearAlgebra::distributed::BlockVector).

◆ compress_finish()

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress_finish ( ::VectorOperation::values  operation)

For all requests that have been initiated in compress_start, wait for the communication to finish. Once it is finished, add or set the data (depending on the flag operation) to the respective positions in the owning processor, and clear the contents in the ghost data fields. The meaning of this argument is the same as in compress().

This function should be called exactly once per vector after calling compress_start, otherwise the result is undefined. In particular, it is not well-defined to call compress_start on the same vector again before compress_finished has been called. However, there is no warning to prevent this situation.

Must follow a call to the compress_start function.

When the MemorySpace is CUDA and MPI is not CUDA-aware, data changed on the device after the call to compress_start will be lost.

◆ update_ghost_values_start()

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values_start ( const unsigned int  communication_channel = 0) const

Initiates communication for the update_ghost_values() function with non-blocking communication. This function does not wait for the transfer to finish, in order to allow for other computations during the time it takes until all data arrives.

Before the data is actually exchanged, the function must be followed by a call to update_ghost_values_finish().

In case this function is called for more than one vector before update_ghost_values_finish() is invoked, it is mandatory to specify a unique communication channel to each such call, in order to avoid several messages with the same ID that will corrupt this operation. Any communication channel less than 100 is a valid value (in particular, the range \([100, 200)\) is reserved for LinearAlgebra::distributed::BlockVector).

◆ update_ghost_values_finish()

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values_finish ( ) const

For all requests that have been started in update_ghost_values_start, wait for the communication to finish.

Must follow a call to the update_ghost_values_start function before reading data from ghost indices.

◆ zero_out_ghosts() [2/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::zero_out_ghosts ( ) const

This method zeros the entries on ghost dofs, but does not touch locally owned DoFs.

After calling this method, read access to ghost elements of the vector is forbidden and an exception is thrown. Only write access to ghost elements is allowed in this state.

Deprecated:
Use zero_out_ghost_values() instead.

◆ zero_out_ghost_values() [2/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::zero_out_ghost_values ( ) const

This method zeros the entries on ghost dofs, but does not touch locally owned DoFs.

After calling this method, read access to ghost elements of the vector is forbidden and an exception is thrown. Only write access to ghost elements is allowed in this state.

◆ has_ghost_elements() [3/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::has_ghost_elements ( ) const

Return whether the vector currently is in a state where ghost values can be read or not. This is the same functionality as other parallel vectors have. If this method returns false, this only means that read-access to ghost elements is prohibited whereas write access is still possible (to those entries specified as ghosts during initialization), not that there are no ghost elements at all.

See also
vectors with ghost elements

◆ copy_locally_owned_data_from() [2/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename Number2 >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::copy_locally_owned_data_from ( const Vector< Number2, MemorySpace > &  src)

This method copies the data in the locally owned range from another distributed vector src into the calling vector. As opposed to operator= that also includes ghost entries, this operation ignores the ghost range. The only prerequisite is that the local range on the calling vector and the given vector src are the same on all processors. It is explicitly allowed that the two vectors have different ghost elements that might or might not be related to each other.

Since no data exchange is performed, make sure that neither src nor the calling vector have pending communications in order to obtain correct results.

◆ import() [2/15]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename MemorySpace2 >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::import ( const Vector< Number, MemorySpace2 > &  src,
VectorOperation::values  operation 
)

Import all the elements present in the distributed vector src. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The main purpose of this function is to get data from one memory space, e.g. CUDA, to the other, e.g. the Host.

Note
The partitioners of the two distributed vectors need to be the same as no MPI communication is performed.

◆ reinit() [15/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::reinit ( const VectorSpaceVector< Number > &  V,
const bool  omit_zeroing_entries = false 
)
overridevirtual

Change the dimension to that of the vector V. The elements of V are not copied.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator*=() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Vector<Number, MemorySpace>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator*= ( const Number  factor)
overridevirtual

Multiply the entire vector by a fixed factor.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator/=() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Vector<Number, MemorySpace>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator/= ( const Number  factor)
overridevirtual

Divide the entire vector by a fixed factor.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator+=() [3/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Vector<Number, MemorySpace>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator+= ( const VectorSpaceVector< Number > &  V)
overridevirtual

Add the vector V to the present one.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator-=() [3/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Vector<Number, MemorySpace>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator-= ( const VectorSpaceVector< Number > &  V)
overridevirtual

Subtract the vector V from the present one.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ import() [3/15]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::import ( const LinearAlgebra::ReadWriteVector< Number > &  V,
VectorOperation::values  operation,
std::shared_ptr< const Utilities::MPI::CommunicationPatternBase communication_pattern = {} 
)
overridevirtual

Import all the elements present in the vector's IndexSet from the input vector V. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

Note
If the MemorySpace is CUDA, the data in the ReadWriteVector will be moved to the device.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator*() [3/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator* ( const VectorSpaceVector< Number > &  V) const
overridevirtual

Return the scalar product of two vectors.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [6/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add ( const Number  a)
overridevirtual

Add a to all components. Note that a is a scalar not a vector.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [7/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Simple addition of a multiple of a vector, i.e. *this += a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [8/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add ( const Number  a,
const VectorSpaceVector< Number > &  V,
const Number  b,
const VectorSpaceVector< Number > &  W 
)
overridevirtual

Multiple addition of scaled vectors, i.e. *this += a*V+b*W.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [9/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add ( const std::vector< size_type > &  indices,
const std::vector< Number > &  values 
)
virtual

A collective add operation: This function adds a whole set of values stored in values to the vector components specified by indices.

◆ sadd() [3/8]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::sadd ( const Number  s,
const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Scaling and simple addition of a multiple of a vector, i.e. this = s(*this)+a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ scale() [3/7]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::scale ( const VectorSpaceVector< Number > &  scaling_factors)
overridevirtual

Scale each element of this vector by the corresponding element in the argument. This function is mostly meant to simulate multiplication (and immediate re-assignment) by a diagonal scaling matrix.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ equ() [2/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::equ ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Assignment *this = a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ l1_norm() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::l1_norm ( ) const
overridevirtual

Return the l1 norm of the vector (i.e., the sum of the absolute values of all entries among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ l2_norm() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::l2_norm ( ) const
overridevirtual

Return the \(l_2\) norm of the vector (i.e., the square root of the sum of the square of all entries among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ norm_sqr() [2/3]

template<typename Number , typename MemorySpace = MemorySpace::Host>
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::norm_sqr ( ) const

Return the square of the \(l_2\) norm of the vector.

◆ linfty_norm() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::linfty_norm ( ) const
overridevirtual

Return the maximum norm of the vector (i.e., the maximum absolute value among all entries and among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add_and_dot() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::add_and_dot ( const Number  a,
const VectorSpaceVector< Number > &  V,
const VectorSpaceVector< Number > &  W 
)
overridevirtual

Perform a combined operation of a vector addition and a subsequent inner product, returning the value of the inner product. In other words, the result of this function is the same as if the user called

this->add(a, V);
return_value = *this * W;
virtual void add(const Number a) override

The reason this function exists is that this operation involves less memory transfer than calling the two functions separately. This method only needs to load three vectors, this, V, W, whereas calling separate methods means to load the calling vector this twice. Since most vector operations are memory transfer limited, this reduces the time by 25% (or 50% if W equals this).

For complex-valued vectors, the scalar product in the second step is implemented as \(\left<v,w\right>=\sum_i v_i \bar{w_i}\).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ size() [2/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::size ( ) const
overridevirtual

Return the global size of the vector, equal to the sum of the number of locally owned indices among all processors.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ locally_owned_elements() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual ::IndexSet LinearAlgebra::distributed::Vector< Number, MemorySpace >::locally_owned_elements ( ) const
overridevirtual

Return an index set that describes which elements of this vector are owned by the current processor. As a consequence, the index sets returned on different processors if this is a distributed vector will form disjoint sets that add up to the complete index set. Obviously, if a vector is created on only one processor, then the result would satisfy

vec.locally_owned_elements() == complete_index_set(vec.size())

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ print() [3/7]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual void LinearAlgebra::distributed::Vector< Number, MemorySpace >::print ( std::ostream &  out,
const unsigned int  precision = 3,
const bool  scientific = true,
const bool  across = true 
) const
overridevirtual

Print the vector to the output stream out.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ memory_consumption() [2/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual std::size_t LinearAlgebra::distributed::Vector< Number, MemorySpace >::memory_consumption ( ) const
overridevirtual

Return the memory consumption of this class in bytes.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator=() [16/30]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Vector<Number, MemorySpace>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator= ( const Number  s)
overridevirtual

Sets all elements of the vector to the scalar s. If the scalar is zero, also ghost elements are set to zero, otherwise they remain unchanged.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [10/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename OtherNumber >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add ( const std::vector< size_type > &  indices,
const ::Vector< OtherNumber > &  values 
)

This is a collective add operation that adds a whole set of values stored in values to the vector components specified by indices.

◆ add() [11/26]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename OtherNumber >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add ( const size_type  n_elements,
const size_type indices,
const OtherNumber *  values 
)

Take an address where n_elements are stored contiguously and add them into the vector.

◆ sadd() [4/8]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::sadd ( const Number  s,
const Vector< Number, MemorySpace > &  V 
)

Scaling and simple vector addition, i.e. this = s(*this)+V.

◆ local_size()

template<typename Number , typename MemorySpace = MemorySpace::Host>
size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::local_size ( ) const

Return the local size of the vector, i.e., the number of indices owned locally.

Deprecated:
Use locally_owned_size() instead.

◆ locally_owned_size() [1/3]

template<typename Number , typename MemorySpace = MemorySpace::Host>
size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::locally_owned_size ( ) const

Return the local size of the vector, i.e., the number of indices owned locally.

◆ in_local_range() [1/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::in_local_range ( const size_type  global_index) const

Return true if the given global index is in the local range of this processor.

◆ begin() [1/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::begin ( )

Make the Vector class a bit like the vector<> class of the C++ standard library by returning iterators to the start and end of the locally owned elements of this vector.

It holds that end() - begin() == locally_owned_size().

Note
For the CUDA memory space, the iterator points to memory on the device.

◆ begin() [2/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
const_iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::begin ( ) const

Return constant iterator to the start of the locally owned elements of the vector.

Note
For the CUDA memory space, the iterator points to memory on the device.

◆ end() [1/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::end ( )

Return an iterator pointing to the element past the end of the array of locally owned entries.

Note
For the CUDA memory space, the iterator points to memory on the device.

◆ end() [2/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
const_iterator LinearAlgebra::distributed::Vector< Number, MemorySpace >::end ( ) const

Return a constant iterator pointing to the element past the end of the array of the locally owned entries.

Note
For the CUDA memory space, the iterator points to memory on the device.

◆ operator()() [1/7]

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator() ( const size_type  global_index) const

Read access to the data in the position corresponding to global_index. The index must be either in the local range of the vector or be specified as a ghost index at construction.

Performance: O(1) for locally owned elements that represent a contiguous range and O(log(nranges)) for ghost elements (quite fast, but slower than local_element()).

◆ operator()() [2/7]

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator() ( const size_type  global_index)

Read and write access to the data in the position corresponding to global_index. The index must be either in the local range of the vector or be specified as a ghost index at construction.

Performance: O(1) for locally owned elements that represent a contiguous range and O(log(nranges)) for ghost elements (quite fast, but slower than local_element()).

◆ operator[]() [2/7]

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator[] ( const size_type  global_index) const

Read access to the data in the position corresponding to global_index. The index must be either in the local range of the vector or be specified as a ghost index at construction.

This function does the same thing as operator().

◆ operator[]() [3/7]

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number& LinearAlgebra::distributed::Vector< Number, MemorySpace >::operator[] ( const size_type  global_index)

Read and write access to the data in the position corresponding to global_index. The index must be either in the local range of the vector or be specified as a ghost index at construction.

This function does the same thing as operator().

◆ local_element() [1/4]

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::local_element ( const size_type  local_index) const

Read access to the data field specified by local_index. Locally owned indices can be accessed with indices [0,locally_owned_size), and ghost indices with indices [locally_owned_size,locally_owned_size+ n_ghost_entries].

Performance: Direct array access (fast).

◆ local_element() [2/4]

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number& LinearAlgebra::distributed::Vector< Number, MemorySpace >::local_element ( const size_type  local_index)

Read and write access to the data field specified by local_index. Locally owned indices can be accessed with indices [0,locally_owned_size()), and ghost indices with indices [locally_owned_size(), locally_owned_size()+n_ghosts].

Performance: Direct array access (fast).

◆ get_values()

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number* LinearAlgebra::distributed::Vector< Number, MemorySpace >::get_values ( ) const

Return the pointer to the underlying raw array.

Note
For the CUDA memory space, the pointer points to memory on the device.

◆ extract_subvector_to() [1/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename OtherNumber >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::extract_subvector_to ( const std::vector< size_type > &  indices,
std::vector< OtherNumber > &  values 
) const

Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. The indices of the elements to be read are stated in the first argument, the corresponding values are returned in the second.

If the current vector is called v, then this function is the equivalent to the code

for (unsigned int i=0; i<indices.size(); ++i)
values[i] = v[indices[i]];
Precondition
The sizes of the indices and values arrays must be identical.
Note
This function is not implemented for CUDA memory space.

◆ extract_subvector_to() [2/6]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename ForwardIterator , typename OutputIterator >
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::extract_subvector_to ( ForwardIterator  indices_begin,
const ForwardIterator  indices_end,
OutputIterator  values_begin 
) const

Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. In contrast to the previous function, this function obtains the indices of the elements by dereferencing all elements of the iterator range provided by the first two arguments, and puts the vector values into memory locations obtained by dereferencing a range of iterators starting at the location pointed to by the third argument.

If the current vector is called v, then this function is the equivalent to the code

ForwardIterator indices_p = indices_begin;
OutputIterator values_p = values_begin;
while (indices_p != indices_end)
{
*values_p = v[*indices_p];
++indices_p;
++values_p;
}
Precondition
It must be possible to write into as many memory locations starting at values_begin as there are iterators between indices_begin and indices_end.

◆ all_zero() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::all_zero ( ) const
overridevirtual

Return whether the vector contains only elements with value zero. This is a collective operation. This function is expensive, because potentially all elements have to be checked.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ mean_value() [2/5]

template<typename Number , typename MemorySpace = MemorySpace::Host>
virtual Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::mean_value ( ) const
overridevirtual

Compute the mean value of all the entries in the vector.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ lp_norm() [2/3]

template<typename Number , typename MemorySpace = MemorySpace::Host>
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::lp_norm ( const real_type  p) const

\(l_p\)-norm of the vector. The pth root of the sum of the pth powers of the absolute values of the elements.

◆ get_mpi_communicator()

template<typename Number , typename MemorySpace = MemorySpace::Host>
const MPI_Comm& LinearAlgebra::distributed::Vector< Number, MemorySpace >::get_mpi_communicator ( ) const

Return a reference to the MPI communicator object in use with this vector.

◆ get_partitioner()

template<typename Number , typename MemorySpace = MemorySpace::Host>
const std::shared_ptr<const Utilities::MPI::Partitioner>& LinearAlgebra::distributed::Vector< Number, MemorySpace >::get_partitioner ( ) const

Return the MPI partitioner that describes the parallel layout of the vector. This object can be used to initialize another vector with the respective reinit() call, for additional queries regarding the parallel communication, or the compatibility of partitioners.

◆ partitioners_are_compatible()

template<typename Number , typename MemorySpace = MemorySpace::Host>
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::partitioners_are_compatible ( const Utilities::MPI::Partitioner part) const

Check whether the given partitioner is compatible with the partitioner used for this vector. Two partitioners are compatible if they have the same local size and the same ghost indices. They do not necessarily need to be the same data field of the shared pointer. This is a local operation only, i.e., if only some processors decide that the partitioning is not compatible, only these processors will return false, whereas the other processors will return true.

◆ partitioners_are_globally_compatible()

template<typename Number , typename MemorySpace = MemorySpace::Host>
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::partitioners_are_globally_compatible ( const Utilities::MPI::Partitioner part) const

Check whether the given partitioner is compatible with the partitioner used for this vector. Two partitioners are compatible if they have the same local size and the same ghost indices. They do not necessarily need to be the same data field. As opposed to partitioners_are_compatible(), this method checks for compatibility among all processors and the method only returns true if the partitioner is the same on all processors.

This method performs global communication, so make sure to use it only in a context where all processors call it the same number of times.

◆ set_ghost_state() [2/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::set_ghost_state ( const bool  ghosted) const

Change the ghost state of this vector to ghosted.

◆ shared_vector_data()

template<typename Number , typename MemorySpace = MemorySpace::Host>
const std::vector<ArrayView<const Number> >& LinearAlgebra::distributed::Vector< Number, MemorySpace >::shared_vector_data ( ) const

Get pointers to the beginning of the values of the other processes of the same shared-memory domain.

◆ add_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::add_local ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
private

Simple addition of a multiple of a vector, i.e. *this += a*V without MPI communication.

◆ sadd_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::sadd_local ( const Number  s,
const Number  a,
const VectorSpaceVector< Number > &  V 
)
private

Scaling and simple addition of a multiple of a vector, i.e. this = s(*this)+a*V without MPI communication.

◆ inner_product_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename Number2 >
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::inner_product_local ( const Vector< Number2, MemorySpace > &  V) const
private

Local part of the inner product of two vectors.

◆ norm_sqr_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::norm_sqr_local ( ) const
private

Local part of norm_sqr().

◆ mean_value_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::mean_value_local ( ) const
private

Local part of mean_value().

◆ l1_norm_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::l1_norm_local ( ) const
private

Local part of l1_norm().

◆ lp_norm_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::lp_norm_local ( const real_type  p) const
private

Local part of lp_norm().

◆ linfty_norm_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
real_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::linfty_norm_local ( ) const
private

Local part of linfty_norm().

◆ add_and_dot_local()

template<typename Number , typename MemorySpace = MemorySpace::Host>
Number LinearAlgebra::distributed::Vector< Number, MemorySpace >::add_and_dot_local ( const Number  a,
const Vector< Number, MemorySpace > &  V,
const Vector< Number, MemorySpace > &  W 
)
private

Local part of the addition followed by an inner product of two vectors. The same applies for complex-valued vectors as for the add_and_dot() function.

◆ clear_mpi_requests()

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::clear_mpi_requests ( )
private

A helper function that clears the compress_requests and update_ghost_values_requests field. Used in reinit() functions.

◆ resize_val() [1/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
void LinearAlgebra::distributed::Vector< Number, MemorySpace >::resize_val ( const size_type  new_allocated_size,
const MPI_Comm &  comm_sm = MPI_COMM_SELF 
)
private

A helper function that is used to resize the val array.

◆ reinit_domain_vector()

template<typename Number >
template<typename MatrixType , typename std::enable_if< has_get_mpi_communicator< MatrixType > &&has_locally_owned_domain_indices< MatrixType >, MatrixType >::type * = nullptr>
static void internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::reinit_domain_vector ( MatrixType &  mat,
LinearAlgebra::distributed::Vector< Number > &  vec,
bool   
)
inlinestatic

Definition at line 1948 of file la_parallel_vector.h.

◆ reinit_range_vector()

template<typename Number >
template<typename MatrixType , typename std::enable_if< has_get_mpi_communicator< MatrixType > &&has_locally_owned_range_indices< MatrixType >, MatrixType >::type * = nullptr>
static void internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::reinit_range_vector ( MatrixType &  mat,
LinearAlgebra::distributed::Vector< Number > &  vec,
bool   
)
inlinestatic

Definition at line 1990 of file la_parallel_vector.h.

◆ Vector() [8/20]

template<typename Number >
LinearAlgebra::Vector< Number >::Vector ( )
default

Constructor. Create a vector of dimension zero.

◆ Vector() [9/20]

template<typename Number >
Vector< Number >::Vector ( const Vector< Number > &  V)
inline

Copy constructor. Sets the dimension to that of the given vector and copies all elements.

Definition at line 428 of file la_vector.h.

◆ Vector() [10/20]

template<typename Number >
Vector< Number >::Vector ( const size_type  n)
inlineexplicit

Constructor. Set dimension to n and initialize all elements with zero.

The constructor is made explicit to avoid accident like this: v=0;. Presumably, the user wants to set every element of the vector to zero, but instead, what happens is this call: v=Vector<Number>(0);, i.e. the vector is replaced by one of length zero.

Definition at line 435 of file la_vector.h.

◆ Vector() [11/20]

template<typename Number >
template<typename InputIterator >
Vector< Number >::Vector ( const InputIterator  first,
const InputIterator  last 
)
inline

Initialize the vector with a given range of values pointed to by the iterators. This function exists in analogy to the std::vector class.

Definition at line 443 of file la_vector.h.

◆ reinit() [16/26]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::reinit ( const size_type  size,
const bool  omit_zeroing_entries = false 
)
overridevirtual

Set the global size of the vector to size. The stored elements have their index in [0,size).

If the flag omit_zeroing_entries is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it).

Reimplemented from LinearAlgebra::ReadWriteVector< Number >.

◆ reinit() [17/26]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::Vector< Number >::reinit ( const ReadWriteVector< Number2 > &  in_vector,
const bool  omit_zeroing_entries = false 
)

Uses the same IndexSet as the one of the input vector in_vector and allocates memory for this vector.

If the flag omit_zeroing_entries is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it).

◆ reinit() [18/26]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::reinit ( const IndexSet locally_stored_indices,
const bool  omit_zeroing_entries = false 
)
overridevirtual

Initializes the vector. The indices are specified by locally_stored_indices.

If the flag omit_zeroing_entries is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it). locally_stored_indices.

Reimplemented from LinearAlgebra::ReadWriteVector< Number >.

◆ reinit() [19/26]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::reinit ( const VectorSpaceVector< Number > &  V,
const bool  omit_zeroing_entries = false 
)
overridevirtual

Change the dimension to that of the vector V. The elements of V are not copied.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ has_ghost_elements() [4/5]

template<typename Number >
bool LinearAlgebra::Vector< Number >::has_ghost_elements ( ) const

Returns false as this is a serial vector.

This functionality only needs to be called if using MPI based vectors and exists in other objects for compatibility.

◆ operator=() [17/30]

template<typename Number >
Vector<Number>& LinearAlgebra::Vector< Number >::operator= ( const Vector< Number > &  in_vector)

Copies the data of the input vector in_vector.

◆ operator=() [18/30]

template<typename Number >
template<typename Number2 >
Vector<Number>& LinearAlgebra::Vector< Number >::operator= ( const Vector< Number2 > &  in_vector)

Copies the data of the input vector in_vector.

◆ operator=() [19/30]

template<typename Number >
virtual Vector<Number>& LinearAlgebra::Vector< Number >::operator= ( const Number  s)
overridevirtual

Sets all elements of the vector to the scalar s. This operation is only allowed if s is equal to zero.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator*=() [3/5]

template<typename Number >
virtual Vector<Number>& LinearAlgebra::Vector< Number >::operator*= ( const Number  factor)
overridevirtual

Multiply the entire vector by a fixed factor.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator/=() [3/5]

template<typename Number >
virtual Vector<Number>& LinearAlgebra::Vector< Number >::operator/= ( const Number  factor)
overridevirtual

Divide the entire vector by a fixed factor.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator+=() [4/6]

template<typename Number >
virtual Vector<Number>& LinearAlgebra::Vector< Number >::operator+= ( const VectorSpaceVector< Number > &  V)
overridevirtual

Add the vector V to the present one.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator-=() [4/6]

template<typename Number >
virtual Vector<Number>& LinearAlgebra::Vector< Number >::operator-= ( const VectorSpaceVector< Number > &  V)
overridevirtual

Subtract the vector V from the present one.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ operator*() [4/6]

template<typename Number >
virtual Number LinearAlgebra::Vector< Number >::operator* ( const VectorSpaceVector< Number > &  V) const
overridevirtual

Return the scalar product of two vectors.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ import() [4/15]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::import ( const ReadWriteVector< Number > &  V,
VectorOperation::values  operation,
std::shared_ptr< const Utilities::MPI::CommunicationPatternBase communication_pattern = {} 
)
overridevirtual

This function is not implemented and will throw an exception.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [12/26]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::add ( const Number  a)
overridevirtual

Add a to all components. Note that a is a scalar not a vector.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [13/26]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::add ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Simple addition of a multiple of a vector, i.e. *this += a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add() [14/26]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::add ( const Number  a,
const VectorSpaceVector< Number > &  V,
const Number  b,
const VectorSpaceVector< Number > &  W 
)
overridevirtual

Multiple addition of a multiple of a vector, i.e. *this += a*V+b*W.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ sadd() [5/8]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::sadd ( const Number  s,
const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Scaling and simple addition of a multiple of a vector, i.e. this = s(*this)+a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ scale() [4/7]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::scale ( const VectorSpaceVector< Number > &  scaling_factors)
overridevirtual

Scale each element of this vector by the corresponding element in the argument. This function is mostly meant to simulate multiplication (and immediate re-assignment) by a diagonal scaling matrix.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ equ() [3/6]

template<typename Number >
virtual void LinearAlgebra::Vector< Number >::equ ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
overridevirtual

Assignment *this = a*V.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ all_zero() [3/5]

template<typename Number >
virtual bool LinearAlgebra::Vector< Number >::all_zero ( ) const
overridevirtual

Return whether the vector contains only elements with value zero.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ mean_value() [3/5]

template<typename Number >
virtual value_type LinearAlgebra::Vector< Number >::mean_value ( ) const
overridevirtual

Return the mean value of all the entries of this vector.

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ l1_norm() [3/5]

template<typename Number >
virtual VectorSpaceVector<Number>::real_type LinearAlgebra::Vector< Number >::l1_norm ( ) const
overridevirtual

Return the l1 norm of the vector (i.e., the sum of the absolute values of all entries).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ l2_norm() [3/5]

template<typename Number >
virtual VectorSpaceVector<Number>::real_type LinearAlgebra::Vector< Number >::l2_norm ( ) const
overridevirtual

Return the l2 norm of the vector (i.e., the square root of the sum of the square of all entries among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ linfty_norm() [3/5]

template<typename Number >
virtual VectorSpaceVector<Number>::real_type LinearAlgebra::Vector< Number >::linfty_norm ( ) const
overridevirtual

Return the maximum norm of the vector (i.e., the maximum absolute value among all entries and among all processors).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ add_and_dot() [3/5]

template<typename Number >
virtual Number LinearAlgebra::Vector< Number >::add_and_dot ( const Number  a,
const VectorSpaceVector< Number > &  V,
const VectorSpaceVector< Number > &  W 
)
overridevirtual

Perform a combined operation of a vector addition and a subsequent inner product, returning the value of the inner product. In other words, the result of this function is the same as if the user called

this->add(a, V);
return_value = *this * W;
virtual void add(const Number a) override

The reason this function exists is that this operation involves less memory transfer than calling the two functions separately. This method only needs to load three vectors, this, V, W, whereas calling separate methods means to load the calling vector this twice. Since most vector operations are memory transfer limited, this reduces the time by 25% (or 50% if W equals this).

For complex-valued vectors, the scalar product in the second step is implemented as \(\left<v,w\right>=\sum_i v_i \bar{w_i}\).

Implements LinearAlgebra::VectorSpaceVector< Number >.

◆ size() [3/6]

template<typename Number >
Vector< Number >::size_type Vector< Number >::size
inlineoverridevirtual

Return the global size of the vector, equal to the sum of the number of locally owned indices among all processors.

Implements LinearAlgebra::VectorSpaceVector< Number >.

Definition at line 454 of file la_vector.h.

◆ locally_owned_elements() [3/5]

template<typename Number >
IndexSet Vector< Number >::locally_owned_elements
inlineoverridevirtual

Return an index set that describes which elements of this vector are owned by the current processor. As a consequence, the index sets returned on different processors if this is a distributed vector will form disjoint sets that add up to the complete index set. Obviously, if a vector is created on only one processor, then the result would satisfy

vec.locally_owned_elements() == complete_index_set(vec.size())

Implements LinearAlgebra::VectorSpaceVector< Number >.

Definition at line 463 of file la_vector.h.

◆ print() [4/7]

template<typename Number >
void Vector< Number >::print ( std::ostream &  out,
const unsigned int  precision = 3,
const bool  scientific = true,
const bool  across = true 
) const
inlineoverridevirtual

Print the vector to the output stream out.

Implements LinearAlgebra::VectorSpaceVector< Number >.

Definition at line 472 of file la_vector.h.

◆ print_as_numpy_array()

template<typename Number >
void LinearAlgebra::Vector< Number >::print_as_numpy_array ( std::ostream &  out,
const unsigned int  precision = 9 
) const

Print the vector to the output stream out in a format that can be read by numpy::readtxt(). Note that the IndexSet is not printed but only the values stored in the Vector. To load the vector in python just do vector = numpy.loadtxt('my_vector.txt')

◆ block_write() [2/3]

template<typename Number >
void LinearAlgebra::Vector< Number >::block_write ( std::ostream &  out) const

Write the vector en bloc to a file. This is done in a binary mode, so the output is neither readable by humans nor (probably) by other computers using a different operating system or number format.

◆ block_read() [2/3]

template<typename Number >
void LinearAlgebra::Vector< Number >::block_read ( std::istream &  in)

Read a vector en block from a file. This is done using the inverse operations to the above function, so it is reasonably fast because the bitstream is not interpreted.

The vector is resized if necessary.

A primitive form of error checking is performed which will recognize the bluntest attempts to interpret some data as a vector stored bitwise to a file, but not more.

◆ memory_consumption() [3/6]

template<typename Number >
std::size_t Vector< Number >::memory_consumption
inlineoverridevirtual

Return the memory consumption of this class in bytes.

Implements LinearAlgebra::VectorSpaceVector< Number >.

Definition at line 500 of file la_vector.h.

◆ serialize() [1/2]

template<typename Number >
template<typename Archive >
void Vector< Number >::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Write and read the data of this object from a stream for the purpose of serialization using the BOOST serialization library.

Definition at line 485 of file la_vector.h.

◆ ReadWriteVector() [1/4]

template<typename Number >
LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector ( )

Empty constructor.

◆ ReadWriteVector() [2/4]

template<typename Number >
LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector ( const ReadWriteVector< Number > &  in_vector)

Copy constructor.

◆ ReadWriteVector() [3/4]

template<typename Number >
LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector ( const size_type  size)
explicit

Construct a vector given the size, the stored elements have their index in [0,size).

◆ ReadWriteVector() [4/4]

template<typename Number >
LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector ( const IndexSet locally_stored_indices)
explicit

Construct a vector whose stored elements indices are given by the IndexSet locally_stored_indices.

◆ ~ReadWriteVector()

template<typename Number >
LinearAlgebra::ReadWriteVector< Number >::~ReadWriteVector ( )
overridedefault

Destructor.

◆ reinit() [20/26]

template<typename Number >
virtual void LinearAlgebra::ReadWriteVector< Number >::reinit ( const size_type  size,
const bool  omit_zeroing_entries = false 
)
virtual

Set the global size of the vector to size. The stored elements have their index in [0,size).

If the flag omit_zeroing_entries is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it).

Reimplemented in LinearAlgebra::Vector< Number >.

◆ reinit() [21/26]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::reinit ( const ReadWriteVector< Number2 > &  in_vector,
const bool  omit_zeroing_entries = false 
)

Uses the same IndexSet as the one of the input vector in_vector and allocates memory for this vector.

If the flag omit_zeroing_entries is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it).

◆ reinit() [22/26]

template<typename Number >
virtual void LinearAlgebra::ReadWriteVector< Number >::reinit ( const IndexSet locally_stored_indices,
const bool  omit_zeroing_entries = false 
)
virtual

Initializes the vector. The indices are specified by locally_stored_indices.

If the flag omit_zeroing_entries is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it). locally_stored_indices.

Reimplemented in LinearAlgebra::Vector< Number >.

◆ reinit() [23/26]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::reinit ( const TrilinosWrappers::MPI::Vector trilinos_vec)

Initialize this ReadWriteVector by supplying access to all locally available entries in the given ghosted or non-ghosted vector.

Note
This function currently copies the values from the argument into the ReadWriteVector, so modifications here will not modify trilinos_vec.

This function is mainly written for backwards-compatibility to get element access to a ghosted TrilinosWrappers::MPI::Vector inside the library.

◆ apply()

template<typename Number >
template<typename Functor >
void LinearAlgebra::ReadWriteVector< Number >::apply ( const Functor &  func)

Apply the functor func to each element of the vector. The functor should look like

struct Functor
{
void operator() (Number &value);
};
Number operator()(const size_type global_index) const
Note
This function requires that the header read_write_vector.templates.h be included.

◆ swap() [5/9]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::swap ( ReadWriteVector< Number > &  v)

Swap the contents of this vector and the other vector v. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.

This function is analogous to the swap function of all C++ standard containers. Also, there is a global function swap(u,v) that simply calls u.swap(v), again in analogy to standard functions.

◆ operator=() [20/30]

template<typename Number >
ReadWriteVector<Number>& LinearAlgebra::ReadWriteVector< Number >::operator= ( const ReadWriteVector< Number > &  in_vector)

Copies the data and the IndexSet of the input vector in_vector.

◆ operator=() [21/30]

template<typename Number >
template<typename Number2 >
ReadWriteVector<Number>& LinearAlgebra::ReadWriteVector< Number >::operator= ( const ReadWriteVector< Number2 > &  in_vector)

Copies the data and the IndexSet of the input vector in_vector.

◆ operator=() [22/30]

template<typename Number >
ReadWriteVector<Number>& LinearAlgebra::ReadWriteVector< Number >::operator= ( const Number  s)

Sets all elements of the vector to the scalar s. This operation is only allowed if s is equal to zero.

◆ import() [5/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const ::Vector< Number > &  vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Imports all the elements present in the vector's IndexSet from the input vector vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements.

Note
The parameter communication_pattern is ignored since we are dealing with a serial vector here.

◆ import() [6/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const LinearAlgebra::Vector< Number > &  vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Imports all the elements present in the vector's IndexSet from the input vector vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements.

Note
The parameter communication_pattern is ignored since we are dealing with a serial vector here.

◆ import() [7/15]

template<typename Number >
template<typename MemorySpace >
void LinearAlgebra::ReadWriteVector< Number >::import ( const distributed::Vector< Number, MemorySpace > &  vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Imports all the elements present in the vector's IndexSet from the input vector vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

◆ import() [8/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const PETScWrappers::MPI::Vector petsc_vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Imports all the elements present in the vector's IndexSet from the input vector petsc_vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

◆ import() [9/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const TrilinosWrappers::MPI::Vector trilinos_vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Imports all the elements present in the vector's IndexSet from the input vector trilinos_vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

Note
The trilinos_vec is not allowed to have ghost entries.

◆ import() [10/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const TpetraWrappers::Vector< Number > &  tpetra_vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Imports all the elements present in the vector's IndexSet from the input vector tpetra_vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

◆ import() [11/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const EpetraWrappers::Vector epetra_vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Imports all the elements present in the vector's IndexSet from the input vector epetra_vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

◆ import() [12/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const CUDAWrappers::Vector< Number > &  cuda_vec,
VectorOperation::values  operation,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern = {} 
)

Import all the elements present in the vector's IndexSet from the input vector cuda_vec. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter is not used.

◆ size() [4/6]

template<typename Number >
size_type LinearAlgebra::ReadWriteVector< Number >::size ( ) const

The value returned by this function denotes the dimension of the vector spaces that are modeled by objects of this kind. However, objects of the current class do not actually stores all elements of vectors of this space but may, in fact store only a subset. The number of elements stored is returned by n_elements() and is smaller or equal to the number returned by the current function.

◆ n_elements()

template<typename Number >
size_type LinearAlgebra::ReadWriteVector< Number >::n_elements ( ) const

This function returns the number of elements stored. It is smaller or equal to the dimension of the vector space that is modeled by an object of this kind. This dimension is return by size().

Deprecated:
use locally_owned_size() instead.

◆ locally_owned_size() [2/3]

template<typename Number >
size_type LinearAlgebra::ReadWriteVector< Number >::locally_owned_size ( ) const

Return the local size of the vector, i.e., the number of indices owned locally.

◆ get_stored_elements()

template<typename Number >
const IndexSet& LinearAlgebra::ReadWriteVector< Number >::get_stored_elements ( ) const

Return the IndexSet that represents the indices of the elements stored.

◆ begin() [3/6]

template<typename Number >
iterator LinearAlgebra::ReadWriteVector< Number >::begin ( )

Make the ReadWriteVector class a bit like the vector<> class of the C++ standard library by returning iterators to the start and end of the locally stored elements of this vector.

◆ begin() [4/6]

template<typename Number >
const_iterator LinearAlgebra::ReadWriteVector< Number >::begin ( ) const

Return constant iterator to the start of the locally stored elements of the vector.

◆ end() [3/6]

template<typename Number >
iterator LinearAlgebra::ReadWriteVector< Number >::end ( )

Return an iterator pointing to the element past the end of the array of locally stored entries.

◆ end() [4/6]

template<typename Number >
const_iterator LinearAlgebra::ReadWriteVector< Number >::end ( ) const

Return a constant iterator pointing to the element past the end of the array of the locally stored entries.

◆ operator()() [3/7]

template<typename Number >
Number LinearAlgebra::ReadWriteVector< Number >::operator() ( const size_type  global_index) const

Read access to the data in the position corresponding to global_index. An exception is thrown if global_index is not stored by the current object.

◆ operator()() [4/7]

template<typename Number >
Number& LinearAlgebra::ReadWriteVector< Number >::operator() ( const size_type  global_index)

Read and write access to the data in the position corresponding to global_index. An exception is thrown if global_index is not stored by the current object.

◆ operator[]() [4/7]

template<typename Number >
Number LinearAlgebra::ReadWriteVector< Number >::operator[] ( const size_type  global_index) const

Read access to the data in the position corresponding to global_index. An exception is thrown if global_index is not stored by the current object.

This function does the same thing as operator().

◆ operator[]() [5/7]

template<typename Number >
Number& LinearAlgebra::ReadWriteVector< Number >::operator[] ( const size_type  global_index)

Read and write access to the data in the position corresponding to global_index. An exception is thrown if global_index is not stored by the current object.

This function does the same thing as operator().

◆ extract_subvector_to() [3/6]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::extract_subvector_to ( const std::vector< size_type > &  indices,
std::vector< Number2 > &  values 
) const

Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. The indices of the elements to be read are stated in the first argument, the corresponding values are returned in the second.

If the current vector is called v, then this function is the equivalent to the code

for (unsigned int i=0; i<indices.size(); ++i)
values[i] = v[indices[i]];
std::unique_ptr< Number[], decltype(std::free) * > values
Precondition
The sizes of the indices and values arrays must be identical.

◆ extract_subvector_to() [4/6]

template<typename Number >
template<typename ForwardIterator , typename OutputIterator >
void LinearAlgebra::ReadWriteVector< Number >::extract_subvector_to ( ForwardIterator  indices_begin,
const ForwardIterator  indices_end,
OutputIterator  values_begin 
) const

Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. In contrast to the previous function, this function obtains the indices of the elements by dereferencing all elements of the iterator range provided by the first two arguments, and puts the vector values into memory locations obtained by dereferencing a range of iterators starting at the location pointed to by the third argument.

If the current vector is called v, then this function is the equivalent to the code

ForwardIterator indices_p = indices_begin;
OutputIterator values_p = values_begin;
while (indices_p != indices_end)
{
*values_p = v[*indices_p];
++indices_p;
++values_p;
}
Precondition
It must be possible to write into as many memory locations starting at values_begin as there are iterators between indices_begin and indices_end.

◆ local_element() [3/4]

template<typename Number >
Number LinearAlgebra::ReadWriteVector< Number >::local_element ( const size_type  local_index) const

Read access to the data field specified by local_index. When you access elements in the order in which they are stored, it is necessary that you know in which they are stored. In other words, you need to know the map between the global indices of the elements this class stores, and the local indices into the contiguous array of these global elements. For this, see the general documentation of this class.

Performance: Direct array access (fast).

◆ local_element() [4/4]

template<typename Number >
Number& LinearAlgebra::ReadWriteVector< Number >::local_element ( const size_type  local_index)

Read and write access to the data field specified by local_index. When you access elements in the order in which they are stored, it is necessary that you know in which they are stored. In other words, you need to know the map between the global indices of the elements this class stores, and the local indices into the contiguous array of these global elements. For this, see the general documentation of this class.

Performance: Direct array access (fast).

◆ add() [15/26]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::add ( const std::vector< size_type > &  indices,
const std::vector< Number2 > &  values 
)

This function adds a whole set of values stored in values to the vector components specified by indices.

◆ add() [16/26]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::add ( const std::vector< size_type > &  indices,
const ReadWriteVector< Number2 > &  values 
)

This function is similar to the previous one but takes a ReadWriteVector of values.

◆ add() [17/26]

template<typename Number >
template<typename Number2 >
void LinearAlgebra::ReadWriteVector< Number >::add ( const size_type  n_elements,
const size_type indices,
const Number2 *  values 
)

Take an address where n_elements are stored contiguously and add them into the vector. Handles all cases which are not covered by the other two add() functions above.

◆ print() [5/7]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::print ( std::ostream &  out,
const unsigned int  precision = 3,
const bool  scientific = true 
) const

Prints the vector to the output stream out.

◆ memory_consumption() [4/6]

template<typename Number >
std::size_t LinearAlgebra::ReadWriteVector< Number >::memory_consumption ( ) const

Return the memory consumption of this class in bytes.

◆ import() [13/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const Tpetra::Vector< Number, int, types::global_dof_index > &  tpetra_vector,
const IndexSet locally_owned_elements,
VectorOperation::values  operation,
const MPI_Comm &  mpi_comm,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern 
)
protected

Import all the elements present in the vector's IndexSet from the input vector tpetra_vector. This is an helper function and it should not be used directly.

◆ import() [14/15]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::import ( const Epetra_MultiVector &  multivector,
const IndexSet locally_owned_elements,
VectorOperation::values  operation,
const MPI_Comm &  mpi_comm,
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &  communication_pattern 
)
protected

Import all the elements present in the vector's IndexSet from the input vector multivector. This is an helper function and it should not be used directly.

◆ global_to_local()

template<typename Number >
unsigned int LinearAlgebra::ReadWriteVector< Number >::global_to_local ( const types::global_dof_index  global_index) const
inlineprotected

Return the local position of global_index.

Definition at line 684 of file read_write_vector.h.

◆ resize_val() [2/2]

template<typename Number >
void LinearAlgebra::ReadWriteVector< Number >::resize_val ( const size_type  new_allocated_size)
protected

A helper function that is used to resize the val array.

◆ create_tpetra_comm_pattern()

template<typename Number >
TpetraWrappers::CommunicationPattern LinearAlgebra::ReadWriteVector< Number >::create_tpetra_comm_pattern ( const IndexSet source_index_set,
const MPI_Comm &  mpi_comm 
)
protected

Return a TpetraWrappers::CommunicationPattern and store it for future use.

◆ create_epetra_comm_pattern()

template<typename Number >
EpetraWrappers::CommunicationPattern LinearAlgebra::ReadWriteVector< Number >::create_epetra_comm_pattern ( const IndexSet source_index_set,
const MPI_Comm &  mpi_comm 
)
protected

Return a EpetraWrappers::CommunicationPattern and store it for future use.

◆ FunctorTemplate()

template<typename Number >
template<typename Functor >
LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::FunctorTemplate ( ReadWriteVector< Number > &  parent,
const Functor &  functor 
)

Constructor. Take a functor and store a copy of it.

◆ operator()() [5/7]

template<typename Number >
template<typename Functor >
virtual void LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::operator() ( const size_type  begin,
const size_type  end 
)
virtual

Evaluate the element with the stored copy of the functor.

◆ Vector() [12/20]

template<typename Number >
Vector< Number >::Vector ( )

Constructor. Create a vector of dimension zero.

◆ Vector() [13/20]

template<typename Number >
Vector< Number >::Vector ( const Vector< Number > &  v)

Copy constructor. Sets the dimension to that of the given vector, and copies all elements.

We would like to make this constructor explicit, but standard containers insist on using it implicitly.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ Vector() [14/20]

template<typename Number >
Vector< Number >::Vector ( Vector< Number > &&  v)
defaultnoexcept

Move constructor. Creates a new vector by stealing the internal data of the vector v.

◆ Vector() [15/20]

template<typename Number >
template<typename OtherNumber >
Vector< Number >::Vector ( const Vector< OtherNumber > &  v)
explicit

Copy constructor taking a vector of another data type.

This constructor will fail to compile if there is no conversion path from OtherNumber to Number. You may lose accuracy when copying to a vector with data elements with less accuracy.

◆ Vector() [16/20]

template<typename Number >
template<typename OtherNumber >
Vector< Number >::Vector ( const std::initializer_list< OtherNumber > &  v)
explicit

Copy constructor taking an object of type std::initializer_list. This constructor can be used to initialize a vector using a brace-enclosed list of numbers, such as in the following example:

This creates a vector of size 3, whose (double precision) elements have values 1.0, 2.0, and 3.0.

This constructor will fail to compile if there is no conversion path from OtherNumber to Number. You may lose accuracy when copying to a vector with data elements with less accuracy.

◆ Vector() [17/20]

template<typename Number >
Vector< Number >::Vector ( const PETScWrappers::VectorBase v)
explicit

Another copy constructor: copy the values from a PETSc vector class. This copy constructor is only available if PETSc was detected during configuration time.

Note that due to the communication model used in MPI, this operation can only succeed if all processes do it at the same time when v is a distributed vector: It is not possible for only one process to obtain a copy of a parallel vector while the other jobs do something else.

◆ Vector() [18/20]

template<typename Number >
Vector< Number >::Vector ( const TrilinosWrappers::MPI::Vector< Number > &  v)
explicit

Another copy constructor: copy the values from a Trilinos wrapper vector. This copy constructor is only available if Trilinos was detected during configuration time.

Note
Due to the communication model used in MPI, this operation can only succeed if all processes that have knowledge of v (i.e. those given by v.get_mpi_communicator()) do it at the same time. This means that unless you use a split MPI communicator then it is not normally possible for only one or a subset of processes to obtain a copy of a parallel vector while the other jobs do something else. In other words, calling this function is a 'collective operation' that needs to be executed by all MPI processes that jointly share v.

◆ Vector() [19/20]

template<typename Number >
Vector< Number >::Vector ( const size_type  n)
explicit

Constructor. Set dimension to n and initialize all elements with zero.

The constructor is made explicit to avoid accidents like this: v=0;. Presumably, the user wants to set every element of the vector to zero, but instead, what happens is this call: v=Vector<number>(0);, i.e. the vector is replaced by one of length zero.

◆ Vector() [20/20]

template<typename Number >
template<typename InputIterator >
Vector< Number >::Vector ( const InputIterator  first,
const InputIterator  last 
)

Initialize the vector with a given range of values pointed to by the iterators. This function is there in analogy to the std::vector class.

◆ ~Vector() [2/2]

template<typename Number >
virtual Vector< Number >::~Vector ( )
overridevirtualdefault

Destructor, deallocates memory. Made virtual to allow for derived classes to behave properly.

◆ compress() [4/5]

template<typename Number >
void Vector< Number >::compress ( ::VectorOperation::values  operation = ::VectorOperation::unknown) const

This function does nothing but exists for compatibility with the parallel vector classes.

For the parallel vector wrapper class, this function compresses the underlying representation of the vector, i.e. flushes the buffers of the vector object if it has any. This function is necessary after writing into a vector element-by-element and before anything else can be done on it.

However, for the implementation of this class, it is immaterial and thus an empty function.

◆ reinit() [24/26]

template<typename Number >
virtual void Vector< Number >::reinit ( const size_type  N,
const bool  omit_zeroing_entries = false 
)
virtual

Change the dimension of the vector to N. The reserved memory for this vector remains unchanged if possible, to make things faster; this may waste some memory, so keep this in mind. However, if N==0 all memory is freed, i.e. if you want to resize the vector and release the memory not needed, you have to first call reinit(0) and then reinit(N). This cited behavior is analogous to that of the standard library containers.

If omit_zeroing_entries is false, the vector is filled by zeros. Otherwise, the elements are left an unspecified state.

This function is virtual in order to allow for derived classes to handle memory separately.

◆ grow_or_shrink()

template<typename Number >
void Vector< Number >::grow_or_shrink ( const size_type  N)

Same as above, but will preserve the values of vector upon resizing. If we new size is bigger, we will have

\[ \mathbf V \rightarrow \left( \begin{array}{c} \mathbf V \\ \mathbf 0 \end{array} \right) \]

whereas if the desired size is smaller, then

\[ \left( \begin{array}{c} \mathbf V_1 \\ \mathbf V_2 \end{array} \right) \rightarrow \mathbf V_1 \]

◆ apply_givens_rotation()

template<typename Number >
void Vector< Number >::apply_givens_rotation ( const std::array< Number, 3 > &  csr,
const size_type  i,
const size_type  k 
)

Apply Givens rotation csr (a triplet of cosine, sine and radius, see Utilities::LinearAlgebra::givens_rotation()) to the vector in the plane spanned by the i'th and k'th unit vectors.

◆ reinit() [25/26]

template<typename Number >
template<typename Number2 >
void Vector< Number >::reinit ( const Vector< Number2 > &  V,
const bool  omit_zeroing_entries = false 
)

Change the dimension to that of the vector V. The same applies as for the other reinit function.

The elements of V are not copied, i.e. this function is the same as calling reinit (V.size(), omit_zeroing_entries).

◆ swap() [6/9]

template<typename Number >
virtual void Vector< Number >::swap ( Vector< Number > &  v)
virtual

Swap the contents of this vector and the other vector v. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.

This function is analogous to the swap function of all C++ standard containers. Also, there is a global function swap(u,v) that simply calls u.swap(v), again in analogy to standard functions.

This function is virtual in order to allow for derived classes to handle memory separately.

◆ operator=() [23/30]

template<typename Number >
Vector<Number>& Vector< Number >::operator= ( const Number  s)

Set all components of the vector to the given number s.

Since the semantics of assigning a scalar to a vector are not immediately clear, this operator should really only be used if you want to set the entire vector to zero. This allows the intuitive notation v=0. Assigning other values is deprecated and may be disallowed in the future.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ operator=() [24/30]

template<typename Number >
Vector<Number>& Vector< Number >::operator= ( const Vector< Number > &  v)

Copy the given vector. Resize the present vector if necessary.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ operator=() [25/30]

template<typename Number >
Vector<Number>& Vector< Number >::operator= ( Vector< Number > &&  v)
defaultnoexcept

Move the given vector. This operator replaces the present vector with the internal data of the vector v and resets v to the state it would have after being newly default-constructed.

◆ operator=() [26/30]

template<typename Number >
template<typename Number2 >
Vector<Number>& Vector< Number >::operator= ( const Vector< Number2 > &  v)

Copy the given vector. Resize the present vector if necessary.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ operator=() [27/30]

template<typename Number >
Vector<Number>& Vector< Number >::operator= ( const BlockVector< Number > &  v)

Copy operator for assigning a block vector to a regular vector.

◆ operator=() [28/30]

template<typename Number >
Vector<Number>& Vector< Number >::operator= ( const PETScWrappers::VectorBase v)

Another copy operator: copy the values from a PETSc wrapper vector class. This operator is only available if PETSc was detected during configuration time.

Note that due to the communication model used in MPI, this operation can only succeed if all processes do it at the same time when v is a distributed vector: It is not possible for only one process to obtain a copy of a parallel vector while the other jobs do something else.

◆ operator=() [29/30]

template<typename Number >
Vector<Number>& Vector< Number >::operator= ( const TrilinosWrappers::MPI::Vector< Number > &  v)

Another copy operator: copy the values from a (sequential or parallel, depending on the underlying compiler) Trilinos wrapper vector class. This operator is only available if Trilinos was detected during configuration time.

Note
Due to the communication model used in MPI, this operation can only succeed if all processes that have knowledge of v (i.e. those given by v.get_mpi_communicator()) do it at the same time. This means that unless you use a split MPI communicator then it is not normally possible for only one or a subset of processes to obtain a copy of a parallel vector while the other jobs do something else. In other words, calling this function is a 'collective operation' that needs to be executed by all MPI processes that jointly share v.

◆ operator==() [2/2]

template<typename Number >
template<typename Number2 >
bool Vector< Number >::operator== ( const Vector< Number2 > &  v) const

Test for equality. This function assumes that the present vector and the one to compare with have the same size already, since comparing vectors of different sizes makes not much sense anyway.

◆ operator!=() [2/2]

template<typename Number >
template<typename Number2 >
bool Vector< Number >::operator!= ( const Vector< Number2 > &  v) const

Test for inequality. This function assumes that the present vector and the one to compare with have the same size already, since comparing vectors of different sizes makes not much sense anyway.

◆ operator*() [5/6]

template<typename Number >
template<typename Number2 >
Number Vector< Number >::operator* ( const Vector< Number2 > &  V) const

Return the scalar product of two vectors. The return type is the underlying type of this vector, so the return type and the accuracy with which it the result is computed depend on the order of the arguments of this vector.

For complex vectors, the scalar product is implemented as \(\left<v,w\right>=\sum_i v_i \bar{w_i}\).

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile). The algorithm uses pairwise summation with the same order of summation in every run, which gives fully repeatable results from one run to another.

◆ norm_sqr() [3/3]

template<typename Number >
real_type Vector< Number >::norm_sqr ( ) const

Return the square of the \(l_2\)-norm.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile). The algorithm uses pairwise summation with the same order of summation in every run, which gives fully repeatable results from one run to another.

◆ mean_value() [4/5]

template<typename Number >
Number Vector< Number >::mean_value ( ) const

Mean value of the elements of this vector.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile). The algorithm uses pairwise summation with the same order of summation in every run, which gives fully repeatable results from one run to another.

◆ l1_norm() [4/5]

template<typename Number >
real_type Vector< Number >::l1_norm ( ) const

\(l_1\)-norm of the vector. The sum of the absolute values.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile). The algorithm uses pairwise summation with the same order of summation in every run, which gives fully repeatable results from one run to another.

◆ l2_norm() [4/5]

template<typename Number >
real_type Vector< Number >::l2_norm ( ) const

\(l_2\)-norm of the vector. The square root of the sum of the squares of the elements.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile). The algorithm uses pairwise summation with the same order of summation in every run, which gives fully repeatable results from one run to another.

◆ lp_norm() [3/3]

template<typename Number >
real_type Vector< Number >::lp_norm ( const real_type  p) const

\(l_p\)-norm of the vector. The pth root of the sum of the pth powers of the absolute values of the elements.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile). The algorithm uses pairwise summation with the same order of summation in every run, which gives fully repeatable results from one run to another.

◆ linfty_norm() [4/5]

template<typename Number >
real_type Vector< Number >::linfty_norm ( ) const

Maximum absolute value of the elements.

◆ add_and_dot() [4/5]

template<typename Number >
Number Vector< Number >::add_and_dot ( const Number  a,
const Vector< Number > &  V,
const Vector< Number > &  W 
)

Performs a combined operation of a vector addition and a subsequent inner product, returning the value of the inner product. In other words, the result of this function is the same as if the user called

this->add(a, V);
return_value = *this * W;
void add(const std::vector< size_type > &indices, const std::vector< OtherNumber > &values)

The reason this function exists is that this operation involves less memory transfer than calling the two functions separately. This method only needs to load three vectors, this, V, W, whereas calling separate methods means to load the calling vector this twice. Since most vector operations are memory transfer limited, this reduces the time by 25% (or 50% if W equals this).

For complex-valued vectors, the scalar product in the second step is implemented as \(\left<v,w\right>=\sum_i v_i \bar{w_i}\).

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile). The algorithm uses pairwise summation with the same order of summation in every run, which gives fully repeatable results from one run to another.

◆ data() [1/2]

template<typename Number >
pointer Vector< Number >::data ( )

Return a pointer to the underlying data buffer.

◆ data() [2/2]

template<typename Number >
const_pointer Vector< Number >::data ( ) const

Return a const pointer to the underlying data buffer.

◆ begin() [5/6]

template<typename Number >
iterator Vector< Number >::begin ( )

Make the Vector class a bit like the vector<> class of the C++ standard library by returning iterators to the start and end of the elements of this vector.

◆ begin() [6/6]

template<typename Number >
const_iterator Vector< Number >::begin ( ) const

Return constant iterator to the start of the vectors.

◆ end() [5/6]

template<typename Number >
iterator Vector< Number >::end ( )

Return an iterator pointing to the element past the end of the array.

◆ end() [6/6]

template<typename Number >
const_iterator Vector< Number >::end ( ) const

Return a constant iterator pointing to the element past the end of the array.

◆ operator()() [6/7]

template<typename Number >
Number Vector< Number >::operator() ( const size_type  i) const

Access the value of the ith component.

◆ operator()() [7/7]

template<typename Number >
Number& Vector< Number >::operator() ( const size_type  i)

Access the ith component as a writeable reference.

◆ operator[]() [6/7]

template<typename Number >
Number Vector< Number >::operator[] ( const size_type  i) const

Access the value of the ith component.

Exactly the same as operator().

◆ operator[]() [7/7]

template<typename Number >
Number& Vector< Number >::operator[] ( const size_type  i)

Access the ith component as a writeable reference.

Exactly the same as operator().

◆ extract_subvector_to() [5/6]

template<typename Number >
template<typename OtherNumber >
void Vector< Number >::extract_subvector_to ( const std::vector< size_type > &  indices,
std::vector< OtherNumber > &  values 
) const

Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. The indices of the elements to be read are stated in the first argument, the corresponding values are returned in the second.

If the current vector is called v, then this function is the equivalent to the code

for (unsigned int i = 0; i < indices.size(); ++i)
values[i] = v[indices[i]];
AlignedVector< Number > values
Definition: vector.h:1008
Precondition
The sizes of the indices and values arrays must be identical.

◆ extract_subvector_to() [6/6]

template<typename Number >
template<typename ForwardIterator , typename OutputIterator >
void Vector< Number >::extract_subvector_to ( ForwardIterator  indices_begin,
const ForwardIterator  indices_end,
OutputIterator  values_begin 
) const

Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. In contrast to the previous function, this function obtains the indices of the elements by dereferencing all elements of the iterator range provided by the first two arguments, and puts the vector values into memory locations obtained by dereferencing a range of iterators starting at the location pointed to by the third argument.

If the current vector is called v, then this function is the equivalent to the code

ForwardIterator indices_p = indices_begin;
OutputIterator values_p = values_begin;
while (indices_p != indices_end)
{
*values_p = v[*indices_p];
++indices_p;
++values_p;
}
Precondition
It must be possible to write into as many memory locations starting at values_begin as there are iterators between indices_begin and indices_end.

◆ operator+=() [5/6]

template<typename Number >
Vector<Number>& Vector< Number >::operator+= ( const Vector< Number > &  V)

Add the given vector to the present one.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ operator-=() [5/6]

template<typename Number >
Vector<Number>& Vector< Number >::operator-= ( const Vector< Number > &  V)

Subtract the given vector from the present one.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ add() [18/26]

template<typename Number >
template<typename OtherNumber >
void Vector< Number >::add ( const std::vector< size_type > &  indices,
const std::vector< OtherNumber > &  values 
)

A collective add operation: This function adds a whole set of values stored in values to the vector components specified by indices.

◆ add() [19/26]

template<typename Number >
template<typename OtherNumber >
void Vector< Number >::add ( const std::vector< size_type > &  indices,
const Vector< OtherNumber > &  values 
)

This is a second collective add operation. As a difference, this function takes a deal.II vector of values.

◆ add() [20/26]

template<typename Number >
template<typename OtherNumber >
void Vector< Number >::add ( const size_type  n_elements,
const size_type indices,
const OtherNumber *  values 
)

Take an address where n_elements are stored contiguously and add them into the vector. Handles all cases which are not covered by the other two add() functions above.

◆ add() [21/26]

template<typename Number >
void Vector< Number >::add ( const Number  s)

Addition of s to all components. Note that s is a scalar and not a vector.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ add() [22/26]

template<typename Number >
void Vector< Number >::add ( const Number  a,
const Vector< Number > &  V,
const Number  b,
const Vector< Number > &  W 
)

Multiple addition of scaled vectors, i.e. *this += a*V+b*W.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ add() [23/26]

template<typename Number >
void Vector< Number >::add ( const Number  a,
const Vector< Number > &  V 
)

Simple addition of a multiple of a vector, i.e. *this += a*V.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ sadd() [6/8]

template<typename Number >
void Vector< Number >::sadd ( const Number  s,
const Vector< Number > &  V 
)

Scaling and simple vector addition, i.e. this = s(*this)+V.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ sadd() [7/8]

template<typename Number >
void Vector< Number >::sadd ( const Number  s,
const Number  a,
const Vector< Number > &  V 
)

Scaling and simple addition, i.e. this = s(*this)+a*V.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ operator*=() [4/5]

template<typename Number >
Vector<Number>& Vector< Number >::operator*= ( const Number  factor)

Scale each element of the vector by a constant value.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ operator/=() [4/5]

template<typename Number >
Vector<Number>& Vector< Number >::operator/= ( const Number  factor)

Scale each element of the vector by the inverse of the given value.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ scale() [5/7]

template<typename Number >
void Vector< Number >::scale ( const Vector< Number > &  scaling_factors)

Scale each element of this vector by the corresponding element in the argument. This function is mostly meant to simulate multiplication (and immediate re-assignment) by a diagonal scaling matrix.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ scale() [6/7]

template<typename Number >
template<typename Number2 >
void Vector< Number >::scale ( const Vector< Number2 > &  scaling_factors)

Scale each element of this vector by the corresponding element in the argument. This function is mostly meant to simulate multiplication (and immediate re-assignment) by a diagonal scaling matrix.

◆ equ() [4/6]

template<typename Number >
void Vector< Number >::equ ( const Number  a,
const Vector< Number > &  u 
)

Assignment *this = a*u.

Note
If deal.II is configured with threads, this operation will run multi-threaded by splitting the work into smaller chunks (assuming there is enough work to make this worthwhile).

◆ equ() [5/6]

template<typename Number >
template<typename Number2 >
void Vector< Number >::equ ( const Number  a,
const Vector< Number2 > &  u 
)

Assignment *this = a*u.

◆ update_ghost_values() [3/3]

template<typename Number >
void Vector< Number >::update_ghost_values ( ) const

This function does nothing but exists for compatibility with the parallel vector classes (e.g., LinearAlgebra::distributed::Vector class).

◆ print() [6/7]

template<typename Number >
void Vector< Number >::print ( std::ostream &  out,
const unsigned int  precision = 3,
const bool  scientific = true,
const bool  across = true 
) const

Print to a stream. precision denotes the desired precision with which values shall be printed, scientific whether scientific notation shall be used. If across is true then the vector is printed in a line, while if false then the elements are printed on a separate line each.

◆ block_write() [3/3]

template<typename Number >
void Vector< Number >::block_write ( std::ostream &  out) const

Write the vector en bloc to a file. This is done in a binary mode, so the output is neither readable by humans nor (probably) by other computers using a different operating system or number format.

◆ block_read() [3/3]

template<typename Number >
void Vector< Number >::block_read ( std::istream &  in)

Read a vector en block from a file. This is done using the inverse operations to the above function, so it is reasonably fast because the bitstream is not interpreted.

The vector is resized if necessary.

A primitive form of error checking is performed which will recognize the bluntest attempts to interpret some data as a vector stored bitwise to a file, but not more.

◆ save()

template<typename Number >
template<class Archive >
void Vector< Number >::save ( Archive &  ar,
const unsigned int  version 
) const

Write the data of this object to a stream for the purpose of serialization using the BOOST serialization library.

◆ load()

template<typename Number >
template<class Archive >
void Vector< Number >::load ( Archive &  ar,
const unsigned int  version 
)

Read the data of this object from a stream for the purpose of serialization using the BOOST serialization library.

◆ serialize() [2/2]

template<typename Number >
template<class Archive >
void Vector< Number >::serialize ( Archive &  archive,
const unsigned int  version 
)

Write and read the data of this object from a stream for the purpose of serialization using the BOOST serialization library.

◆ in_local_range() [2/2]

template<typename Number >
bool Vector< Number >::in_local_range ( const size_type  global_index) const

Return true if the given global index is in the local range of this processor. Since this is not a distributed vector the method always returns true.

◆ locally_owned_elements() [4/5]

template<typename Number >
IndexSet Vector< Number >::locally_owned_elements ( ) const

Return an index set that describes which elements of this vector are owned by the current processor. Note that this index set does not include elements this vector may store locally as ghost elements but that are in fact owned by another processor. As a consequence, the index sets returned on different processors if this is a distributed vector will form disjoint sets that add up to the complete index set. Obviously, if a vector is created on only one processor, then the result would satisfy

vec.locally_owned_elements() == complete_index_set (vec.size())

Since the current data type does not support parallel data storage across different processors, the returned index set is the complete index set.

◆ size() [5/6]

template<typename Number >
size_type Vector< Number >::size ( ) const

Return dimension of the vector.

◆ locally_owned_size() [3/3]

template<typename Number >
size_type Vector< Number >::locally_owned_size ( ) const

Return local dimension of the vector. Since this vector does not support distributed data this is always the same value as size().

Note
This function exists for compatibility with LinearAlgebra::ReadWriteVector.

◆ all_zero() [4/5]

template<typename Number >
bool Vector< Number >::all_zero ( ) const

Return whether the vector contains only elements with value zero. This function is mainly for internal consistency checks and should seldom be used when not in debug mode since it uses quite some time.

◆ is_non_negative()

template<typename Number >
bool Vector< Number >::is_non_negative ( ) const

Return true if the vector has no negative entries, i.e. all entries are zero or positive. This function is used, for example, to check whether refinement indicators are really all positive (or zero).

The function obviously only makes sense if the template argument of this class is a real type. If it is a complex type, then an exception is thrown.

◆ memory_consumption() [5/6]

template<typename Number >
std::size_t Vector< Number >::memory_consumption ( ) const

Determine an estimate for the memory consumption (in bytes) of this object.

◆ has_ghost_elements() [5/5]

template<typename Number >
bool Vector< Number >::has_ghost_elements ( ) const

This function exists for compatibility with the parallel vector classes (e.g., LinearAlgebra::distributed::Vector class). Always returns false since this implementation is serial.

◆ maybe_reset_thread_partitioner()

template<typename Number >
void Vector< Number >::maybe_reset_thread_partitioner ( )
private

Convenience function used at the end of initialization or reinitialization. Resets (if necessary) the loop partitioner to the correct state, based on its current state and the length of the vector.

◆ do_reinit()

template<typename Number >
void Vector< Number >::do_reinit ( const size_type  new_size,
const bool  omit_zeroing_entries,
const bool  reset_partitioner 
)
private

Actual implementation of the reinit functions.

◆ swap() [7/9]

template<typename Number >
void swap ( Vector< Number > &  u,
Vector< Number > &  v 
)
inline

Global function swap which overloads the default implementation of the C++ standard library which uses a temporary object. The function simply exchanges the data of the two vectors.

Definition at line 1385 of file vector.h.

◆ operator<<() [1/2]

template<typename number >
std::ostream & operator<< ( std::ostream &  out,
const Vector< number > &  v 
)
inline

Output operator writing a vector to a stream. This operator outputs the elements of the vector one by one, with a space between entries. Each entry is formatted according to the flags set on the output stream.

Definition at line 1399 of file vector.h.

◆ reinit() [26/26]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::reinit ( const VectorSpaceVector< Number > &  V,
const bool  omit_zeroing_entries = false 
)
pure virtual

◆ operator=() [30/30]

template<typename Number >
virtual VectorSpaceVector<Number>& LinearAlgebra::VectorSpaceVector< Number >::operator= ( const Number  s)
pure virtual

◆ operator*=() [5/5]

template<typename Number >
virtual VectorSpaceVector<Number>& LinearAlgebra::VectorSpaceVector< Number >::operator*= ( const Number  factor)
pure virtual

◆ operator/=() [5/5]

template<typename Number >
virtual VectorSpaceVector<Number>& LinearAlgebra::VectorSpaceVector< Number >::operator/= ( const Number  factor)
pure virtual

◆ operator+=() [6/6]

template<typename Number >
virtual VectorSpaceVector<Number>& LinearAlgebra::VectorSpaceVector< Number >::operator+= ( const VectorSpaceVector< Number > &  V)
pure virtual

◆ operator-=() [6/6]

template<typename Number >
virtual VectorSpaceVector<Number>& LinearAlgebra::VectorSpaceVector< Number >::operator-= ( const VectorSpaceVector< Number > &  V)
pure virtual

◆ import() [15/15]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::import ( const ReadWriteVector< Number > &  V,
VectorOperation::values  operation,
std::shared_ptr< const Utilities::MPI::CommunicationPatternBase communication_pattern = {} 
)
pure virtual

Import all the elements present in the vector's IndexSet from the input vector V. VectorOperation::values operation is used to decide if the elements in V should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.

Implemented in LinearAlgebra::TpetraWrappers::Vector< Number >, LinearAlgebra::Vector< Number >, LinearAlgebra::CUDAWrappers::Vector< Number >, LinearAlgebra::EpetraWrappers::Vector, LinearAlgebra::distributed::Vector< Number, MemorySpace >, and LinearAlgebra::distributed::BlockVector< Number >.

◆ operator*() [6/6]

template<typename Number >
virtual Number LinearAlgebra::VectorSpaceVector< Number >::operator* ( const VectorSpaceVector< Number > &  V) const
pure virtual

◆ add() [24/26]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::add ( const Number  a)
pure virtual

◆ add() [25/26]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::add ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
pure virtual

◆ add() [26/26]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::add ( const Number  a,
const VectorSpaceVector< Number > &  V,
const Number  b,
const VectorSpaceVector< Number > &  W 
)
pure virtual

◆ sadd() [8/8]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::sadd ( const Number  s,
const Number  a,
const VectorSpaceVector< Number > &  V 
)
pure virtual

◆ scale() [7/7]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::scale ( const VectorSpaceVector< Number > &  scaling_factors)
pure virtual

Scale each element of this vector by the corresponding element in the argument. This function is mostly meant to simulate multiplication (and immediate re-assignment) by a diagonal scaling matrix.

Implemented in LinearAlgebra::TpetraWrappers::Vector< Number >, LinearAlgebra::Vector< Number >, LinearAlgebra::distributed::Vector< Number, MemorySpace >, LinearAlgebra::distributed::BlockVector< Number >, LinearAlgebra::CUDAWrappers::Vector< Number >, and LinearAlgebra::EpetraWrappers::Vector.

◆ equ() [6/6]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::equ ( const Number  a,
const VectorSpaceVector< Number > &  V 
)
pure virtual

◆ all_zero() [5/5]

template<typename Number >
virtual bool LinearAlgebra::VectorSpaceVector< Number >::all_zero ( ) const
pure virtual

◆ mean_value() [5/5]

template<typename Number >
virtual value_type LinearAlgebra::VectorSpaceVector< Number >::mean_value ( ) const
pure virtual

◆ l1_norm() [5/5]

template<typename Number >
virtual real_type LinearAlgebra::VectorSpaceVector< Number >::l1_norm ( ) const
pure virtual

◆ l2_norm() [5/5]

template<typename Number >
virtual real_type LinearAlgebra::VectorSpaceVector< Number >::l2_norm ( ) const
pure virtual

◆ linfty_norm() [5/5]

template<typename Number >
virtual real_type LinearAlgebra::VectorSpaceVector< Number >::linfty_norm ( ) const
pure virtual

◆ add_and_dot() [5/5]

template<typename Number >
virtual Number LinearAlgebra::VectorSpaceVector< Number >::add_and_dot ( const Number  a,
const VectorSpaceVector< Number > &  V,
const VectorSpaceVector< Number > &  W 
)
pure virtual

Perform a combined operation of a vector addition and a subsequent inner product, returning the value of the inner product. In other words, the result of this function is the same as if the user called

this->add(a, V);
return_value = *this * W;
virtual void add(const Number a)=0

The reason this function exists is that this operation involves less memory transfer than calling the two functions separately. This method only needs to load three vectors, this, V, W, whereas calling separate methods means to load the calling vector this twice. Since most vector operations are memory transfer limited, this reduces the time by 25% (or 50% if W equals this).

For complex-valued vectors, the scalar product in the second step is implemented as \(\left<v,w\right>=\sum_i v_i \bar{w_i}\).

Implemented in LinearAlgebra::TpetraWrappers::Vector< Number >, LinearAlgebra::Vector< Number >, LinearAlgebra::distributed::Vector< Number, MemorySpace >, LinearAlgebra::distributed::BlockVector< Number >, LinearAlgebra::CUDAWrappers::Vector< Number >, and LinearAlgebra::EpetraWrappers::Vector.

◆ compress() [5/5]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::compress ( VectorOperation::values  )
inlinevirtual

This function does nothing and only exists for backward compatibility.

Definition at line 226 of file vector_space_vector.h.

◆ size() [6/6]

template<typename Number >
virtual size_type LinearAlgebra::VectorSpaceVector< Number >::size ( ) const
pure virtual

◆ locally_owned_elements() [5/5]

template<typename Number >
virtual ::IndexSet LinearAlgebra::VectorSpaceVector< Number >::locally_owned_elements ( ) const
pure virtual

Return an index set that describes which elements of this vector are owned by the current processor. As a consequence, the index sets returned on different processors if this is a distributed vector will form disjoint sets that add up to the complete index set. Obviously, if a vector is created on only one processor, then the result would satisfy

vec.locally_owned_elements() == complete_index_set(vec.size())

Implemented in LinearAlgebra::TpetraWrappers::Vector< Number >, LinearAlgebra::EpetraWrappers::Vector, LinearAlgebra::Vector< Number >, LinearAlgebra::distributed::Vector< Number, MemorySpace >, LinearAlgebra::distributed::BlockVector< Number >, and LinearAlgebra::CUDAWrappers::Vector< Number >.

◆ print() [7/7]

template<typename Number >
virtual void LinearAlgebra::VectorSpaceVector< Number >::print ( std::ostream &  out,
const unsigned int  precision = 3,
const bool  scientific = true,
const bool  across = true 
) const
pure virtual

◆ memory_consumption() [6/6]

template<typename Number >
virtual std::size_t LinearAlgebra::VectorSpaceVector< Number >::memory_consumption ( ) const
pure virtual

◆ ~VectorSpaceVector()

template<typename Number >
virtual LinearAlgebra::VectorSpaceVector< Number >::~VectorSpaceVector ( )
virtualdefault

Destructor. Declared as virtual so that inheriting classes (which may manage their own memory) are destroyed correctly.

◆ set_zero_mean_value()

template<typename Number >
void LinearAlgebra::set_zero_mean_value ( VectorSpaceVector< Number > &  vector)

Shift all entries of the vector by a constant factor so that the mean value of the vector becomes zero.

Definition at line 284 of file vector_space_vector.h.

◆ swap() [8/9]

template<typename Number >
void swap ( BlockVector< Number > &  u,
BlockVector< Number > &  v 
)
related

Global function which overloads the default implementation of the C++ standard library which uses a temporary object. The function simply exchanges the data of the two vectors.

Definition at line 483 of file block_vector.h.

◆ swap() [9/9]

template<typename Number >
void swap ( Vector< Number > &  u,
Vector< Number > &  v 
)
related

Global function swap which overloads the default implementation of the C++ standard library which uses a temporary object. The function simply exchanges the data of the two vectors.

Definition at line 1385 of file vector.h.

◆ operator<<() [2/2]

template<typename number >
std::ostream & operator<< ( std::ostream &  out,
const Vector< number > &  v 
)
related

Output operator writing a vector to a stream. This operator outputs the elements of the vector one by one, with a space between entries. Each entry is formatted according to the flags set on the output stream.

Definition at line 1399 of file vector.h.

◆ ExcVectorTypeNotCompatible() [1/2]

template<typename Number >
static ::ExceptionBase& LinearAlgebra::distributed::BlockVector< Number >::ExcVectorTypeNotCompatible ( )
static

Attempt to perform an operation between two incompatible vector types.

◆ ExcIteratorRangeDoesNotMatchVectorSize()

template<typename Number >
static ::ExceptionBase& LinearAlgebra::distributed::BlockVector< Number >::ExcIteratorRangeDoesNotMatchVectorSize ( )
static

Exception

◆ ExcVectorTypeNotCompatible() [2/2]

template<typename Number , typename MemorySpace = MemorySpace::Host>
static ::ExceptionBase& LinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcVectorTypeNotCompatible ( )
static

Attempt to perform an operation between two incompatible vector types.

◆ ExcNotAllowedForCuda()

template<typename Number , typename MemorySpace = MemorySpace::Host>
static ::ExceptionBase& LinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcNotAllowedForCuda ( )
static

Attempt to perform an operation not implemented on the device.

◆ ExcNonMatchingElements()

template<typename Number , typename MemorySpace = MemorySpace::Host>
static ::ExceptionBase& LinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcNonMatchingElements ( Number  arg1,
Number  arg2,
unsigned int  arg3 
)
static

Exception

Note
The message that will be printed by this exception reads:
<< "Called compress(VectorOperation::insert), but" << " the element received from a remote processor, value " << std::setprecision(16) << arg1 << ", does not match with the value " << std::setprecision(16) << arg2 << " on the owner processor " << arg3

◆ ExcAccessToNonLocalElement()

template<typename Number , typename MemorySpace = MemorySpace::Host>
static ::ExceptionBase& LinearAlgebra::distributed::Vector< Number, MemorySpace >::ExcAccessToNonLocalElement ( size_type  arg1,
size_type  arg2,
size_type  arg3,
size_type  arg4 
)
static

Exception

Note
The message that will be printed by this exception reads:
<< "You tried to access element " << arg1 << " of a distributed vector, but this element is not " << "stored on the current processor. Note: The range of " << "locally owned elements is [" << arg2 << ',' << arg3 << "], and there are " << arg4 << " ghost elements " << "that this vector can access." << "\n\n" << "A common source for this kind of problem is that you " << "are passing a 'fully distributed' vector into a function " << "that needs read access to vector elements that correspond " << "to degrees of freedom on ghost cells (or at least to " << "'locally active' degrees of freedom that are not also " << "'locally owned'). You need to pass a vector that has these " << "elements as ghost entries."

Variable Documentation

◆ has_block

template<typename T >
constexpr bool internal::has_block = internal::is_supported_operation<has_block_t, T>
constexpr

Definition at line 51 of file block_vector_base.h.

◆ has_n_blocks

template<typename T >
constexpr bool internal::has_n_blocks
constexpr
Initial value:
=
internal::is_supported_operation<has_n_blocks_t, T>

Definition at line 57 of file block_vector_base.h.

◆ is_block_vector

template<typename T >
constexpr bool internal::is_block_vector = has_block<T> &&has_n_blocks<T>
constexpr

Definition at line 61 of file block_vector_base.h.

◆ value

template<typename VectorType >
const bool IsBlockVector< VectorType >::value = internal::is_block_vector<VectorType>
static

A statically computable value that indicates whether the template argument to this class is a block vector (in fact whether the type has the functions block() and n_blocks()).

Definition at line 87 of file block_vector_base.h.

◆ communication_block_size

template<typename Number >
constexpr unsigned int LinearAlgebra::distributed::BlockVector< Number >::communication_block_size = 20
staticconstexpr

The chunks size to split communication in update_ghost_values() and compress() calls.

Most common MPI implementations will get slow when too many messages/requests are outstanding. Even when messages are small, say 1 kB only, we should collect enough data with communication_block_size to cover typical infiniband latencies which are around a few microseconds. Sending 20 kB at a throughput of 5 GB/s takes 4 microseconds, so we should arrive at the bandwidth dominated regime then which is good enough.

Definition at line 100 of file la_parallel_block_vector.h.

◆ partitioner

template<typename Number , typename MemorySpace = MemorySpace::Host>
std::shared_ptr<const Utilities::MPI::Partitioner> LinearAlgebra::distributed::Vector< Number, MemorySpace >::partitioner
private

Shared pointer to store the parallel partitioning information. This information can be shared between several vectors that have the same partitioning.

Definition at line 1344 of file la_parallel_vector.h.

◆ allocated_size

template<typename Number , typename MemorySpace = MemorySpace::Host>
size_type LinearAlgebra::distributed::Vector< Number, MemorySpace >::allocated_size
private

The size that is currently allocated in the val array.

Definition at line 1349 of file la_parallel_vector.h.

◆ data

template<typename Number , typename MemorySpace = MemorySpace::Host>
mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace> LinearAlgebra::distributed::Vector< Number, MemorySpace >::data
private

Underlying data structure storing the local elements of this vector.

Definition at line 1354 of file la_parallel_vector.h.

◆ thread_loop_partitioner [1/3]

template<typename Number , typename MemorySpace = MemorySpace::Host>
std::shared_ptr<::parallel::internal::TBBPartitioner> LinearAlgebra::distributed::Vector< Number, MemorySpace >::thread_loop_partitioner
mutableprivate

For parallel loops with TBB, this member variable stores the affinity information of loops.

Definition at line 1361 of file la_parallel_vector.h.

◆ import_data

template<typename Number , typename MemorySpace = MemorySpace::Host>
mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace> LinearAlgebra::distributed::Vector< Number, MemorySpace >::import_data
private

Temporary storage that holds the data that is sent to this processor in compress() or sent from this processor in update_ghost_values().

Definition at line 1368 of file la_parallel_vector.h.

◆ vector_is_ghosted

template<typename Number , typename MemorySpace = MemorySpace::Host>
bool LinearAlgebra::distributed::Vector< Number, MemorySpace >::vector_is_ghosted
mutableprivate

Stores whether the vector currently allows for reading ghost elements or not. Note that this is to ensure consistent ghost data and does not indicate whether the vector actually can store ghost elements. In particular, when assembling a vector we do not allow reading elements, only writing them.

Definition at line 1377 of file la_parallel_vector.h.

◆ compress_requests

template<typename Number , typename MemorySpace = MemorySpace::Host>
std::vector<MPI_Request> LinearAlgebra::distributed::Vector< Number, MemorySpace >::compress_requests
private

A vector that collects all requests from compress() operations. This class uses persistent MPI communicators, i.e., the communication channels are stored during successive calls to a given function. This reduces the overhead involved with setting up the MPI machinery, but it does not remove the need for a receive operation to be posted before the data can actually be sent.

Definition at line 1388 of file la_parallel_vector.h.

◆ update_ghost_values_requests

template<typename Number , typename MemorySpace = MemorySpace::Host>
std::vector<MPI_Request> LinearAlgebra::distributed::Vector< Number, MemorySpace >::update_ghost_values_requests
mutableprivate

A vector that collects all requests from update_ghost_values() operations. This class uses persistent MPI communicators.

Definition at line 1394 of file la_parallel_vector.h.

◆ mutex

template<typename Number , typename MemorySpace = MemorySpace::Host>
std::mutex LinearAlgebra::distributed::Vector< Number, MemorySpace >::mutex
mutableprivate

A lock that makes sure that the compress() and update_ghost_values() functions give reasonable results also when used with several threads.

Definition at line 1402 of file la_parallel_vector.h.

◆ comm_sm

template<typename Number , typename MemorySpace = MemorySpace::Host>
MPI_Comm LinearAlgebra::distributed::Vector< Number, MemorySpace >::comm_sm
private

Communicator to be used for the shared-memory domain. See the general documentation of this class for more information about the purpose of comm_sm.

Definition at line 1409 of file la_parallel_vector.h.

◆ has_get_mpi_communicator

template<typename Number >
template<typename T >
constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_get_mpi_communicator
staticconstexpr
Initial value:
=
is_supported_operation<get_mpi_communicator_t, T>

Definition at line 1900 of file la_parallel_vector.h.

◆ has_locally_owned_domain_indices

template<typename Number >
template<typename T >
constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_locally_owned_domain_indices
staticconstexpr
Initial value:
=
is_supported_operation<locally_owned_domain_indices_t, T>

Definition at line 1910 of file la_parallel_vector.h.

◆ has_locally_owned_range_indices

template<typename Number >
template<typename T >
constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_locally_owned_range_indices
staticconstexpr
Initial value:
=
is_supported_operation<locally_owned_range_indices_t, T>

Definition at line 1920 of file la_parallel_vector.h.

◆ has_initialize_dof_vector

template<typename Number >
template<typename T >
constexpr bool internal::LinearOperatorImplementation::ReinitHelper< LinearAlgebra::distributed::Vector< Number > >::has_initialize_dof_vector
staticconstexpr
Initial value:
=
is_supported_operation<initialize_dof_vector_t, T>

Definition at line 1931 of file la_parallel_vector.h.

◆ stored_elements

template<typename Number >
IndexSet LinearAlgebra::ReadWriteVector< Number >::stored_elements
protected

Indices of the elements stored.

Definition at line 721 of file read_write_vector.h.

◆ source_stored_elements

template<typename Number >
IndexSet LinearAlgebra::ReadWriteVector< Number >::source_stored_elements
protected

IndexSet of the elements of the last imported vector;

Definition at line 726 of file read_write_vector.h.

◆ comm_pattern

template<typename Number >
std::shared_ptr<Utilities::MPI::CommunicationPatternBase> LinearAlgebra::ReadWriteVector< Number >::comm_pattern
protected

CommunicationPattern for the communication between the source_stored_elements IndexSet and the current vector.

Definition at line 732 of file read_write_vector.h.

◆ values [1/2]

template<typename Number >
std::unique_ptr<Number[], decltype(std::free) *> LinearAlgebra::ReadWriteVector< Number >::values
protected

Pointer to the array of local elements of this vector.

Definition at line 737 of file read_write_vector.h.

◆ thread_loop_partitioner [2/3]

template<typename Number >
std::shared_ptr<::parallel::internal::TBBPartitioner> LinearAlgebra::ReadWriteVector< Number >::thread_loop_partitioner
mutableprotected

For parallel loops with TBB, this member variable stores the affinity information of loops.

Definition at line 744 of file read_write_vector.h.

◆ parent

template<typename Number >
template<typename Functor >
ReadWriteVector& LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::parent
private

Alias to the ReadWriteVector object that owns the FunctorTemplate.

Definition at line 775 of file read_write_vector.h.

◆ functor

template<typename Number >
template<typename Functor >
const Functor& LinearAlgebra::ReadWriteVector< Number >::FunctorTemplate< Functor >::functor
private

Copy of the functor.

Definition at line 780 of file read_write_vector.h.

◆ values [2/2]

template<typename Number >
AlignedVector<Number> Vector< Number >::values
private

Array of elements owned by this vector.

Definition at line 1008 of file vector.h.

◆ thread_loop_partitioner [3/3]

template<typename Number >
std::shared_ptr<parallel::internal::TBBPartitioner> Vector< Number >::thread_loop_partitioner
mutableprivate

For parallel loops with TBB, this member variable stores the affinity information of loops.

Definition at line 1031 of file vector.h.

Friends

◆ Vector [1/3]

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename Number2 , typename MemorySpace2 >
friend class Vector
friend

Typedef for the vector type used

Typedef for the vector type used.

Definition at line 1427 of file la_parallel_vector.h.

◆ BlockVector

template<typename Number , typename MemorySpace = MemorySpace::Host>
template<typename Number2 >
friend class BlockVector
friend

Typedef for the block-vector type used

Typedef for the type used to describe vectors that consist of multiple blocks.

Definition at line 1431 of file la_parallel_vector.h.

◆ Vector [2/3]

template<typename Number >
template<typename Number2 >
friend class Vector
friend

Typedef for the vector type used

Typedef for the vector type used.

Definition at line 421 of file la_vector.h.

◆ ReadWriteVector

template<typename Number >
template<typename Number2 >
friend class ReadWriteVector
friend

Definition at line 748 of file read_write_vector.h.

◆ Vector [3/3]

template<typename Number >
template<typename Number2 >
friend class Vector
friend

Typedef for the vector type used

Typedef for the vector type used.

Definition at line 1035 of file vector.h.