Mantid
Loading...
Searching...
No Matches
Framework
PythonInterface
core
inc
MantidPythonInterface
core
Converters
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
12
namespace
Mantid
{
13
namespace
PythonInterface {
14
namespace
Converters
{
15
//-----------------------------------------------------------------------
16
// Converter implementation
17
//-----------------------------------------------------------------------
24
template
<
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
Mantid::PythonInterface::Converters
Definition
CArrayToNDArray.h:13
Mantid
Helper class which provides the Collimation Length for SANS instruments.
Definition
AbsorptionCorrection.h:18
Mantid::PythonInterface::Converters::VectorToNDArray
Converter that takes a std::vector and converts it into a flat numpy array.
Definition
VectorToNDArray.h:24
Mantid::PythonInterface::Converters::VectorToNDArray::operator()
PyObject * operator()(const std::vector< ElementType > &cdata) const
Converts a cvector to a numpy array.
Definition
VectorToNDArray.h:30
Generated by
1.9.8