AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Public Member Functions
Aqua::InputOutput::ArrayVariable Class Reference

#include <Variable.h>

Inheritance diagram for Aqua::InputOutput::ArrayVariable:
Inheritance graph
[legend]
Collaboration diagram for Aqua::InputOutput::ArrayVariable:
Collaboration graph
[legend]

Public Member Functions

 ArrayVariable (const std::string varname, const std::string vartype)
 
 ~ArrayVariable ()
 
bool isArray ()
 Report that the varaible is an array.
 
size_t typesize () const
 
size_t size () const
 
void * get ()
 
void set (void *ptr)
 
PyObject * getPythonObject (int i0=0, int n=0)
 
bool setFromPythonObject (PyObject *obj, int i0=0, int n=0)
 
const std::string asString ()
 
const std::string asString (size_t i)
 
- Public Member Functions inherited from Aqua::InputOutput::Variable
 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.
 

Additional Inherited Members

- Protected Member Functions inherited from Aqua::InputOutput::Variable
void sync ()
 Wait for variable underlying event to be complete.
 

Constructor & Destructor Documentation

◆ ArrayVariable()

Aqua::InputOutput::ArrayVariable::ArrayVariable ( const std::string  varname,
const std::string  vartype 
)

Constructor.

Parameters
varnameName of the variable.
vartypeType of the variable.

◆ ~ArrayVariable()

Aqua::InputOutput::ArrayVariable::~ArrayVariable ( )

Destructor.

Member Function Documentation

◆ asString() [1/2]

const std::string Aqua::InputOutput::ArrayVariable::asString ( )
virtual

Get the variable text representation

Returns
The variable represented as a string, NULL in case of errors.

Reimplemented from Aqua::InputOutput::Variable.

Here is the call graph for this function:

◆ asString() [2/2]

const std::string Aqua::InputOutput::ArrayVariable::asString ( size_t  i)

Get a component text representation

Parameters
iIndex of the component to be extracted.
Returns
The component represented as a string, NULL in case of errors.
Here is the call graph for this function:

◆ get()

void * Aqua::InputOutput::ArrayVariable::get ( )
inlinevirtual

Get variable pointer basis pointer

Returns
Implementation pointer.

Reimplemented from Aqua::InputOutput::Variable.

◆ getPythonObject()

PyObject * Aqua::InputOutput::ArrayVariable::getPythonObject ( int  i0 = 0,
int  n = 0 
)
virtual

Get a PyArrayObject interpretation of the variable

Parameters
i0First component to be read.
nNumber of component to be read, 0 to read all available memory, i.e. All the array after i0.
Returns
PyArrayObject Python object. NULL if the memory cannot be read.

Reimplemented from Aqua::InputOutput::Variable.

Here is the call graph for this function:

◆ isArray()

bool Aqua::InputOutput::ArrayVariable::isArray ( )
inlinevirtual

Report that the varaible is an array.

Returns
true

Implements Aqua::InputOutput::Variable.

◆ set()

void Aqua::InputOutput::ArrayVariable::set ( void *  ptr)
inlinevirtual

Set variable from memory

Parameters
ptrMemory to copy.

Implements Aqua::InputOutput::Variable.

◆ setFromPythonObject()

bool Aqua::InputOutput::ArrayVariable::setFromPythonObject ( PyObject *  obj,
int  i0 = 0,
int  n = 0 
)
virtual

Set the variable from a Python object

Parameters
objPyArrayObject object.
i0ignored parameter.
nignored parameter
Returns
false if all gone right, true otherwise.

Reimplemented from Aqua::InputOutput::Variable.

Here is the call graph for this function:

◆ size()

size_t Aqua::InputOutput::ArrayVariable::size ( ) const
virtual

Get the array size.

Returns
Array allocated memory (in bytes)
Note
In order to get the length of the array the command size() / Variables::typeToBytes(type()) can be used

Reimplemented from Aqua::InputOutput::Variable.

Here is the call graph for this function:

◆ typesize()

size_t Aqua::InputOutput::ArrayVariable::typesize ( ) const
inlinevirtual

Get the cl_mem type size.

Returns
cl_mem type size (in bytes)
Note
In order to know the typesize of the components into the array you may use Variables::typeToBytes()

Reimplemented from Aqua::InputOutput::Variable.


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