18 #ifndef PYTHON_FIELD_BASE_HH_
19 #define PYTHON_FIELD_BASE_HH_
21 #include <pybind11/pybind11.h>
22 #include <pybind11/stl.h>
23 #include <pybind11/numpy.h>
27 namespace py = pybind11;
28 #pragma GCC visibility push(hidden)
46 shape.push_back(proxy.
shape_[0]);
47 if (proxy.
shape_.size() == 2) shape.push_back(proxy.
shape_[1]);
49 shape.push_back(size);
51 ssize_t n_dim = shape.size();
52 strides.resize(n_dim);
53 strides[n_dim-1] =
sizeof(double);
54 for(
uint i=n_dim-1; i>0; i--) {
55 strides[i-1] = strides[i] * shape[i];
59 return py::buffer_info(
90 #pragma GCC visibility pop
Helper class, holds data of one field.
std::vector< uint > shape_
FieldCacheProxy(std::string field_name, std::vector< uint > shape, double *field_cache_data, uint data_size)
Constructor.
double * field_cache_data_
FieldCacheProxy(const FieldCacheProxy &other)
Copy constructor.
const std::string & field_name() const
Getter returns field name.
static py::buffer_info field_proxy_get_buffer(FieldCacheProxy &proxy)
manipulators::Array< T, Delim > format(T const &deduce, Delim delim=", ")