Mantid
Loading...
Searching...
No Matches
CArrayToNDArray.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10#include "MantidPythonInterface/core/Converters/WrapWithNumpy.h"
11
12namespace Mantid {
13namespace PythonInterface {
14namespace Converters {
15//-----------------------------------------------------------------------
16// Converter implementation
17//-----------------------------------------------------------------------
25template <typename ElementType, typename ConversionPolicy> struct CArrayToNDArray {
26 inline PyObject *operator()(const ElementType *carray, const int ndims, Py_intptr_t *dims) const {
27 // Round about way of calling the wrapNDArray template function that is
28 // defined
29 // in the cpp file
30 using policy = typename ConversionPolicy::template apply<ElementType>;
31 return policy::createFromArray(carray, ndims, dims);
32 }
33};
34} // namespace Converters
35} // namespace PythonInterface
36} // namespace Mantid
Helper class which provides the Collimation Length for SANS instruments.
Converter that takes a c array and its size then converts/wraps it into a numpy array.
PyObject * operator()(const ElementType *carray, const int ndims, Py_intptr_t *dims) const