2 * \brief Definitions for some useful types and templates for GROMACS restraints.
4 * \todo This should be part of a template library installed with GROMACS.
6 * \author M. Eric Irrgang <ericirrgang@gmail.com>
9 #include "sessionresources.h"
15 #include "gmxapi/exceptions.h"
16 #include "gmxapi/md/mdsignals.h"
21 // Explicit instantiation.
23 class ::plugin::Matrix
<double>;
25 void ResourcesHandle::reduce(const Matrix
<double>& send
,
26 Matrix
<double>* receive
) const
36 throw gmxapi::ProtocolError("'reduce' functor was not initialized before use.");
40 void ResourcesHandle::stop()
43 auto signaller
= gmxapi::getMdrunnerSignal(session_
,
44 gmxapi::md::signals::STOP
);
46 // Should probably check that the function object has been initialized...
50 ResourcesHandle
Resources::getHandle() const
52 auto handle
= ResourcesHandle();
56 throw gmxapi::ProtocolError("reduce operation functor is not set, which should not happen...");
58 handle
.reduce_
= &reduce_
;
62 throw gmxapi::ProtocolError("Resources::getHandle() must not be called before setSession() has been called.");
64 handle
.session_
= session_
;
69 void Resources::setSession(gmxapi::SessionResources
* session
)
73 throw gmxapi::ProtocolError("Resources::setSession received a null SessionResources pointer.");
78 } // end namespace myplugin