Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pcl_communication_structs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009-2015: G-CSC, Goethe University Frankfurt
3 * Author: Sebastian Reiter
4 *
5 * This file is part of UG4.
6 *
7 * UG4 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License version 3 (as published by the
9 * Free Software Foundation) with the following additional attribution
10 * requirements (according to LGPL/GPL v3 §7):
11 *
12 * (1) The following notice must be displayed in the Appropriate Legal Notices
13 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 *
15 * (2) The following notice must be displayed at a prominent place in the
16 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 *
18 * (3) The following bibliography is recommended for citation and must be
19 * preserved in all covered files:
20 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 * parallel geometric multigrid solver on hierarchically distributed grids.
22 * Computing and visualization in science 16, 4 (2013), 151-164"
23 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 * flexible software system for simulating pde based models on high performance
25 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 */
32
33#ifndef __H__PCL__PCL_COMMUNICATION_STRUCTS__
34#define __H__PCL__PCL_COMMUNICATION_STRUCTS__
35
36#include <iterator>
37#include <vector>
38#include <list>
39#include <map>
40#include <algorithm>
43#include "common/error.h"
44
45namespace pcl
46{
47
50
52// type-traits
54
62template <class TType>
64{
65 typedef TType Elem;
66};
67
68
70// Interface Categories
72namespace interface_tags
73{
102
115}// end of namespace interface_tags
116
117
119// BasicInterface
121
138template <class TType,
139 template <class T, class Alloc> class TContainer = std::vector,
140 template <class T> class TAlloc = std::allocator>
142{
143 protected:
145 typedef TContainer<TElem, TAlloc<TElem> > ElemContainer;
146
147 public:
149
150 typedef TType Type;
152 typedef typename ElemContainer::iterator iterator;
153 typedef typename ElemContainer::const_iterator const_iterator;
154
155 public:
156 BasicInterface(int targetProc = -1) : m_size(0), m_targetProc(targetProc) {};
157
158 inline iterator push_back(const Element& elem) {++m_size; return m_elements.insert(m_elements.end(), elem);}
159 inline iterator erase(iterator iter) {--m_size; return m_elements.erase(iter);}
160
161 inline iterator begin() {return m_elements.begin();}
162 inline iterator end() {return m_elements.end();}
163 inline const_iterator begin() const {return m_elements.begin();}
164 inline const_iterator end() const {return m_elements.end();}
165
166 inline Element& get_element(iterator iter) {return *iter;}
167 inline const Element& get_element(const_iterator iter) const {return *iter;}
168
170 inline size_t size() const {return m_size;}
171 inline bool empty() const {return size() == 0;}
172
173 int get_target_proc() const {return m_targetProc;}
174
176
177 void swap(BasicInterface& interface)
178 {
179 using std::swap;
180 m_elements.swap(interface.m_elements);
181 swap(m_size, interface.m_size);
182 swap(m_targetProc, interface.m_targetProc);
183 }
184
186 template <class TCompare>
187 void sort(TCompare cmp)
188 {
189 using std::sort;
190 m_elements.sort(cmp);
191 }
192
193 protected:
195 size_t m_size;
197};
198
200// OrderedInterface
202
203template <class TType,
204 template <class T, class Alloc> class TContainer = std::vector,
205 template <class T> class TAlloc = std::allocator>
207{
208 protected:
210
212 {
213 InterfaceEntry(TElem e, size_t locID) : elem(e), localID(locID) {}
214
216 size_t localID;
217 };
218
219 template <class TElemCmp>
221 InterfaceEntryCmp(TElemCmp elemCmp) : m_elemCmp(elemCmp) {}
222 bool operator()(InterfaceEntry const& e1, InterfaceEntry const& e2)
223 {return m_elemCmp(e1.elem, e2.elem);}
224 TElemCmp m_elemCmp;
225 };
226
227 typedef TContainer<InterfaceEntry, TAlloc<InterfaceEntry> >
229
230 public:
231 typedef TType Type;
233
235
236 typedef typename ElemContainer::iterator iterator;
237 typedef typename ElemContainer::const_iterator const_iterator;
238
239 public:
240 OrderedInterface(int targetProc = -1) :
241 m_size(0),
242 m_targetProc(targetProc),
243 m_idCounter(1) {}
244
245 inline iterator push_back(const Element& elem)
246 {
247 ++m_size;
248 return m_elements.insert(m_elements.end(),
249 (InterfaceEntry(elem, get_free_id())));
250 }
251
265 inline iterator insert(const Element& elem, iterator insertBefore)
266 {
267 ++m_size;
268
269 size_t startNumber = 0;
270 if (insertBefore != end())
271 startNumber = insertBefore->localID;
272
273 iterator it = m_elements.insert(insertBefore, (InterfaceEntry(elem, get_free_id())));
274
275 if (startNumber)
276 {
277 // we have to reset all local indices
278 --startNumber;
279 for (iterator iter = it; iter != m_elements.end(); ++iter)
280 (*iter).localID = ++startNumber;
281 }
282
283 return it;
284 }
285
287 {
288 --m_size;
289 return m_elements.erase(iter);
290 }
291
292 inline iterator begin() {return m_elements.begin();}
293 inline iterator end() {return m_elements.end();}
294
295 inline const_iterator begin() const {return m_elements.begin();}
296 inline const_iterator end() const {return m_elements.end();}
297
298 inline Element& get_element(iterator iter) {return (*iter).elem;}
299 inline size_t get_local_id(iterator iter) {return (*iter).localID;}
300
301 inline const Element& get_element(const_iterator iter) const {return (*iter).elem;}
302 inline size_t get_local_id(const_iterator iter) const {return (*iter).localID;}
303
304
306 inline size_t size() const {return m_size;}
307 inline bool empty() const {return size() == 0;}
308
309 int get_target_proc() const {return m_targetProc;}
310
312 static inline bool cmp(iterator iter1, iterator iter2,
313 const std::input_iterator_tag&)
314 {
315 return (*iter1).localID < (*iter2).localID;
316 }
317
319
320 void swap(OrderedInterface& interface)
321 {
322 using std::swap;
323 m_elements.swap(interface.m_elements);
324 swap(m_size, interface.m_size);
325 swap(m_targetProc, interface.m_targetProc);
326 swap(m_idCounter, interface.m_idCounter);
327 }
328
330 template <class TCompare>
331 void sort(TCompare cmp)
332 {
333 using std::sort;
335 m_elements.sort(ieCmp);
336
337 // we have to reset all local indices
338 m_idCounter = 1;
339 for(iterator iter = m_elements.begin(); iter != m_elements.end(); ++iter)
340 (*iter).localID = m_idCounter++;
341 }
342
350 template <class TCompare>
352 {
354 iterator it_begin = m_elements.begin();
355 iterator it_end = m_elements.end();
356 InterfaceEntry iEntry(e, 0);
357 return std::lower_bound(it_begin, it_end, iEntry, ieCmp);
358 }
359
360
361 protected:
363
364 size_t get_free_id()
365 {
366 if(m_idCounter == 0)
367 {
368 m_idCounter = 1;
369 // we have to reset all entries
370 for(iterator iter = begin(); iter != end(); ++iter)
371 (*iter).localID = m_idCounter++;
372 }
373
374 return m_idCounter++;
375 }
376
377 protected:
379 size_t m_size;
382};
383
384
386// Layout Categories
388namespace layout_tags
389{
391
408
410
427
428}// end of namespace layout_tags
429
430
432// SingleLevelLayout
434
450template <class TInterface>
452{
453 public:
455
457 // typedefs required by implementation
459 typedef std::map<int, TInterface> InterfaceMap;
460
462 // typedefs required by layout-tag
465
467 typedef TInterface Interface;
468
470 typedef typename Interface::Type Type;
471
473 typedef typename Interface::Element Element;
474
476 typedef typename InterfaceMap::iterator iterator;
477 typedef typename InterfaceMap::const_iterator const_iterator;
478
479 public:
481 // methods required by the layout-tag
482
484
486 inline iterator begin(size_t level = 0) {return m_interfaceMap.begin();}
487 inline const_iterator begin(size_t level = 0) const {return m_interfaceMap.begin();}
488
490
492 inline iterator end(size_t level = 0) {return m_interfaceMap.end();}
493 inline const_iterator end(size_t level = 0) const {return m_interfaceMap.end();}
494
496
499 inline bool empty(size_t level = 0) const {return begin() == end();}
500
502 inline size_t num_levels() const {return 1;}
503
505 inline Interface& interface(iterator iter) {return iter->second;}
506 inline const Interface& interface(const_iterator iter) const {return iter->second;}
507
509 inline int proc_id(iterator iter) const {return iter->first;}
510 inline int proc_id(const_iterator iter) const {return iter->first;}
511
513
514 inline iterator erase(iterator iter, size_t level = 0)
515 {
516 iterator tIter = iter++;
517 m_interfaceMap.erase(tIter);
518 return iter;
519 }
520
522 void clear() {m_interfaceMap.clear();}
523
525
528 inline Interface& interface(int procID, size_t level = 0)
529 {
530 iterator iter = m_interfaceMap.find(procID);
531 if(iter != m_interfaceMap.end())
532 return iter->second;
533 return m_interfaceMap.insert(make_pair(procID, Interface(procID))).first->second;
534 }
535
536 inline const Interface& interface(int procID, size_t level = 0) const
537 {
538 const_iterator iter = m_interfaceMap.find(procID);
539 UG_ASSERT(iter != m_interfaceMap.end(), "trying to access an non-existing interface in a constant layout");
540 return iter->second;
541 }
542
544 inline bool interface_exists(int procID, size_t level = 0) const
545 {return m_interfaceMap.find(procID) != m_interfaceMap.end();}
546
548 inline size_t num_interface_elements() const
549 {
550 size_t sum = 0;
551 for(const_iterator iter = begin(); iter != end(); ++iter)
552 sum += interface(iter).size();
553 return sum;
554 }
555
557 inline bool has_interface_elements() const
558 {
559 for(iterator iter = begin(); iter != end(); ++iter){
560 if(!interface(iter).empty())
561 return true;
562 }
563 return false;
564 }
565
567 inline size_t num_interfaces(size_t level = 0) const
568 {
569 return m_interfaceMap.size();
570 }
571
573 template <class TCompare>
574 void sort_interface_entries(TCompare cmp)
575 {
576 for(iterator iter = begin(); iter != end(); ++iter)
577 interface(iter).sort(cmp);
578 }
579
580 private:
581/*
583 SingleLevelLayout(const SingleLevelLayout& sll);
584
586 SingleLevelLayout& operator = (const SingleLevelLayout& sll);
587*/
588 protected:
591};
592
594// MultiLevelLayout
596
613template <class TInterface>
615{
616 public:
618 // typedefs required by implementation
621
623 // typedefs required by layout-tag
626
628 typedef TInterface Interface;
629
631 typedef typename Interface::Type Type;
632
634 typedef typename Interface::Element Element;
635
637 typedef typename LevelLayout::iterator iterator;
638 typedef typename LevelLayout::const_iterator const_iterator;
639
640 public:
643
645
647 {
648 assign_layout(mll);
649 return *this;
650 }
651
653 // methods required by the layout-tag
654
656
659 inline iterator begin(size_t level) {require_level(level); return m_vLayouts[level]->begin();}
660 inline const_iterator begin(size_t level) const {require_level(level); return m_vLayouts[level]->begin();}
661
663
666 inline iterator end(size_t level) {require_level(level); return m_vLayouts[level]->end();}
667 inline const_iterator end(size_t level) const {require_level(level); return m_vLayouts[level]->end();}
668
670
673 inline bool empty(size_t level) {return begin(level) == end(level);}
674 inline bool empty(size_t level) const {return begin(level) == end(level);}
675
677
680 inline bool empty() const {for(size_t l = 0; l < num_levels(); ++l){if(!empty(l)) return false;} return true;}
681
683 inline Interface& interface(iterator iter) {return iter->second;}
684 inline const Interface& interface(const_iterator iter) const {return iter->second;}
685
687 inline int proc_id(const_iterator iter) const {return iter->first;}
688
690
691 inline iterator erase(iterator iter, size_t level) {return m_vLayouts[level]->erase(iter);}
692
694 inline size_t num_levels() const {return m_vLayouts.size();}
695
697 // methods that enhance the layout-tag
699 void clear()
700 {
701 for(size_t i = 0; i < m_vLayouts.size(); ++i)
702 delete m_vLayouts[i];
703 m_vLayouts.clear();
704 }
705
707
708 inline Interface& interface(int procID, size_t level) {require_level(level); return m_vLayouts[level]->interface(procID);}
709 inline const Interface& interface(int procID, size_t level) const {require_level(level); return m_vLayouts[level]->interface(procID);}
710
712 inline bool interface_exists(int procID, size_t level) {require_level(level); return m_vLayouts[level]->interface_exists(procID);}
713 inline bool interface_exists(int procID, size_t level) const {require_level(level); return m_vLayouts[level]->interface_exists(procID);}
714
716 inline bool interface_exists(int procID) {for(size_t i = 0; i < num_levels(); ++i){if(m_vLayouts[i]->interface_exists(procID)) return true;} return false;}
717 inline bool interface_exists(int procID) const {for(size_t i = 0; i < num_levels(); ++i){if(m_vLayouts[i]->interface_exists(procID)) return true;} return false;}
718
720
722 inline LevelLayout& layout_on_level(int level) {require_level(level); return *m_vLayouts[level];}
723 inline const LevelLayout& layout_on_level(int level) const {require_level(level); return *m_vLayouts[level];}
724
726 inline size_t num_interface_elements() const
727 {
728 size_t sum = 0;
729 for(size_t lvl = 0; lvl < num_levels(); ++lvl){
730 for(iterator iter = begin(lvl); iter != end(lvl); ++iter)
731 sum += interface(iter).size();
732 }
733 return sum;
734 }
735
737 inline bool has_interface_elements() const
738 {
739 for(size_t lvl = 0; lvl < num_levels(); ++lvl){
740 for(iterator iter = begin(lvl); iter != end(lvl); ++iter){
741 if(!interface(iter).empty())
742 return true;
743 }
744 }
745 return false;
746 }
747
749 inline size_t num_interfaces(size_t level) const
750 {
751 return m_vLayouts[level].size();
752 }
753
755 template <class TCompare>
756 void sort_interface_entries(TCompare cmp)
757 {
758 for(size_t lvl = 0; lvl < num_levels(); ++lvl)
759 layout_on_level(lvl).sort_interface_entries(cmp);
760 }
761
762 protected:
764 inline void new_levels(size_t num) {for(size_t i = 0; i < num; ++i) m_vLayouts.push_back(new LevelLayout());}
765
767 inline void require_level(size_t level) {if(level >= num_levels()) new_levels(level - num_levels() + 1);}
768 inline void require_level(size_t level) const {if(level >= num_levels()){UG_THROW("Level too high: " << level << ", while num_levels == " << num_levels());}}
769
772 {
773 clear();
774 for(size_t i = 0; i < mll.m_vLayouts.size(); ++i)
775 m_vLayouts.push_back(new LevelLayout(*mll.m_vLayouts[i]));
776 }
777
778 protected:
779 std::vector<LevelLayout*> m_vLayouts;
780};
781
783// ICommunicationPolicy
785
788template <class TLayout>
790{
791 public:
792 typedef TLayout Layout;
793 typedef typename Layout::Interface Interface;
794
796
798 // COLLECT AND EXTRACT
800
812 virtual int
813 get_required_buffer_size(const Interface& interface) {return -1;}
814
816 // COLLECT
818
820 virtual bool
821 begin_layout_collection(const Layout* pLayout) {return true;}
822
824
826 virtual bool
827 end_layout_collection(const Layout* pLayout) {return true;}
828
830 virtual bool
831 collect(ug::BinaryBuffer& buff, const Interface& interface) = 0;
832
834 // EXTRACT
836
838 virtual bool
839 begin_layout_extraction(const Layout* pLayout) {return true;}
840
842
844 virtual bool
845 end_layout_extraction(const Layout* pLayout) {return true;}
846
848
855 virtual void begin_level_extraction(int level) {}
856
858
861 virtual bool
862 extract(ug::BinaryBuffer& buff, const Interface& interface) = 0;
863};
864
865// end group pcl
867
868}// end of namespace pcl
869
870#endif
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
Definition pcl_communication_structs.h:101
Definition pcl_communication_structs.h:114
marks a layout as a multi-level layout
Definition pcl_communication_structs.h:426
marks a layout as a single-level layout
Definition pcl_communication_structs.h:407
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