33#ifndef __H__LIB_ALGEBRA__SERIALIZE_INTERFACES_H_
34#define __H__LIB_ALGEBRA__SERIALIZE_INTERFACES_H_
38#error "This only works with a UG_PARALLEL define."
49template<
typename TLocalToGlobal>
57 AlgebraID &globalIndex = localToGlobal[localIndex];
62template<
typename TLocalToGlobal>
64 const IndexLayout &layout,
const TLocalToGlobal &localToGlobal)
80template<
typename TGlobalToLocal>
87 for(
size_t i=0; i<size; i++)
91 size_t localIndex = globalToLocal[globalIndex];
96template<
typename TGlobalToLocal>
98 IndexLayout &layout,
const TGlobalToLocal &globalToLocal)
102 for(
size_t i=0; i<size; i++)
104 int pid = Deserialize<int>(stream);
110template<
typename TLayout>
113 typename TLayout::iterator it =
find(layout, pid);
114 if(it == layout.end())
return false;
119template<
typename TLayout>
122 for(
size_t i=0; i<group.size(); i++)
126template<
typename TLayout>
129 typename TLayout::iterator it =
find(layout, pidSource);
130 if(it == layout.end())
return false;
131 typename TLayout::Interface interfaceSource = layout.interface(it);
132 if(interfaceSource.empty())
return false;
133 typename TLayout::Interface interfaceAppendTo = layout.interface(pidAppendTo);
135 for(
typename TLayout::Interface::iterator itSource = interfaceSource.begin(); itSource != interfaceSource.end(); ++itSource)
136 interfaceAppendTo.push_back(interfaceSource.get_element(itSource));
140template<
typename TLayout>
141void MergeInterfaces(TLayout &layout,
const std::vector<int> pidSources,
int pidAppendTo)
143 for(
size_t i=0; i<pidSources.size(); i++)
141void MergeInterfaces(TLayout &layout,
const std::vector<int> pidSources,
int pidAppendTo) {
…}
151template<
typename TLayout>
154 for(std::map<int, int>::const_iterator it =
merge.begin(); it !=
merge.end(); ++it)
You may add elements to this interface and iterate over them.
Definition pcl_communication_structs.h:207
iterator push_back(const Element &elem)
Definition pcl_communication_structs.h:245
iterator end()
Definition pcl_communication_structs.h:293
iterator begin()
Definition pcl_communication_structs.h:292
Element & get_element(iterator iter)
Definition pcl_communication_structs.h:298
size_t size() const
returns the number of elements that are stored in the interface.
Definition pcl_communication_structs.h:306
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
int proc_id(iterator iter) const
returns the target process of the interface given in iterator
Definition pcl_communication_structs.h:509
InterfaceMap::const_iterator const_iterator
Definition pcl_communication_structs.h:477
A Buffer for binary data.
Definition binary_buffer.h:56
function table merge(t1, t2)
void SerializeInterface(BinaryBuffer &stream, const IndexLayout::Interface &interface, const TLocalToGlobal &localToGlobal)
Definition serialize_interfaces.h:50
IndexLayout::Interface::iterator find(IndexLayout::Interface &interface, size_t i)
Definition parallel_index_layout.h:77
void DeserializeInterface(BinaryBuffer &stream, IndexLayout::Interface &interface, const TGlobalToLocal &globalToLocal)
Definition serialize_interfaces.h:81
void Deserialize(TIStream &buf, ParallelVector< T > &v)
Deerialize for ParallelVector<T>
Definition restart_bridge.cpp:112
void RemoveInterfaces(TLayout &layout, std::vector< int > group)
Definition serialize_interfaces.h:120
bool AppendInterface(TLayout &layout, int pidSource, int pidAppendTo)
Definition serialize_interfaces.h:127
void DeserializeLayout(BinaryBuffer &stream, IndexLayout &layout, const TGlobalToLocal &globalToLocal)
Definition serialize_interfaces.h:97
void Serialize(TOStream &buf, const ParallelVector< T > &v)
Serialize for ParallelVector<T>
Definition restart_bridge.cpp:103
bool RemoveInterface(TLayout &layout, int pid)
Definition serialize_interfaces.h:111
void SerializeLayout(BinaryBuffer &stream, const IndexLayout &layout, const TLocalToGlobal &localToGlobal)
Definition serialize_interfaces.h:63
void MergeInterfaces(TLayout &layout, const std::vector< int > pidSources, int pidAppendTo)
Definition serialize_interfaces.h:141
this type is used to identify distributed objects.
Definition algebra_id.h:46