OpenMM
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends
Kernel Class Reference

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 &copy)
 
 Kernel (KernelImpl *impl)
 Create a Kernel that wraps a KernelImpl.
 
 ~Kernel ()
 
Kerneloperator= (const Kernel &copy)
 
std::string getName () const
 Get the name of this Kernel.
 
const KernelImplgetImpl () const
 Get the object which implements this Kernel.
 
KernelImplgetImpl ()
 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.
 

Detailed Description

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);

Constructor & Destructor Documentation

Kernel ( )
Kernel ( const Kernel copy)
Kernel ( KernelImpl impl)

Create a Kernel that wraps a KernelImpl.

Parameters
namethe name of the kernel to create
~Kernel ( )

Member Function Documentation

const T& getAs ( ) const
inline

Get a reference to the object which implements this Kernel, casting it to the specified type.

T& getAs ( )
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().

Kernel & operator= ( const Kernel copy)

The documentation for this class was generated from the following files: