|
Mantid
|
Converter taking an input numpy array and converting it to a std::vector. More...
#include <NDArrayToVector.h>
Public Types | |
| using | TypedVector = std::vector< DestElementType > |
| using | TypedVectorIterator = typename std::vector< DestElementType >::iterator |
Public Member Functions | |
| void | copyTo (TypedVector &dest) const |
| Fill the container with data from the array. More... | |
| NDArrayToVector (const NDArray &value) | |
| Constructor. More... | |
| TypedVector | operator() () |
| Create a new vector from the contents of the array. More... | |
Private Member Functions | |
| void | throwIfSizeMismatched (const TypedVector &dest) const |
Private Attributes | |
| NDArray | m_arr |
Converter taking an input numpy array and converting it to a std::vector.
Multi-dimensional arrays are flattened and copied.
Definition at line 20 of file NDArrayToVector.h.
| using Mantid::PythonInterface::Converters::NDArrayToVector< DestElementType >::TypedVector = std::vector<DestElementType> |
Definition at line 22 of file NDArrayToVector.h.
| using Mantid::PythonInterface::Converters::NDArrayToVector< DestElementType >::TypedVectorIterator = typename std::vector<DestElementType>::iterator |
Definition at line 23 of file NDArrayToVector.h.
| Mantid::PythonInterface::Converters::NDArrayToVector< DestElementType >::NDArrayToVector | ( | const NDArray & | value | ) |
Constructor.
| value | :: A boost python object wrapping a numpy.ndarray |
Definition at line 117 of file NDArrayToVector.cpp.
| void Mantid::PythonInterface::Converters::NDArrayToVector< DestElementType >::copyTo | ( | TypedVector & | dest | ) | const |
Fill the container with data from the array.
| dest | A pre-sized container that will receive the values from the array. It's size is checked against the array size. |
Definition at line 136 of file NDArrayToVector.cpp.
| NDArrayToVector< DestElementType >::TypedVector Mantid::PythonInterface::Converters::NDArrayToVector< DestElementType >::operator() |
Create a new vector from the contents of the array.
Creates a vector of the DestElementType from the numpy array of given input type.
Definition at line 125 of file NDArrayToVector.cpp.
|
private |
| dest | A reference to a vector whose capacity is checked that it can contain the values from the numpy array |
| std::invalid_argument | if the vector is the wrong size or the numpy array is not 1D |
Definition at line 150 of file NDArrayToVector.cpp.
References std::to_string().
|
private |
Definition at line 36 of file NDArrayToVector.h.