diff --git a/src/tools/Communicator.h b/src/tools/Communicator.h index 4b4171243617a497d908baf3f58956edbe3dd240..47baf2481835f703ff90d960af937b66c93d32c9 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; }