Regina 7.0 Calculation Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
regina::python::GlobalArray3D< T, rvp > Class Template Reference

A template class that references a constant three-dimensional C++ array. More...

#include <python/globalarray.h>

Public Types

using Subarray = GlobalArray2D< T, rvp >
 A wrapper class for each two-dimensional subarray. More...
 

Public Member Functions

template<size_t dim2, size_t dim3>
 GlobalArray3D (const T data[][dim2][dim3], size_t dim1)
 Constructs a new wrapper object for the given 3-dimensional C++ array. More...
 
 GlobalArray3D (const GlobalArray3D< T, rvp > &cloneMe)
 Constructs a new wrapper object that wraps the same C++ array as the given wrapper object. More...
 
 ~GlobalArray3D ()
 Class destructor. More...
 
size_t dim1 () const
 Return the first dimension of this array. More...
 
size_t dim2 () const
 Return the second dimension of this array. More...
 
size_t dim3 () const
 Return the third dimension of this array. More...
 
const SubarraygetItem (size_t index) const
 Returns the requested top-dimensional subarray of the array. More...
 
std::ostream & writeText (std::ostream &out) const
 Writes a string representation of this array, including all of its elements, to the given output stream. More...
 

Static Public Member Functions

static void wrapClass (pybind11::module_ &m, const char *className)
 Constructs a Python wrapper for this class. More...
 

Detailed Description

template<typename T, pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
class regina::python::GlobalArray3D< T, rvp >

A template class that references a constant three-dimensional C++ array.

An object of this class can be passed through to Python to allow the user access to the underlying C++ array. For the Python user, the usual list operator [] can be used to access the elements of the array. Range checking is performed on any indices that are passed.

The rvp template argument specifies the return value policy for element lookup.

For each different set of template parameters, the corresponding GlobalArray3D class must be wrapped in Python before the first object of this class is wrapped. This wrapping is performed by calling wrapClass().

Note that elements of this array can only be inspected, not modified.

Precondition
The output operator << is defined for type T.

Member Typedef Documentation

◆ Subarray

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
using regina::python::GlobalArray3D< T, rvp >::Subarray = GlobalArray2D<T, rvp>

A wrapper class for each two-dimensional subarray.

Constructor & Destructor Documentation

◆ GlobalArray3D() [1/2]

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
template<size_t dim2, size_t dim3>
regina::python::GlobalArray3D< T, rvp >::GlobalArray3D ( const T  data[][dim2][dim3],
size_t  dim1 
)
inline

Constructs a new wrapper object for the given 3-dimensional C++ array.

Precondition
This class has already been wrapped in Python by calling wrapClass().
The first dimension is strictly positive.
Parameters
datathe constant 3-dimensional C++ array that is to be wrapped.
dim1the first array dimension of this C++ array.
Template Parameters
dim2the second array dimension of this C++ array. This must be a compile-time constant.
dim3the third array dimension of this C++ array. This must be a compile-time constant.

◆ GlobalArray3D() [2/2]

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
regina::python::GlobalArray3D< T, rvp >::GlobalArray3D ( const GlobalArray3D< T, rvp > &  cloneMe)
inline

Constructs a new wrapper object that wraps the same C++ array as the given wrapper object.

Note that the same underlying C++ array is referenced, i.e., the C++ array itself is not cloned.

Parameters
cloneMethe wrapper object to clone.

◆ ~GlobalArray3D()

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
regina::python::GlobalArray3D< T, rvp >::~GlobalArray3D ( )
inline

Class destructor.

All of the internal subarray wrappers are destroyed.

Member Function Documentation

◆ dim1()

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
size_t regina::python::GlobalArray3D< T, rvp >::dim1 ( ) const
inline

Return the first dimension of this array.

Returns
the first dimension.

◆ dim2()

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
size_t regina::python::GlobalArray3D< T, rvp >::dim2 ( ) const
inline

Return the second dimension of this array.

Returns
the second dimension.

◆ dim3()

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
size_t regina::python::GlobalArray3D< T, rvp >::dim3 ( ) const
inline

Return the third dimension of this array.

Returns
the third dimension.

◆ getItem()

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
const Subarray & regina::python::GlobalArray3D< T, rvp >::getItem ( size_t  index) const
inline

Returns the requested top-dimensional subarray of the array.

If the subarray index is out of range, a Python error will be thrown.

Parameters
indexthe index of the requested subarray.
Returns
the top-dimensional subarray at the given index.

◆ wrapClass()

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
static void regina::python::GlobalArray3D< T, rvp >::wrapClass ( pybind11::module_ &  m,
const char *  className 
)
inlinestatic

Constructs a Python wrapper for this class.

This routine must be called for each set of template parameters before the first object of this class is wrapped.

Parameters
mthe Python module in which these wrappers should be installed.
classNamethe name that will be assigned to this class in Python.

◆ writeText()

template<typename T , pybind11::return_value_policy rvp = pybind11::return_value_policy::copy>
std::ostream & regina::python::GlobalArray3D< T, rvp >::writeText ( std::ostream &  out) const
inline

Writes a string representation of this array, including all of its elements, to the given output stream.

Parameters
outthe output stream to which to write.
Returns
a reference to out.

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

Copyright © 1999-2021, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).