Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.MPI] question about serializingcustomobject
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-30 17:53:48


Cristobal Navarro wrote:
> i found the problem, and found a solution, but would be better if i
> learn some explanations of you guys which know much more.
>
>
> problem was that i was sending the pointer of my object
> {
> Lattice* lat = new Lattice("filename");
> world.send(1, 1, lat);
> }
> that generated the errors on the packing algorithms i suppose
> (correct me if im wrong)
>
>
> so instead of changing all my program i only sent the object pointed
>
>
> world.send(1, 1, *lat );
>
>
> and on the receiver process i receive it with
>
>
> Lattice lat;
> world.recv(0, 1, lat);
>
>
> then i can transform it to pointer again to keep my algorithms
> unchanged,
>
>
> Lattice plat = ⪫
>
>
>
>
>
>
> i wonder, is this a good approach to solve the error i was having??
> at least does work and i can continue programming, which makes me
> happy :)
>
If it were me I would declare

world.send(?, ?, const Lattice & lat);
world.recv(0, 1, Lattice & lat);

then:
Lattice lat("filename");
world.send(1, 1, lat);
and
Lattice lat;
world.recv(0, 1, lat);

transparent, easy and guarenteed correct.

Robert Ramey



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net