Skip to content
Snippets Groups Projects
Commit ce5bdf7e authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Improved Communicator class

Now all the MPI wrappers come in two flavors. They can be used
with a pointer as usual, e.g.

double*data;
comm.Sum(&data[0],n);

or they can be used with a reference to a single number

double x;
comm.Sum(x);
// same as comm.Sum(&x,1);

Notably, the second version also works with std::vector and std::string
and automatically detect the size, e.g.

std::vector<double> v;
comm.Sum(v);
// same as comm.Sum(&v[0],v.size());

Furthermore, everything works transparently with Vector and Tensor
either as single objects or elements
of vectors or of C arrays:

std::vector<Vector> v;
comm.Sum(v);
// same as comm.Sum(&v[0],v.size());
// same as comm.Sum(&v[0][0],3*v.size());

All the regtests are satisfied
parent 3dd6d466
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment