Mantid
Loading...
Searching...
No Matches
VectorToNDArray.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
11#include <boost/python/detail/prefix.hpp>
12#include <vector>
13
14namespace Mantid {
15namespace PythonInterface {
16namespace Converters {
17//-----------------------------------------------------------------------
18// Converter implementation
19//-----------------------------------------------------------------------
26template <typename ElementType, typename ConversionPolicy> struct VectorToNDArray {
32 inline PyObject *operator()(const std::vector<ElementType> &cdata) const {
33 // Hand off the work to the conversion policy
34 using policy = typename ConversionPolicy::template apply<ElementType>;
35 return policy::create1D(cdata);
36 }
37};
38} // namespace Converters
39} // namespace PythonInterface
40} // namespace Mantid
Helper class which provides the Collimation Length for SANS instruments.
Converter that takes a std::vector and converts it into a flat numpy array.
PyObject * operator()(const std::vector< ElementType > &cdata) const
Converts a cvector to a numpy array.