AQUAgpusph 4.1.2
|
A generic variable. Almost useless, use the overloaded classes instead of this one. More...
#include <Variable.h>
Public Member Functions | |
Variable (const std::string varname, const std::string vartype) | |
Constructor. | |
virtual | ~Variable () |
Destructor. | |
virtual bool | isArray ()=0 |
Let efficiently know whether the variable is an array or not. | |
virtual bool | isScalar () |
Let efficiently know whether the variable is a scalar or not. | |
std::string | name () const |
Name of the variable. | |
virtual std::string | type () const |
Type of the variable. | |
virtual size_t | typesize () const |
Get the variable type size. | |
virtual size_t | size () const |
Get the variable type size. | |
virtual void * | get () |
Get variable pointer basis pointer. | |
virtual void | set (void *ptr)=0 |
Set variable from memory. | |
virtual PyObject * | getPythonObject (int i0=0, int n=0) |
Get a Python interpretation of the variable. | |
virtual bool | setFromPythonObject (PyObject *obj, int i0=0, int n=0) |
Set the variable from a Python object. | |
virtual const std::string | asString () |
Get the variable text representation. | |
void | setEvent (cl_event event) |
Set the variable current event. | |
cl_event | getEvent () |
Returns the last event associated to this variable. | |
Protected Member Functions | |
void | sync () |
Wait for variable underlying event to be complete. | |
A generic variable. Almost useless, use the overloaded classes instead of this one.
Aqua::InputOutput::Variable::Variable | ( | const std::string | varname, |
const std::string | vartype | ||
) |
Constructor.
varname | Name of the variable. |
vartype | Type of the variable. |
|
inlinevirtual |
Destructor.
|
inlinevirtual |
Get the variable text representation.
Reimplemented in Aqua::InputOutput::ScalarNumberVariable< T >, Aqua::InputOutput::ScalarNumberVariable< float >, Aqua::InputOutput::ScalarNumberVariable< int >, Aqua::InputOutput::ScalarNumberVariable< unsigned int >, Aqua::InputOutput::ScalarVecVariable< T >, Aqua::InputOutput::ScalarVecVariable< ivec2 >, Aqua::InputOutput::ScalarVecVariable< ivec3 >, Aqua::InputOutput::ScalarVecVariable< ivec4 >, Aqua::InputOutput::ScalarVecVariable< uivec2 >, Aqua::InputOutput::ScalarVecVariable< uivec3 >, Aqua::InputOutput::ScalarVecVariable< uivec4 >, Aqua::InputOutput::ScalarVecVariable< vec2 >, Aqua::InputOutput::ScalarVecVariable< vec3 >, Aqua::InputOutput::ScalarVecVariable< vec4 >, Aqua::InputOutput::ArrayVariable, Aqua::InputOutput::ScalarVariable< T >, Aqua::InputOutput::ScalarVariable< float >, Aqua::InputOutput::ScalarVariable< ivec2 >, Aqua::InputOutput::ScalarVariable< ivec3 >, Aqua::InputOutput::ScalarVariable< ivec4 >, Aqua::InputOutput::ScalarVariable< int >, Aqua::InputOutput::ScalarVariable< uivec2 >, Aqua::InputOutput::ScalarVariable< uivec3 >, Aqua::InputOutput::ScalarVariable< uivec4 >, Aqua::InputOutput::ScalarVariable< unsigned int >, Aqua::InputOutput::ScalarVariable< vec2 >, Aqua::InputOutput::ScalarVariable< vec3 >, and Aqua::InputOutput::ScalarVariable< vec4 >.
|
inlinevirtual |
Get variable pointer basis pointer.
Reimplemented in Aqua::InputOutput::ScalarVariable< T >, Aqua::InputOutput::ScalarVariable< float >, Aqua::InputOutput::ScalarVariable< ivec2 >, Aqua::InputOutput::ScalarVariable< ivec3 >, Aqua::InputOutput::ScalarVariable< ivec4 >, Aqua::InputOutput::ScalarVariable< int >, Aqua::InputOutput::ScalarVariable< uivec2 >, Aqua::InputOutput::ScalarVariable< uivec3 >, Aqua::InputOutput::ScalarVariable< uivec4 >, Aqua::InputOutput::ScalarVariable< unsigned int >, Aqua::InputOutput::ScalarVariable< vec2 >, Aqua::InputOutput::ScalarVariable< vec3 >, Aqua::InputOutput::ScalarVariable< vec4 >, and Aqua::InputOutput::ArrayVariable.
|
inline |
Returns the last event associated to this variable.
|
inlinevirtual |
Get a Python interpretation of the variable.
i0 | First component to be read, just for array variables. |
n | Number of component to be read, just for array variables. |
Reimplemented in Aqua::InputOutput::IntVariable, Aqua::InputOutput::UIntVariable, Aqua::InputOutput::FloatVariable, Aqua::InputOutput::Vec2Variable, Aqua::InputOutput::Vec3Variable, Aqua::InputOutput::Vec4Variable, Aqua::InputOutput::IVec2Variable, Aqua::InputOutput::IVec3Variable, Aqua::InputOutput::IVec4Variable, Aqua::InputOutput::UIVec2Variable, Aqua::InputOutput::UIVec3Variable, Aqua::InputOutput::UIVec4Variable, and Aqua::InputOutput::ArrayVariable.
|
pure virtual |
Let efficiently know whether the variable is an array or not.
Implemented in Aqua::InputOutput::ScalarVariable< T >, Aqua::InputOutput::ScalarVariable< float >, Aqua::InputOutput::ScalarVariable< ivec2 >, Aqua::InputOutput::ScalarVariable< ivec3 >, Aqua::InputOutput::ScalarVariable< ivec4 >, Aqua::InputOutput::ScalarVariable< int >, Aqua::InputOutput::ScalarVariable< uivec2 >, Aqua::InputOutput::ScalarVariable< uivec3 >, Aqua::InputOutput::ScalarVariable< uivec4 >, Aqua::InputOutput::ScalarVariable< unsigned int >, Aqua::InputOutput::ScalarVariable< vec2 >, Aqua::InputOutput::ScalarVariable< vec3 >, Aqua::InputOutput::ScalarVariable< vec4 >, and Aqua::InputOutput::ArrayVariable.
|
inlinevirtual |
Let efficiently know whether the variable is a scalar or not.
|
inline |
Name of the variable.
|
pure virtual |
Set variable from memory.
ptr | Memory to copy. |
Implemented in Aqua::InputOutput::ScalarVariable< T >, Aqua::InputOutput::ScalarVariable< float >, Aqua::InputOutput::ScalarVariable< ivec2 >, Aqua::InputOutput::ScalarVariable< ivec3 >, Aqua::InputOutput::ScalarVariable< ivec4 >, Aqua::InputOutput::ScalarVariable< int >, Aqua::InputOutput::ScalarVariable< uivec2 >, Aqua::InputOutput::ScalarVariable< uivec3 >, Aqua::InputOutput::ScalarVariable< uivec4 >, Aqua::InputOutput::ScalarVariable< unsigned int >, Aqua::InputOutput::ScalarVariable< vec2 >, Aqua::InputOutput::ScalarVariable< vec3 >, Aqua::InputOutput::ScalarVariable< vec4 >, and Aqua::InputOutput::ArrayVariable.
void Aqua::InputOutput::Variable::setEvent | ( | cl_event | event | ) |
Set the variable current event.
clRetainEvent() is called on top of the provided event, while any previous event is conveniently released calling clReleaseEvent()
Might exists other events linked to this variable, but since those are considered predecessors, we can just forgive about them.
event | OpenCL event |
|
inlinevirtual |
Set the variable from a Python object.
obj | Python object. |
i0 | First component to be set, just for array variables. |
n | Number of component to be set, just for array variables. |
Reimplemented in Aqua::InputOutput::IntVariable, Aqua::InputOutput::UIntVariable, Aqua::InputOutput::FloatVariable, Aqua::InputOutput::Vec2Variable, Aqua::InputOutput::Vec3Variable, Aqua::InputOutput::Vec4Variable, Aqua::InputOutput::IVec2Variable, Aqua::InputOutput::IVec3Variable, Aqua::InputOutput::IVec4Variable, Aqua::InputOutput::UIVec2Variable, Aqua::InputOutput::UIVec3Variable, Aqua::InputOutput::UIVec4Variable, and Aqua::InputOutput::ArrayVariable.
|
inlinevirtual |
Get the variable type size.
Reimplemented in Aqua::InputOutput::ArrayVariable.
|
protected |
Wait for variable underlying event to be complete.
This function is tracking the syncing state, avoiding calling clWaitForEvents() more than once, while the event is not updated.
This is obviously a blocking function
|
inlinevirtual |
Type of the variable.
|
inlinevirtual |
Get the variable type size.
Reimplemented in Aqua::InputOutput::ScalarVariable< T >, Aqua::InputOutput::ScalarVariable< float >, Aqua::InputOutput::ScalarVariable< ivec2 >, Aqua::InputOutput::ScalarVariable< ivec3 >, Aqua::InputOutput::ScalarVariable< ivec4 >, Aqua::InputOutput::ScalarVariable< int >, Aqua::InputOutput::ScalarVariable< uivec2 >, Aqua::InputOutput::ScalarVariable< uivec3 >, Aqua::InputOutput::ScalarVariable< uivec4 >, Aqua::InputOutput::ScalarVariable< unsigned int >, Aqua::InputOutput::ScalarVariable< vec2 >, Aqua::InputOutput::ScalarVariable< vec3 >, Aqua::InputOutput::ScalarVariable< vec4 >, and Aqua::InputOutput::ArrayVariable.