ug4
ug::ParallelVector< TVector > Class Template Reference

#include <parallel_vector.h>

+ Inheritance diagram for ug::ParallelVector< TVector >:

Public Types

typedef size_t size_type
 
typedef ParallelVector< TVector > this_type
 own type More...
 
typedef TVector::value_type value_type
 
typedef TVector::vector_type vector_type
 

Public Member Functions

void add_storage_type (uint type)
 adds a storage type More...
 
bool change_storage_type (ParallelStorageType type)
 changes to the requested storage type if possible More...
 
void check_storage_type () const
 checks correctness of storage type More...
 
SmartPtr< this_typeclone () const
 clones the vector (deep-copy) including values More...
 
SmartPtr< this_typeclone_without_values () const
 clones the vector (deep-copy) excluding values More...
 
number dotprod (const this_type &v)
 dotprod (overwrites TVector::dotprod()) More...
 
void enforce_consistent_type ()
 sets storage type to consistent More...
 
uint get_storage_mask () const
 returns storage type mask More...
 
ParallelStorageType get_storage_type () const
 
bool has_storage_type (uint type) const
 returns if the current storage type has a given representation More...
 
ConstSmartPtr< AlgebraLayoutslayouts () const
 returns the algebra layouts More...
 
number maxnorm () const
 max norm (overwrites TVector::maxnorm()) More...
 
number norm () const
 two norm (overwrites TVector::norm()) More...
 
this_typeoperator+= (const this_type &v)
 add a vector More...
 
this_typeoperator-= (const this_type &v)
 subtract a vector More...
 
this_typeoperator= (const this_type &v)
 assignment More...
 
template<typename TVector >
ParallelVector< TVector >::this_typeoperator= (const typename ParallelVector< TVector >::this_type &v)
 
number operator= (number d)
 assign number to whole Vector More...
 
 ParallelVector ()
 Default constructor. More...
 
 ParallelVector (ConstSmartPtr< AlgebraLayouts > layouts)
 Constructor setting the Layouts. More...
 
 ParallelVector (size_t length)
 Resizing constructor. More...
 
void remove_storage_type (uint type)
 removes a storage type More...
 
void set (number w)
 sets all entries to a value and the storage type to consistent More...
 
void set (number w, ParallelStorageType type)
 set all entries to value and the storage type More...
 
void set_layouts (ConstSmartPtr< AlgebraLayouts > layouts)
 sets the algebra layouts More...
 
void set_random (number from, number to)
 
void set_random (number from, number to, ParallelStorageType type)
 set all entries to a random number (overwrites TVector::set_random(number from, number to)) More...
 
void set_storage_type (uint type)
 sets the storage type More...
 

Protected Member Functions

virtual this_typevirtual_clone () const
 virtual clone using covariant return type More...
 
virtual this_typevirtual_clone_without_values () const
 virtual clone using covariant return type excluding values More...
 

Private Member Functions

template<typename T >
this_typeoperator= (T t)
 catch all other assignments so we don't use copy constructor here More...
 

Private Attributes

ConstSmartPtr< AlgebraLayoutsm_spAlgebraLayouts
 algebra layouts and communicators More...
 
uint m_type
 

Detailed Description

template<typename TVector>
class ug::ParallelVector< TVector >

Parallelization Wrapper to make a Vector usable in parallel A ParallelVector is a wrapper around a sequential vector to make it usable in parallel. It has all the function a sequential vector supports, since it is derived from it. Furthermore the ParallelStorageType is remembered and can be switched. In addition some functions of the sequential vector are overwritten to adapted the functionality to parallel (e.g. norm, set).

Template Parameters
TVectorSequential Vector type

Member Typedef Documentation

◆ size_type

template<typename TVector >
typedef size_t ug::ParallelVector< TVector >::size_type

◆ this_type

template<typename TVector >
typedef ParallelVector<TVector> ug::ParallelVector< TVector >::this_type

own type

◆ value_type

template<typename TVector >
typedef TVector::value_type ug::ParallelVector< TVector >::value_type

◆ vector_type

template<typename TVector >
typedef TVector::vector_type ug::ParallelVector< TVector >::vector_type

Constructor & Destructor Documentation

◆ ParallelVector() [1/3]

template<typename TVector >
ug::ParallelVector< TVector >::ParallelVector ( )
inline

Default constructor.

◆ ParallelVector() [2/3]

template<typename TVector >
ug::ParallelVector< TVector >::ParallelVector ( size_t  length)
inline

Resizing constructor.

◆ ParallelVector() [3/3]

template<typename TVector >
ug::ParallelVector< TVector >::ParallelVector ( ConstSmartPtr< AlgebraLayouts layouts)
inline

Constructor setting the Layouts.

Member Function Documentation

◆ add_storage_type()

template<typename TVector >
void ug::ParallelVector< TVector >::add_storage_type ( uint  type)
inline

adds a storage type

type may be any or-combination of constants enumerated in ug::ParallelStorageType.

References ug::ParallelVector< TVector >::m_type.

◆ change_storage_type()

template<typename TVector >
bool ug::ParallelVector< TVector >::change_storage_type ( ParallelStorageType  type)

changes to the requested storage type if possible

References PROFILE_FUNC_GROUP, ug::PST_UNDEFINED, and UG_THROW.

Referenced by ug::Jacobi< TAlgebra >::preprocess().

◆ check_storage_type()

◆ clone()

template<typename TVector >
SmartPtr< ParallelVector< TVector > > ug::ParallelVector< TVector >::clone

clones the vector (deep-copy) including values

◆ clone_without_values()

template<typename TVector >
SmartPtr< ParallelVector< TVector > > ug::ParallelVector< TVector >::clone_without_values

clones the vector (deep-copy) excluding values

◆ dotprod()

template<typename TVector >
number ug::ParallelVector< TVector >::dotprod ( const this_type v)
inline

dotprod (overwrites TVector::dotprod())

Returns the dot product of the vector. First, the dot prod of each process is computed using the dotprod() method of the sequential vector. Then, the results are summarized over all processes.

References ug::ParallelVector< TVector >::has_storage_type(), PCL_DT_DOUBLE, PCL_RO_SUM, PROFILE_FUNC_GROUP, ug::PST_ADDITIVE, ug::PST_CONSISTENT, ug::PST_UNDEFINED, ug::PST_UNIQUE, UG_LOG, and UG_THROW.

◆ enforce_consistent_type()

template<typename TVector >
void ug::ParallelVector< TVector >::enforce_consistent_type

sets storage type to consistent

References ug::PST_ADDITIVE, ug::PST_CONSISTENT, ug::PST_UNIQUE, and ug::SetLayoutValues().

◆ get_storage_mask()

◆ get_storage_type()

template<typename TVector >
ParallelStorageType ug::ParallelVector< TVector >::get_storage_type ( ) const
inline

◆ has_storage_type()

template<typename TVector >
bool ug::ParallelVector< TVector >::has_storage_type ( uint  type) const
inline

returns if the current storage type has a given representation

type may be any or-combination of constants enumerated in ug::ParallelStorageType.

References ug::ParallelVector< TVector >::m_type, and ug::PST_UNDEFINED.

Referenced by ug::BroadcastVectorFromOne(), ug::ParallelVector< TVector >::dotprod(), ug::GatherVectorOnOne(), ug::GetMultType(), and ug::MatMultAddDirect().

◆ layouts()

◆ maxnorm()

template<typename TVector >
number ug::ParallelVector< TVector >::maxnorm
inline

max norm (overwrites TVector::maxnorm())

References PARVEC_PROFILE_BEGIN, PARVEC_PROFILE_END, PCL_RO_MAX, PROFILE_FUNC_GROUP, ug::PST_ADDITIVE, ug::PST_UNIQUE, and UG_THROW.

◆ norm()

template<typename TVector >
number ug::ParallelVector< TVector >::norm
inline

two norm (overwrites TVector::norm())

Returns the two norm of the Vector. First, the two norm of each process is computed using the norm() method of the sequential vector. Then, the norms are summarized over all processes.

References PARVEC_PROFILE_BEGIN, PARVEC_PROFILE_END, PCL_RO_SUM, PROFILE_FUNC_GROUP, ug::PST_UNIQUE, and UG_THROW.

◆ operator+=()

template<typename TVector >
ParallelVector< TVector >::this_type & ug::ParallelVector< TVector >::operator+= ( const this_type v)

◆ operator-=()

template<typename TVector >
ParallelVector< TVector >::this_type & ug::ParallelVector< TVector >::operator-= ( const this_type v)

subtract a vector

References ug::ParallelVector< TVector >::get_storage_mask(), and UG_THROW.

◆ operator=() [1/4]

template<typename TVector >
this_type& ug::ParallelVector< TVector >::operator= ( const this_type v)

assignment

◆ operator=() [2/4]

template<typename TVector >
template<typename TVector >
ParallelVector<TVector>::this_type& ug::ParallelVector< TVector >::operator= ( const typename ParallelVector< TVector >::this_type v)

◆ operator=() [3/4]

template<typename TVector >
number ug::ParallelVector< TVector >::operator= ( number  d)

assign number to whole Vector

◆ operator=() [4/4]

template<typename TVector >
template<typename T >
this_type& ug::ParallelVector< TVector >::operator= ( t)
private

catch all other assignments so we don't use copy constructor here

◆ remove_storage_type()

template<typename TVector >
void ug::ParallelVector< TVector >::remove_storage_type ( uint  type)
inline

removes a storage type

type may be any or-combination of constants enumerated in ug::ParallelStorageType.

References ug::ParallelVector< TVector >::m_type.

◆ set() [1/2]

template<typename TVector >
void ug::ParallelVector< TVector >::set ( number  w)
inline

sets all entries to a value and the storage type to consistent

References ug::PST_CONSISTENT, and ug::ParallelVector< TVector >::set().

Referenced by ug::ParallelVector< TVector >::set().

◆ set() [2/2]

◆ set_layouts()

◆ set_random() [1/2]

template<typename TVector >
void ug::ParallelVector< TVector >::set_random ( number  from,
number  to 
)
inline

◆ set_random() [2/2]

template<typename TVector >
void ug::ParallelVector< TVector >::set_random ( number  from,
number  to,
ParallelStorageType  type 
)

set all entries to a random number (overwrites TVector::set_random(number from, number to))

References PROFILE_FUNC_GROUP, and ug::PST_ADDITIVE.

◆ set_storage_type()

◆ virtual_clone()

template<typename TVector >
ParallelVector< TVector > * ug::ParallelVector< TVector >::virtual_clone
protectedvirtual

virtual clone using covariant return type

◆ virtual_clone_without_values()

template<typename TVector >
ParallelVector< TVector > * ug::ParallelVector< TVector >::virtual_clone_without_values
protectedvirtual

virtual clone using covariant return type excluding values

References ug::ParallelVector< TVector >::set_layouts().

Member Data Documentation

◆ m_spAlgebraLayouts

template<typename TVector >
ConstSmartPtr<AlgebraLayouts> ug::ParallelVector< TVector >::m_spAlgebraLayouts
private

algebra layouts and communicators

Referenced by ug::ParallelVector< TVector >::layouts(), and ug::ParallelVector< TVector >::set_layouts().

◆ m_type


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