OpenMM
|
A Kernel encapsulates a particular implementation of a calculation that can be performed on the data in a Context. More...
#include <Kernel.h>
Public Member Functions | |
Kernel () | |
Kernel (const Kernel ©) | |
Kernel (KernelImpl *impl) | |
Create a Kernel that wraps a KernelImpl. | |
~Kernel () | |
Kernel & | operator= (const Kernel ©) |
std::string | getName () const |
Get the name of this Kernel. | |
const KernelImpl & | getImpl () const |
Get the object which implements this Kernel. | |
KernelImpl & | getImpl () |
Get the object which implements this Kernel. | |
template<class T > | |
const T & | getAs () const |
Get a reference to the object which implements this Kernel, casting it to the specified type. | |
template<class T > | |
T & | getAs () |
Get a reference to the object which implements this Kernel, casting it to the specified type. | |
A Kernel encapsulates a particular implementation of a calculation that can be performed on the data in a Context.
Kernel objects are created by Platforms:
Kernel kernel = platform.createKernel(kernelName);
The Kernel class itself does not specify any details of what calculation is to be performed or the API for calling it. Instead, subclasses of KernelImpl will define APIs which are appropriate to particular calculations. To execute a Kernel, you therefore request its implementation object and cast it to the correct type:
dynamic_cast<AddStreamsImpl&>(kernel.getImpl()).execute(stream1, stream2);
Kernel | ( | ) |
Kernel | ( | KernelImpl * | impl | ) |
Create a Kernel that wraps a KernelImpl.
name | the name of the kernel to create |
~Kernel | ( | ) |
|
inline |
Get a reference to the object which implements this Kernel, casting it to the specified type.
|
inline |
Get a reference to the object which implements this Kernel, casting it to the specified type.
const KernelImpl & getImpl | ( | ) | const |
Get the object which implements this Kernel.
KernelImpl & getImpl | ( | ) |
Get the object which implements this Kernel.
string getName | ( | ) | const |
Get the name of this Kernel.
References KernelImpl::getName().