ug4
|
#include <parallel_vector.h>
Public Types | |
typedef size_t | size_type |
typedef ParallelVector< TVector > | this_type |
own type | |
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 | |
bool | change_storage_type (ParallelStorageType type) |
changes to the requested storage type if possible | |
void | check_storage_type () const |
checks correctness of storage type | |
SmartPtr< this_type > | clone () const |
clones the vector (deep-copy) including values | |
SmartPtr< this_type > | clone_without_values () const |
clones the vector (deep-copy) excluding values | |
number | dotprod (const this_type &v) |
dotprod (overwrites TVector::dotprod()) | |
void | enforce_consistent_type () |
sets storage type to consistent | |
uint | get_storage_mask () const |
returns storage type mask | |
ParallelStorageType | get_storage_type () const |
bool | has_storage_type (uint type) const |
returns if the current storage type has a given representation | |
ConstSmartPtr< AlgebraLayouts > | layouts () const |
returns the algebra layouts | |
number | maxnorm () const |
max norm (overwrites TVector::maxnorm()) | |
number | norm () const |
two norm (overwrites TVector::norm()) | |
this_type & | operator+= (const this_type &v) |
add a vector | |
this_type & | operator-= (const this_type &v) |
subtract a vector | |
this_type & | operator= (const this_type &v) |
assignment | |
template<typename TVector > | |
ParallelVector< TVector >::this_type & | operator= (const typename ParallelVector< TVector >::this_type &v) |
number | operator= (number d) |
assign number to whole Vector | |
ParallelVector () | |
Default constructor. | |
ParallelVector (ConstSmartPtr< AlgebraLayouts > layouts) | |
Constructor setting the Layouts. | |
ParallelVector (size_t length) | |
Resizing constructor. | |
void | remove_storage_type (uint type) |
removes a storage type | |
void | set (number w) |
sets all entries to a value and the storage type to consistent | |
void | set (number w, ParallelStorageType type) |
set all entries to value and the storage type | |
void | set_layouts (ConstSmartPtr< AlgebraLayouts > layouts) |
sets the algebra layouts | |
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)) | |
void | set_storage_type (uint type) |
sets the storage type | |
Protected Member Functions | |
virtual this_type * | virtual_clone () const |
virtual clone using covariant return type | |
virtual this_type * | virtual_clone_without_values () const |
virtual clone using covariant return type excluding values | |
Private Member Functions | |
template<typename T > | |
this_type & | operator= (T t) |
catch all other assignments so we don't use copy constructor here | |
Private Attributes | |
ConstSmartPtr< AlgebraLayouts > | m_spAlgebraLayouts |
algebra layouts and communicators | |
uint | m_type |
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).
TVector | Sequential Vector type |
typedef size_t ug::ParallelVector< TVector >::size_type |
typedef ParallelVector<TVector> ug::ParallelVector< TVector >::this_type |
own type
typedef TVector::value_type ug::ParallelVector< TVector >::value_type |
typedef TVector::vector_type ug::ParallelVector< TVector >::vector_type |
|
inline |
Default constructor.
References new().
|
inline |
Resizing constructor.
References new().
|
inline |
Constructor setting the Layouts.
|
inline |
adds a storage type
type may be any or-combination of constants enumerated in ug::ParallelStorageType.
References ug::ParallelVector< TVector >::m_type.
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().
void ug::ParallelVector< TVector >::check_storage_type | ( | ) | const |
checks correctness of storage type
References pcl::SingleLevelLayout< TInterface >::begin(), ug::BlockNorm2(), pcl::InterfaceCommunicator< TLayout >::communicate(), pcl::SingleLevelLayout< TInterface >::end(), pcl::OrderedInterface< TType, TContainer, TAlloc >::get_element(), ug::PST_CONSISTENT, ug::PST_UNIQUE, pcl::InterfaceCommunicator< TLayout >::receive_data(), pcl::InterfaceCommunicator< TLayout >::send_data(), and UG_LOG_ALL_PROCS.
SmartPtr< ParallelVector< TVector > > ug::ParallelVector< TVector >::clone | ( | ) | const |
clones the vector (deep-copy) including values
SmartPtr< ParallelVector< TVector > > ug::ParallelVector< TVector >::clone_without_values | ( | ) | const |
clones the vector (deep-copy) excluding values
|
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.
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().
|
inline |
returns storage type mask
References ug::ParallelVector< TVector >::m_type.
Referenced by ug::CloneVector(), ug::ParallelVector< TVector >::operator+=(), ug::ParallelVector< TVector >::operator-=(), ug::ParallelVector< TVector >::operator=(), ug::Serialize(), ug::SerializeUniquePart(), ug::VecAssign(), ug::VecHadamardProd(), ug::VecScaleAdd(), ug::VecScaleAdd(), and ug::VecScaleAssign().
|
inline |
References ug::ParallelVector< TVector >::m_type.
Referenced by ug::BroadcastVectorFromOne(), ug::GatherVectorOnOne(), ug::GetMultType(), ug::MatMultAddDirect(), and ug::MatMultAddDirect().
|
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(), ug::MatMultAddDirect(), and ug::MatMultAddDirect().
|
inline |
returns the algebra layouts
References ug::ParallelVector< TVector >::m_spAlgebraLayouts.
Referenced by ug::BroadcastVectorFromOne(), ug::CheckVectorInvertible(), ug::CloneVector(), ug::GatherVectorOnOne(), ug::IsFinite(), ug::IsFiniteAndNotTooBig(), ug::ParallelVector< TVector >::operator=(), and ug::ParallelVector< TVector >::set_layouts().
|
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.
|
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.
ParallelVector< TVector >::this_type & ug::ParallelVector< TVector >::operator+= | ( | const this_type & | v | ) |
add a vector
References ug::ParallelVector< TVector >::get_storage_mask(), and UG_THROW.
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.
this_type & ug::ParallelVector< TVector >::operator= | ( | const this_type & | v | ) |
assignment
ParallelVector< TVector >::this_type & ug::ParallelVector< TVector >::operator= | ( | const typename ParallelVector< TVector >::this_type & | v | ) |
number ug::ParallelVector< TVector >::operator= | ( | number | d | ) |
assign number to whole Vector
|
private |
catch all other assignments so we don't use copy constructor here
|
inline |
removes a storage type
type may be any or-combination of constants enumerated in ug::ParallelStorageType.
References ug::ParallelVector< TVector >::m_type.
|
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().
void ug::ParallelVector< TVector >::set | ( | number | w, |
ParallelStorageType | type | ||
) |
set all entries to value and the storage type
References PROFILE_FUNC_GROUP, ug::PST_ADDITIVE, ug::PST_CONSISTENT, ug::PST_UNDEFINED, and ug::PST_UNIQUE.
Referenced by ug::IExternalSolver< TAlgebra >::apply(), ug::ILUTScalarPreconditioner< TAlgebra >::apply_double(), ug::GatherVectorOnOne(), and ug::ILUTScalarPreconditioner< TAlgebra >::solve().
|
inline |
sets the algebra layouts
References ug::ParallelVector< TVector >::layouts(), and ug::ParallelVector< TVector >::m_spAlgebraLayouts.
Referenced by ug::ILUTScalarPreconditioner< TAlgebra >::apply_double(), ug::CloneVector(), ug::Jacobi< TAlgebra >::preprocess(), ug::ILUTScalarPreconditioner< TAlgebra >::solve(), and ug::ParallelVector< TVector >::virtual_clone_without_values().
|
inline |
References ug::PST_CONSISTENT, and ug::ParallelVector< TVector >::set_random().
Referenced by ug::ParallelVector< TVector >::set_random().
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.
|
inline |
sets the storage type
type may be any or-combination of constants enumerated in ug::ParallelStorageType.
References ug::ParallelVector< TVector >::m_type.
Referenced by ug::IExternalSolver< TAlgebra >::apply(), ug::ILUTScalarPreconditioner< TAlgebra >::apply_double(), ug::BroadcastVectorFromOne(), ug::CloneVector(), ug::Deserialize(), ug::DeserializeUniquePart(), ug::GatherVectorOnOne(), ug::MatMultAddDirect(), ug::MatMultAddDirect(), ug::MatMultDirect(), ug::MatMultTransposedDirect(), ug::Jacobi< TAlgebra >::preprocess(), ug::ILUTScalarPreconditioner< TAlgebra >::solve(), ug::VecAssign(), ug::VecHadamardProd(), ug::VecScaleAdd(), ug::VecScaleAdd(), and ug::VecScaleAssign().
|
protectedvirtual |
virtual clone using covariant return type
|
protectedvirtual |
virtual clone using covariant return type excluding values
References ug::ParallelVector< TVector >::set_layouts().
|
private |
algebra layouts and communicators
Referenced by ug::ParallelVector< TVector >::layouts(), and ug::ParallelVector< TVector >::set_layouts().
|
private |
Referenced by ug::ParallelVector< TVector >::add_storage_type(), ug::ParallelVector< TVector >::get_storage_mask(), ug::ParallelVector< TVector >::get_storage_type(), ug::ParallelVector< TVector >::has_storage_type(), ug::ParallelVector< TVector >::remove_storage_type(), and ug::ParallelVector< TVector >::set_storage_type().