33#ifndef __H__PCL__pcl_layout_util__
34#define __H__PCL__pcl_layout_util__
47template <
class TLayout>
50 typedef typename TLayout::iterator TInterfaceIter;
51 typedef typename TLayout::Interface TInterface;
53 for(
size_t lvl = 0; lvl < layout.num_levels(); ++lvl){
54 for(TInterfaceIter iter = layout.begin(lvl); iter != layout.end(lvl);)
56 TInterface& intfc = layout.interface(iter);
58 iter = layout.erase(iter, lvl);
75template <
class TLayout>
82 for(
size_t i = 0; i < layout.num_levels(); ++i){
84 for(
typename TLayout::iterator iIter = layout.begin(i);
85 iIter != layout.end(i); ++iIter)
87 int procID = layout.proc_id(iIter);
90 if(
find(procIDsOut.begin(), procIDsOut.end(), procID)
94 procIDsOut.push_back(procID);
99 procIDsOut.push_back(procID);
104 return procIDsOut.size();
113template <
class TLayout>
116 bool clearContainer =
true)
118 typedef typename TLayout::Interface Interface;
121 if(clearContainer) elemsOut.clear();
124 for(
size_t lvl = 0; lvl < layout.num_levels(); ++lvl){
125 for(
typename TLayout::const_iterator interfaceIter = layout.begin(lvl);
126 interfaceIter != layout.end(lvl); ++interfaceIter)
129 const Interface&
interface = layout.interface(interfaceIter);
130 for(
typename Interface::const_iterator iter = interface.begin();
131 iter != interface.end(); ++iter)
134 elemsOut.push_back(interface.get_element(iter));
141template <
class TLayout>
143 const TLayout& layout)
145 typedef typename TLayout::Interface Interface;
146 typedef typename TLayout::Element TElem;
153 hash.
reserve(layout.num_interface_elements());
156 for(
size_t lvl = 0; lvl < layout.num_levels(); ++lvl){
157 for(
typename TLayout::const_iterator interfaceIter = layout.begin(lvl);
158 interfaceIter != layout.end(lvl); ++interfaceIter)
161 const Interface&
interface = layout.interface(interfaceIter);
162 for(
typename Interface::const_iterator iter = interface.begin();
163 iter != interface.end(); ++iter)
166 if(!hash.
has_entry(interface.get_element(iter))){
168 hash.
insert(interface.get_element(iter), 0);
169 elemsOut.push_back(interface.get_element(iter));
void insert(const key_t &key, const value_t &val)
Definition hash_impl.hpp:199
bool has_entry(const key_t &key) const
Definition hash_impl.hpp:150
void reserve(size_t size)
Reserves memory for key-value-pair storage.
Definition hash_impl.hpp:113
void CollectElements(std::vector< typename TLayout::Element > &elemsOut, TLayout &layout, bool clearContainer=true)
writes all elements in the interfaces into the vector.
Definition pcl_layout_util.h:114
size_t CollectAssociatedProcesses(std::vector< int > &procIDsOut, TLayout &layout)
collects the ids of all processes to which interfaces exist.
Definition pcl_layout_util.h:76
void CollectUniqueElements(std::vector< typename TLayout::Element > &elemsOut, const TLayout &layout)
writes all elements in the interfaces into the resulting vector. avoids doubles.
Definition pcl_layout_util.h:142
Definition parallel_grid_layout.h:46
IndexLayout::Interface::iterator find(IndexLayout::Interface &interface, size_t i)
Definition parallel_index_layout.h:77
static void RemoveEmptyInterfaces(typename GridLayoutMap::Types< TGeomObj >::Map &map)
A helper method for GridLayoutMap::remove_empty_interfaces()
Definition parallel_grid_layout.cpp:64