From a52471acfba970cf690e9197bcfd7c86006e4be9 Mon Sep 17 00:00:00 2001 From: Gareth Tribello <gareth.tribello@gmail.com> Date: Tue, 1 Oct 2013 22:51:49 +0100 Subject: [PATCH] Added functionality to communicator for mpi operations on PLMD::Matrix --- src/tools/Communicator.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/Communicator.h b/src/tools/Communicator.h index 4b4171243..47baf2481 100644 --- a/src/tools/Communicator.h +++ b/src/tools/Communicator.h @@ -30,6 +30,7 @@ #include <string> #include "Vector.h" #include "Tensor.h" +#include "Matrix.h" namespace PLMD{ @@ -82,6 +83,11 @@ class Communicator{ if(v.size()>0){ Data d(&v[0],v.size()); pointer=d.pointer; size=d.size; type=d.type; } else { pointer=NULL; size=0; } } +/// Init from reference to PLMD::Matrix + template <typename T> Data(Matrix<T>&m ){ + if(m.nrows()*m.ncols()>0){ Data d(&m(0,0),m.nrows()*m.ncols()); pointer=d.pointer; size=d.size; type=d.type; } + else{ pointer=NULL; size=0; } + } /// Init from reference to std::string Data(std::string&s){ if(s.size()>0){ Data d(&s[0],s.size()); pointer=d.pointer; size=d.size; type=d.type; } -- GitLab