AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Aqua::InputOutput::ScalarVecVariable< T > Class Template Reference

A generic Scalar variable, of 2 or more components. More...

#include <Variable.hpp>

Inheritance diagram for Aqua::InputOutput::ScalarVecVariable< T >:
Collaboration diagram for Aqua::InputOutput::ScalarVecVariable< T >:

Public Member Functions

 ScalarVecVariable (const std::string varname, const std::string vartype, const unsigned int dims, int np_type)
 Constructor.
 ~ScalarVecVariable ()
 Destructor.
PyObject * getPythonObject (int i0=0, int n=0)
bool setFromPythonObject (PyObject *obj, int i0=0, int n=0)
virtual const std::string asString (bool synced=true)
 Get the variable text representation.
Public Member Functions inherited from Aqua::InputOutput::ScalarVariable< T >
 ScalarVariable (const std::string varname, const std::string vartype)
 Constructor.
 ~ScalarVariable ()
 Destructor.
bool isArray ()
 Report that the varaible is not an array.
size_t typesize () const
 Get the variable type size.
void * get (bool synced=true)
 Get variable pointer basis pointer.
void get (T &value, bool synced=true)
 Get variable value.
void set (void *ptr, bool synced=true)
 Set variable from memory.
void set (T &value, bool synced=true)
 Set variable value.
T value (bool synced=true)
 Get the variable value.
void value (T &value, bool synced=true)
 Set the variable value.
Public Member Functions inherited from Aqua::InputOutput::Variable
 Variable (const std::string varname, const std::string vartype)
 Constructor.
virtual ~Variable ()
 Destructor.
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 size () const
 Get the variable type size.
virtual void * get (bool UNUSED_PARAM synced=true)
 Get variable pointer basis pointer.
void * get_async ()
 Get variable pointer basis pointer.
void set_async (void *ptr)
 Set variable from memory.
virtual PyObject * getPythonObject (int UNUSED_PARAM i0=0, int UNUSED_PARAM n=0)
 Get a Python interpretation of the variable.
virtual bool setFromPythonObject (PyObject UNUSED_PARAM *obj, int UNUSED_PARAM i0=0, int UNUSED_PARAM n=0)
 Set the variable from a Python object.
virtual const std::string asString (bool UNUSED_PARAM synced=true)
 Get the variable text representation.
void setEvent (cl_event event)
 Set the variable current writing event.
void setWritingEvent (cl_event event)
 Alias of InputOutput::Variable::setEvent()
cl_event getEvent () const
 Returns the last writing event associated to this variable.
cl_event getWritingEvent () const
 Alias of InputOutput::Variable::getEvent()
void addReadingEvent (cl_event event)
 Add a new reading event to the variable.
std::vector< cl_event > getReadingEvents () const
 Get the list of reading events.
void sync (bool readonly=false)
 Wait for variable reading and writing events to be completed.

Protected Member Functions

bool checkPyhonObjectDims (PyObject *obj)
 Check that a Python object is compatible with the variable type.
Protected Member Functions inherited from Aqua::InputOutput::Variable
void cleanReadingEvents ()
 Clean up the list of reading events.

Additional Inherited Members

Static Protected Member Functions inherited from Aqua::InputOutput::Variable
static cl_event createDummyEvent ()
 Create a competed user event to be set as the writing event when synced writing operations are carried out.
Protected Attributes inherited from Aqua::InputOutput::ScalarVariable< T >
T _value
 Variable value.

Detailed Description

template<class T>
class Aqua::InputOutput::ScalarVecVariable< T >

A generic Scalar variable, of 2 or more components.

Constructor & Destructor Documentation

◆ ScalarVecVariable()

template<class T>
Aqua::InputOutput::ScalarVecVariable< T >::ScalarVecVariable ( const std::string varname,
const std::string vartype,
const unsigned int dims,
int np_type )

Constructor.

Parameters
varnameName of the variable.
vartypeType of the variable.
dimsNumber of components of the type.
np_typeType of the numpy associated object.
Here is the call graph for this function:

◆ ~ScalarVecVariable()

template<class T>
Aqua::InputOutput::ScalarVecVariable< T >::~ScalarVecVariable ( )
inline

Destructor.

Member Function Documentation

◆ asString()

template<class T>
const std::string Aqua::InputOutput::ScalarVecVariable< T >::asString ( bool synced = true)
virtual

Get the variable text representation.

Parameters
syncedtrue if the function shall block until the last writing event is dispatched, false otherwise
Returns
The variable represented as a string, NULL in case of errors.

Implements Aqua::InputOutput::ScalarVariable< T >.

Here is the call graph for this function:

◆ checkPyhonObjectDims()

template<class T>
bool Aqua::InputOutput::ScalarVecVariable< T >::checkPyhonObjectDims ( PyObject * obj)
protected

Check that a Python object is compatible with the variable type.

This method is checking that the Python object is an array with the same number of components of the variable type. The internal data type is not checked.

Parameters
objPython object object.
Returns
false if the Python object matchs with the variable type, true otherwise.
Here is the call graph for this function:

◆ getPythonObject()

template<class T>
PyObject * Aqua::InputOutput::ScalarVecVariable< T >::getPythonObject ( int i0 = 0,
int n = 0 )
virtual

Get a PyArrayObject interpretation of the variable

Parameters
i0ignored parameter.
nignored parameter
Returns
PyArrayObject Python object (PyArray_FLOAT subtype).

Implements Aqua::InputOutput::ScalarVariable< T >.

Here is the call graph for this function:

◆ setFromPythonObject()

template<class T>
bool Aqua::InputOutput::ScalarVecVariable< T >::setFromPythonObject ( PyObject * obj,
int i0 = 0,
int n = 0 )
virtual

Set the variable from a Python object

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

Implements Aqua::InputOutput::ScalarVariable< T >.

Here is the call graph for this function:

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