由买买提看人间百态

topics

全部话题 - 话题: gpsvec
(共0页)
y**b
发帖数: 10166
1
来自主题: Programming版 - 有人用Boost.MPI吗?
测试了一下,Boost.MPI还挺厉害,对象、指针、数组、容器等等都能有效传送。
传送一个指针会自动传递指针所指对象的内容(用户定义的数据类型只需添加三行
代码实现serialization),传送一个元素为指针类型的容器会将所有指针指向的
内容进行传送。
下面这段代码传送一个元素类型为指针的容器:
if (world.rank() == 0) { // process 0
std::vector GpsVec;
// fill this GpsVec with pointers
world.send(1, tag, GpsVec); // send to process 1
}
else (world.rank() == 1) { // process 1
std::vector rGpsVec;
world.recv(0, tag, rGpsVec); // receive from process 0
std::vector::iterator it;
for ... 阅读全帖
(共0页)