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
9#include <boost/python/detail/prefix.hpp>
10#include <vector>
11
12namespace Mantid {
13namespace PythonInterface {
14namespace Converters {
15//-----------------------------------------------------------------------
16// Converter implementation
17//-----------------------------------------------------------------------
24template <typename ElementType, typename ConversionPolicy> struct VectorToNDArray {
30 inline PyObject *operator()(const std::vector<ElementType> &cdata) const {
31 // Hand off the work to the conversion policy
32 using policy = typename ConversionPolicy::template apply<ElementType>;
33 return policy::create1D(cdata);
34 }
35};
36} // namespace Converters
37} // namespace PythonInterface
38} // 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.