ug4
ug::ComPol_VecAddSetZero< TVector > Class Template Reference

Communication Policy to add values of a vector and reset value to zero on sending interface. More...

#include <communication_policies.h>

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

Public Member Functions

virtual bool collect (ug::BinaryBuffer &buff, const Interface &interface)
 
 ComPol_VecAddSetZero ()
 Default Constructor. More...
 
 ComPol_VecAddSetZero (TVector *pVec)
 Constructor setting vector. More...
 
virtual bool extract (ug::BinaryBuffer &buff, const Interface &interface)
 adds the values of a buffer to the values on the interface More...
 
virtual int get_required_buffer_size (const Interface &interface)
 returns the buffer size More...
 
void set_vector (TVector *pVec)
 sets the vector that we be used for communication More...
 
- Public Member Functions inherited from pcl::ICommunicationPolicy< IndexLayout >
virtual bool begin_layout_collection (const Layout *pLayout)
 signals the beginning of a layout collection. More...
 
virtual bool begin_layout_extraction (const Layout *pLayout)
 signals the beginning of a layout extraction. More...
 
virtual void begin_level_extraction (int level)
 signals that a new layout-level will now be processed. More...
 
virtual bool end_layout_collection (const Layout *pLayout)
 signals the end of a layout collection More...
 
virtual bool end_layout_extraction (const Layout *pLayout)
 signals the end of a layout extraction More...
 
virtual ~ICommunicationPolicy ()
 

Private Attributes

TVector * m_pVec
 

Additional Inherited Members

- Public Types inherited from pcl::ICommunicationPolicy< IndexLayout >
typedef Layout::Interface Interface
 
typedef IndexLayout Layout
 

Detailed Description

template<class TVector>
class ug::ComPol_VecAddSetZero< TVector >

Communication Policy to add values of a vector and reset value to zero on sending interface.

This class is used as a policy to add values on the interfaces of a parallel vector and set the values to zero on the sending interface. The collecting routine packs the interface values of the given vector into a stream and and sets those entries to zero immediately after packing. The extracting interfaces receive the stream and add the values to those of already existing in the vector.

Note
If an entry is sent over multiple interfaces, only the first connected proc will receive the full value. All others will receive 0. This helps to keep the vector additive.
Template Parameters
TVectorVector type

Constructor & Destructor Documentation

◆ ComPol_VecAddSetZero() [1/2]

template<class TVector >
ug::ComPol_VecAddSetZero< TVector >::ComPol_VecAddSetZero ( )
inline

Default Constructor.

◆ ComPol_VecAddSetZero() [2/2]

template<class TVector >
ug::ComPol_VecAddSetZero< TVector >::ComPol_VecAddSetZero ( TVector *  pVec)
inline

Constructor setting vector.

Member Function Documentation

◆ collect()

template<class TVector >
virtual bool ug::ComPol_VecAddSetZero< TVector >::collect ( ug::BinaryBuffer buff,
const Interface interface 
)
inlinevirtual

writes the interface values into a buffer that will be sent and then sets the value to zero on the interface This function collects all entries of the vector into a buffer that are part of the interface. The values on the interface are then set to zero.

Parameters
[out]buffBuffer
[in]interfaceInterface that will communicate

Implements pcl::ICommunicationPolicy< IndexLayout >.

References pcl::OrderedInterface< TType, TContainer, TAlloc >::begin(), pcl::OrderedInterface< TType, TContainer, TAlloc >::end(), pcl::OrderedInterface< TType, TContainer, TAlloc >::get_element(), ug::ComPol_VecAddSetZero< TVector >::m_pVec, PROFILE_BEGIN_GROUP, and ug::Serialize().

◆ extract()

template<class TVector >
virtual bool ug::ComPol_VecAddSetZero< TVector >::extract ( ug::BinaryBuffer buff,
const Interface interface 
)
inlinevirtual

adds the values of a buffer to the values on the interface

This function adds the values of the buffer to the interface values.

Parameters
[out]buffBuffer
[in]interfaceInterface that communicates

Implements pcl::ICommunicationPolicy< IndexLayout >.

References pcl::OrderedInterface< TType, TContainer, TAlloc >::begin(), ug::Deserialize(), pcl::OrderedInterface< TType, TContainer, TAlloc >::end(), pcl::OrderedInterface< TType, TContainer, TAlloc >::get_element(), ug::ComPol_VecAddSetZero< TVector >::m_pVec, and PROFILE_BEGIN_GROUP.

◆ get_required_buffer_size()

template<class TVector >
virtual int ug::ComPol_VecAddSetZero< TVector >::get_required_buffer_size ( const Interface interface)
inlinevirtual

returns the buffer size

This function returns the size of the buffer needed for the communication of passed interface. If the vector has fixed size entries this is just the number of interface entries times the size of the entry. In case of a variable size entry type a negative value is returned to indicate that no buffer size can be determined in advanced.

Parameters
[in]interfaceInterface that will communicate

Reimplemented from pcl::ICommunicationPolicy< IndexLayout >.

References pcl::OrderedInterface< TType, TContainer, TAlloc >::size().

◆ set_vector()

template<class TVector >
void ug::ComPol_VecAddSetZero< TVector >::set_vector ( TVector *  pVec)
inline

sets the vector that we be used for communication

References ug::ComPol_VecAddSetZero< TVector >::m_pVec.

Member Data Documentation

◆ m_pVec


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