PDI 1.10.0

the PDI data interface

tools.h
1/*******************************************************************************
2 * Copyright (C) 2015-2024 Commissariat a l'energie atomique et aux energies alternatives (CEA)
3 * Copyright (C) 2020 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of CEA nor the names of its contributors may be used to
14 * endorse or promote products derived from this software without specific
15 * prior written permission.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 ******************************************************************************/
25
26#ifndef PDI_PYTHON_TOOLS_H_
27#define PDI_PYTHON_TOOLS_H_
28
29#include <pybind11/numpy.h>
30#include <pybind11/pybind11.h>
31
32#include <pdi/pdi_fwd.h>
33#include <pdi/ref_any.h>
34
35namespace PDI {
36
43pybind11::object PDI_EXPORT to_python(Ref r, bool force_const = false);
44
50Datatype_sptr PDI_EXPORT python_type(const pybind11::array& a);
51
57pybind11::dtype PDI_EXPORT to_python(const std::shared_ptr<const Scalar_datatype>& scalar_type);
58
59} // namespace PDI
60
61#endif // PDI_PYTHON_TOOLS_H_
Definition array_datatype.h:38
pybind11::object to_python(Ref r, bool force_const=false)
Wraps a PDI reference in a python object.
Datatype_sptr python_type(const pybind11::array &a)
Function takes python numpy array and converts it into PDI datatype.
std::shared_ptr< const Datatype > Datatype_sptr
Definition pdi_fwd.h:80
Ref_any< false, false > Ref
Definition pdi_fwd.h:94