33#ifndef __H__PCL__PCL_COMMUNICATION_STRUCTS__
34#define __H__PCL__PCL_COMMUNICATION_STRUCTS__
72namespace interface_tags
72namespace interface_tags {
…}
138template <
class TType,
139 template <
class T,
class Alloc>
class TContainer = std::vector,
140 template <
class T>
class TAlloc = std::allocator>
186 template <
class TCompare>
203template <
class TType,
204 template <
class T,
class Alloc>
class TContainer = std::vector,
205 template <
class T>
class TAlloc = std::allocator>
219 template <
class TElemCmp>
227 typedef TContainer<InterfaceEntry, TAlloc<InterfaceEntry> >
269 size_t startNumber = 0;
270 if (insertBefore !=
end())
271 startNumber = insertBefore->localID;
280 (*iter).localID = ++startNumber;
313 const std::input_iterator_tag&)
315 return (*iter1).localID < (*iter2).localID;
330 template <
class TCompare>
350 template <
class TCompare>
357 return std::lower_bound(it_begin, it_end, iEntry, ieCmp);
388namespace layout_tags {
…}
450template <
class TInterface>
470 typedef typename Interface::Type
Type;
573 template <
class TCompare>
583 SingleLevelLayout(const SingleLevelLayout& sll);
586 SingleLevelLayout& operator = (const SingleLevelLayout& sll);
613template <
class TInterface>
631 typedef typename Interface::Type
Type;
729 for(
size_t lvl = 0; lvl <
num_levels(); ++lvl){
739 for(
size_t lvl = 0; lvl <
num_levels(); ++lvl){
755 template <
class TCompare>
758 for(
size_t lvl = 0; lvl <
num_levels(); ++lvl)
774 for(
size_t i = 0; i < mll.
m_vLayouts.size(); ++i)
788template <
class TLayout>
You may add elements to this interface and iterate over them.
Definition pcl_communication_structs.h:142
size_t m_size
Definition pcl_communication_structs.h:195
const_iterator begin() const
Definition pcl_communication_structs.h:163
const_iterator end() const
Definition pcl_communication_structs.h:164
type_traits< TType >::Elem TElem
Definition pcl_communication_structs.h:144
TContainer< TElem, TAlloc< TElem > > ElemContainer
Definition pcl_communication_structs.h:145
size_t size() const
returns the number of elements that are stored in the interface.
Definition pcl_communication_structs.h:170
int get_target_proc() const
Definition pcl_communication_structs.h:173
iterator begin()
Definition pcl_communication_structs.h:161
ElemContainer::const_iterator const_iterator
Definition pcl_communication_structs.h:153
int m_targetProc
Definition pcl_communication_structs.h:196
iterator erase(iterator iter)
Definition pcl_communication_structs.h:159
Element & get_element(iterator iter)
Definition pcl_communication_structs.h:166
void swap(BasicInterface &interface)
swaps the content of two interfaces.
Definition pcl_communication_structs.h:177
ElemContainer m_elements
Definition pcl_communication_structs.h:194
iterator end()
Definition pcl_communication_structs.h:162
const Element & get_element(const_iterator iter) const
Definition pcl_communication_structs.h:167
BasicInterface(int targetProc=-1)
Definition pcl_communication_structs.h:156
ElemContainer::iterator iterator
Definition pcl_communication_structs.h:152
bool empty() const
Definition pcl_communication_structs.h:171
void sort(TCompare cmp)
sort the entries in this interface.
Definition pcl_communication_structs.h:187
interface_tags::basic_interface_tag category_tag
Definition pcl_communication_structs.h:148
type_traits< TType >::Elem Element
Definition pcl_communication_structs.h:151
iterator push_back(const Element &elem)
Definition pcl_communication_structs.h:158
TType Type
Definition pcl_communication_structs.h:150
specializations are responsible to pack and unpack interface data during communication.
Definition pcl_communication_structs.h:790
Layout::Interface Interface
Definition pcl_communication_structs.h:793
virtual ~ICommunicationPolicy()
Definition pcl_communication_structs.h:795
virtual int get_required_buffer_size(const Interface &interface)
returns the size of the buffer in bytes, that will be required for interface-communication.
Definition pcl_communication_structs.h:813
TLayout Layout
Definition pcl_communication_structs.h:792
virtual bool end_layout_collection(const Layout *pLayout)
signals the end of a layout collection
Definition pcl_communication_structs.h:827
virtual bool extract(ug::BinaryBuffer &buff, const Interface &interface)=0
extract data from the buffer and assigns it to the interface-elements.
virtual bool begin_layout_collection(const Layout *pLayout)
signals the beginning of a layout collection.
Definition pcl_communication_structs.h:821
virtual bool collect(ug::BinaryBuffer &buff, const Interface &interface)=0
should write data which is associated with the interface elements to the buffer.
virtual void begin_level_extraction(int level)
signals that a new layout-level will now be processed.
Definition pcl_communication_structs.h:855
virtual bool end_layout_extraction(const Layout *pLayout)
signals the end of a layout extraction
Definition pcl_communication_structs.h:845
virtual bool begin_layout_extraction(const Layout *pLayout)
signals the beginning of a layout extraction.
Definition pcl_communication_structs.h:839
the standard multi-level-layout implementation
Definition pcl_communication_structs.h:615
bool interface_exists(int procID) const
Definition pcl_communication_structs.h:717
Interface & interface(int procID, size_t level)
returns the interface to the given process.
Definition pcl_communication_structs.h:708
MultiLevelLayout()
Definition pcl_communication_structs.h:641
bool has_interface_elements() const
returns true if the layout contains any interface entries
Definition pcl_communication_structs.h:737
int proc_id(const_iterator iter) const
returns the interface to the given iterator.
Definition pcl_communication_structs.h:687
iterator end(size_t level)
returns the iterator to the last interface of the layout in the given level.
Definition pcl_communication_structs.h:666
size_t num_levels() const
returns the number of levels.
Definition pcl_communication_structs.h:694
LevelLayout & layout_on_level(int level)
returns the layout at the given level.
Definition pcl_communication_structs.h:722
const Interface & interface(int procID, size_t level) const
Definition pcl_communication_structs.h:709
MultiLevelLayout & operator=(const MultiLevelLayout &mll)
Definition pcl_communication_structs.h:646
bool empty(size_t level)
returns true if the layout has no interfaces on the given level.
Definition pcl_communication_structs.h:673
size_t num_interface_elements() const
returns the sum of the interface sizes
Definition pcl_communication_structs.h:726
void new_levels(size_t num)
adds num new levels.
Definition pcl_communication_structs.h:764
const Interface & interface(const_iterator iter) const
Definition pcl_communication_structs.h:684
layout_tags::multi_level_layout_tag category_tag
Layout category.
Definition pcl_communication_structs.h:625
Interface::Type Type
Type.
Definition pcl_communication_structs.h:631
void clear()
deletes all levels.
Definition pcl_communication_structs.h:699
iterator begin(size_t level)
returns the iterator to the first interface of the layout in the given level.
Definition pcl_communication_structs.h:659
Interface::Element Element
Element type.
Definition pcl_communication_structs.h:634
TInterface Interface
Interface type.
Definition pcl_communication_structs.h:628
void assign_layout(const MultiLevelLayout &mll)
clears this layout and then copies all levels from the given layout
Definition pcl_communication_structs.h:771
iterator erase(iterator iter, size_t level)
erases the interface at the given iterator on the given level.
Definition pcl_communication_structs.h:691
bool empty(size_t level) const
Definition pcl_communication_structs.h:674
bool interface_exists(int procID, size_t level)
returns true if an interface to the given procID on the given level already exists.
Definition pcl_communication_structs.h:712
SingleLevelLayout< TInterface > LevelLayout
on each level a single-level-layout is used
Definition pcl_communication_structs.h:620
MultiLevelLayout(const MultiLevelLayout &mll)
Definition pcl_communication_structs.h:642
const_iterator begin(size_t level) const
Definition pcl_communication_structs.h:660
Interface & interface(iterator iter)
returns the interface to the given iterator.
Definition pcl_communication_structs.h:683
size_t num_interfaces(size_t level) const
returns the number of interfaces in the layout
Definition pcl_communication_structs.h:749
std::vector< LevelLayout * > m_vLayouts
Definition pcl_communication_structs.h:779
void sort_interface_entries(TCompare cmp)
sort the entries in all interfaces of this layout
Definition pcl_communication_structs.h:756
const_iterator end(size_t level) const
Definition pcl_communication_structs.h:667
LevelLayout::const_iterator const_iterator
Definition pcl_communication_structs.h:638
LevelLayout::iterator iterator
An iterator that allows to iterate over the interfaces stored in the layout.
Definition pcl_communication_structs.h:637
void require_level(size_t level)
if the required level doesn't exist yet, it will created.
Definition pcl_communication_structs.h:767
~MultiLevelLayout()
Definition pcl_communication_structs.h:644
bool interface_exists(int procID)
returns true if an interface to the given procID already exists.
Definition pcl_communication_structs.h:716
bool interface_exists(int procID, size_t level) const
Definition pcl_communication_structs.h:713
const LevelLayout & layout_on_level(int level) const
Definition pcl_communication_structs.h:723
void require_level(size_t level) const
Definition pcl_communication_structs.h:768
bool empty() const
returns true if the layout has no interfaces.
Definition pcl_communication_structs.h:680
You may add elements to this interface and iterate over them.
Definition pcl_communication_structs.h:207
static bool cmp(iterator iter1, iterator iter2, const std::input_iterator_tag &)
returns true if iter1 < iter2.
Definition pcl_communication_structs.h:312
iterator push_back(const Element &elem)
Definition pcl_communication_structs.h:245
type_traits< TType >::Elem Element
Definition pcl_communication_structs.h:232
TContainer< InterfaceEntry, TAlloc< InterfaceEntry > > ElemContainer
Definition pcl_communication_structs.h:228
int m_targetProc
Definition pcl_communication_structs.h:380
void swap(OrderedInterface &interface)
swaps the content of two interfaces.
Definition pcl_communication_structs.h:320
ElemContainer::const_iterator const_iterator
Definition pcl_communication_structs.h:237
ElemContainer::iterator iterator
Definition pcl_communication_structs.h:236
void sort(TCompare cmp)
sort the entries in this interface.
Definition pcl_communication_structs.h:331
iterator end()
Definition pcl_communication_structs.h:293
interface_tags::ordered_interface_tag category_tag
Definition pcl_communication_structs.h:234
type_traits< TType >::Elem TElem
Definition pcl_communication_structs.h:209
size_t get_local_id(iterator iter)
Definition pcl_communication_structs.h:299
iterator begin()
Definition pcl_communication_structs.h:292
size_t m_size
Definition pcl_communication_structs.h:379
OrderedInterface(int targetProc=-1)
Definition pcl_communication_structs.h:240
Element & get_element(iterator iter)
Definition pcl_communication_structs.h:298
iterator find_insert_pos_sorted(const Element e, TCompare cmp)
find insertion position for an element to be inserted
Definition pcl_communication_structs.h:351
const_iterator begin() const
Definition pcl_communication_structs.h:295
const Element & get_element(const_iterator iter) const
Definition pcl_communication_structs.h:301
bool empty() const
Definition pcl_communication_structs.h:307
const_iterator end() const
Definition pcl_communication_structs.h:296
iterator erase(iterator iter)
Definition pcl_communication_structs.h:286
TType Type
Definition pcl_communication_structs.h:231
ElemContainer m_elements
Definition pcl_communication_structs.h:378
int get_target_proc() const
Definition pcl_communication_structs.h:309
size_t size() const
returns the number of elements that are stored in the interface.
Definition pcl_communication_structs.h:306
size_t get_free_id()
returns a free id in each call.
Definition pcl_communication_structs.h:364
size_t get_local_id(const_iterator iter) const
Definition pcl_communication_structs.h:302
size_t m_idCounter
Definition pcl_communication_structs.h:381
iterator insert(const Element &elem, iterator insertBefore)
Insert an element before the passed iterator.
Definition pcl_communication_structs.h:265
the standard single-level-layout implementation
Definition pcl_communication_structs.h:452
iterator end(size_t level=0)
returns the iterator to the last interface of the layout.
Definition pcl_communication_structs.h:492
Interface & interface(iterator iter)
returns the interface to the given iterator.
Definition pcl_communication_structs.h:505
iterator begin(size_t level=0)
returns the iterator to the first interface of the layout.
Definition pcl_communication_structs.h:486
size_t num_interfaces(size_t level=0) const
returns the number of interfaces in the layout
Definition pcl_communication_structs.h:567
const_iterator begin(size_t level=0) const
Definition pcl_communication_structs.h:487
bool has_interface_elements() const
returns true if the layout contains interface elements
Definition pcl_communication_structs.h:557
int proc_id(iterator iter) const
returns the target process of the interface given in iterator
Definition pcl_communication_structs.h:509
bool interface_exists(int procID, size_t level=0) const
returns true if an interface to the given procID already exists.
Definition pcl_communication_structs.h:544
bool empty(size_t level=0) const
returns true if the layout has no interfaces.
Definition pcl_communication_structs.h:499
InterfaceMap::const_iterator const_iterator
Definition pcl_communication_structs.h:477
iterator erase(iterator iter, size_t level=0)
erases the interface at the given iterator.
Definition pcl_communication_structs.h:514
std::map< int, TInterface > InterfaceMap
an interface-map is a list of interfaces, each associated with a process id.
Definition pcl_communication_structs.h:459
Interface::Element Element
Element type.
Definition pcl_communication_structs.h:473
const Interface & interface(int procID, size_t level=0) const
Definition pcl_communication_structs.h:536
Interface::Type Type
Type.
Definition pcl_communication_structs.h:470
layout_tags::single_level_layout_tag category_tag
Layout category.
Definition pcl_communication_structs.h:464
InterfaceMap m_interfaceMap
holds the interfaces in a map.
Definition pcl_communication_structs.h:590
void clear()
clears the layout
Definition pcl_communication_structs.h:522
size_t num_levels() const
returns 1
Definition pcl_communication_structs.h:502
TInterface Interface
Interface type.
Definition pcl_communication_structs.h:467
void sort_interface_entries(TCompare cmp)
sort the entries in all interfaces of this layout
Definition pcl_communication_structs.h:574
Interface & interface(int procID, size_t level=0)
returns the interface to the given process.
Definition pcl_communication_structs.h:528
InterfaceMap::iterator iterator
An iterator that allows to iterate over the interfaces stored in the layout.
Definition pcl_communication_structs.h:476
const_iterator end(size_t level=0) const
Definition pcl_communication_structs.h:493
const Interface & interface(const_iterator iter) const
Definition pcl_communication_structs.h:506
int proc_id(const_iterator iter) const
Definition pcl_communication_structs.h:510
size_t num_interface_elements() const
returns the sum of the interface sizes
Definition pcl_communication_structs.h:548
SingleLevelLayout()
Definition pcl_communication_structs.h:454
A Buffer for binary data.
Definition binary_buffer.h:56
#define UG_ASSERT(expr, msg)
Definition assert.h:70
#define UG_THROW(msg)
Definition error.h:57
Definition parallel_grid_layout.h:46
Definition pcl_communication_structs.h:220
bool operator()(InterfaceEntry const &e1, InterfaceEntry const &e2)
Definition pcl_communication_structs.h:222
TElemCmp m_elemCmp
Definition pcl_communication_structs.h:224
InterfaceEntryCmp(TElemCmp elemCmp)
Definition pcl_communication_structs.h:221
Definition pcl_communication_structs.h:212
InterfaceEntry(TElem e, size_t locID)
Definition pcl_communication_structs.h:213
TElem elem
Definition pcl_communication_structs.h:215
size_t localID
Definition pcl_communication_structs.h:216
associate internally used types with an external typename
Definition pcl_communication_structs.h:64
TType Elem
Definition pcl_communication_structs.h:65