4#include "../Array_bind.hpp"
8 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
11 return fmt::format(
"_{}_{}_{}",
17 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
20 return "ArrayAdjacency" + pybind11_ArrayAdjacency_name_appends<_row_size, _row_max, _align>();
23 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
26 return "ArrayAdjacencyPair" + pybind11_ArrayAdjacency_name_appends<_row_size, _row_max, _align>();
29 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
32 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
38 template <
class TArray = ArrayAdjacency<1>>
41 auto row_info = row.request(
false);
45 auto row_start_ptr =
reinterpret_cast<index *
>(row_info.ptr);
46 std::copy(row_start_ptr, row_start_ptr + count, self.rowPtr(index_));
49 template <
class TArray = ArrayAdjacency<1>>
53 return py::memoryview::from_buffer<index>(
63 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
64 tPy_ArrayAdjacency<_row_size, _row_max, _align>
67 auto ParArray_ = pybind11_ParArray_get_class<index, _row_size, _row_max, _align>(m);
68 return {m, pybind11_ArrayAdjacency_name<_row_size, _row_max, _align>().c_str(), ParArray_};
72 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
73 tPy_ArrayAdjacency<_row_size, _row_max, _align>
76 return {m.attr(pybind11_ArrayAdjacency_name<_row_size, _row_max, _align>().c_str())};
79 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
84 auto ArrayAdjacency_ = pybind11_ArrayAdjacency_declare<_row_size, _row_max, _align>(m);
93 .def(py::init<const MPIInfo &>(), py::arg(
"nmpi"))
94 .def(py::init([](
const std::string &name,
const MPIInfo &nmpi)
95 {
return make_ssp<TArrayAdjacency>(
ObjName{name}, nmpi); }),
96 py::arg(
"name"), py::arg(
"nmpi"))
97 .def(
"setObjectName", &TArrayAdjacency::setObjectName, py::arg(
"name"))
98 .def(
"getObjectName", &TArrayAdjacency::getObjectName)
101 [](TArrayAdjacency &self,
index index_)
105 py::keep_alive<0, 1>())
108 [](TArrayAdjacency &self,
index index_, py::buffer row)
113 .def(
"clone", [](TArrayAdjacency &self)
115 auto arr = std::make_shared<TArrayAdjacency>(self);
119 .def(
"to_device", [](TArrayAdjacency &self,
const std::string &backend)
121 .def(
"to_host", &TArrayAdjacency::to_host);
124 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
130 return pybind11_ArrayAdjacency_define<_row_size, _row_max, _align>(m);
136 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
137 tPy_ArrayAdjacencyPair<_row_size, _row_max, _align>
140 return {m, pybind11_ArrayAdjacencyPair_name<_row_size, _row_max, _align>().c_str()};
144 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
145 tPy_ArrayAdjacencyPair<_row_size, _row_max, _align>
148 return {m.attr(pybind11_ArrayAdjacencyPair_name<_row_size, _row_max, _align>().c_str())};
151 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
157 auto Pair_ = pybind11_ArrayAdjacencyPair_declare<_row_size, _row_max, _align>(m);
165 pybind11_ArrayPairGenericBindBasics<TPair>(Pair_);
168 .def(
"RowSize", [](
const TPair &self,
index i)
169 {
return self.RowSize(i); }, py::arg(
"i"))
170 .def(
"RowSize", [](
const TPair &self)
171 {
return self.RowSize(); });
175 [](TPair &self,
index index_)
177 return self.runFunctionAppendedIndex(index_, [&](
auto &ar,
index iC)
180 py::keep_alive<0, 1>())
183 [](TPair &self,
index index_, py::buffer row)
185 return self.runFunctionAppendedIndex(index_, [&](
auto &ar,
index iC)
190 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
196 return pybind11_ArrayAdjacencyPair_define<_row_size, _row_max, _align>(m);
202 template <
size_t N, std::array<
int, N> const &Arr,
size_t... Is>
205 (_pybind11_ArrayAdjacency_define_dispatch<Arr[Is]>(m), ...);
206 (_pybind11_ArrayAdjacencyPair_define_dispatch<Arr[Is]>(m), ...);
211 static constexpr auto seq = pybind11_arrayRowsizeInstantiationList;
213 seq.size(), seq>(m, std::make_index_sequence<seq.size()>{});
Adjacency array (CSR-like index storage) built on ParArray.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Non-owning span (pointer, size) into an ArrayAdjacency row.
DNDS_DEVICE_CALLABLE index_T * begin()
Mesh-connectivity array: ParArray<index> whose operator[] yields an AdjacencyRow typed view.
the host side operators are provided as implemented
void pybind11_ArrayAdjacencyPair_define(py::module_ &m)
void _pybind11_ArrayAdjacency_define_dispatch(py::module_ &m)
py::classh< T > py_class_ssp
void pybind11_bind_ArrayAdjacency_All(py::module_ &m)
std::tuple< ssize_t, char > py_buffer_get_contigious_size(const py::buffer_info &info)
void __pybind11_callBindArrayAdjacencys_rowsizes_sequence(py::module_ &m, std::index_sequence< Is... >)
DeviceBackend device_backend_name_to_enum(std::string_view s)
Inverse of device_backend_name. Returns Unknown for unrecognised names.
tPy_ArrayAdjacencyPair< _row_size, _row_max, _align > pybind11_ArrayAdjacencyPair_declare(py::module_ &m)
void _pybind11_ArrayAdjacencyPair_define_dispatch(py::module_ &m)
std::string RowSize_To_PySnippet(rowsize rs)
Encode a rowsize constant as a short Python-binding snippet: "<number>" for fixed,...
tPy_ArrayAdjacency< _row_size, _row_max, _align > pybind11_ArrayAdjacency_get_class(py::module_ &m)
py_class_ssp< ArrayAdjacencyPair< _row_size, _row_max, _align > > tPy_ArrayAdjacencyPair
std::string pybind11_ArrayAdjacency_name()
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
auto pybind11_ArrayAdjacency_getitem(TArray &self, index index_)
py_class_ssp< ArrayAdjacency< _row_size, _row_max, _align > > tPy_ArrayAdjacency
std::string pybind11_ArrayAdjacencyPair_name()
tPy_ArrayAdjacency< _row_size, _row_max, _align > pybind11_ArrayAdjacency_declare(py::module_ &m)
void pybind11_callBindArrayAdjacencys_rowsizes(py::module_ &m)
std::string pybind11_ArrayAdjacency_name_appends()
std::string Align_To_PySnippet(rowsize al)
Encode an alignment value as a Python-binding snippet: "N" for NoAlign, the number otherwise.
auto pybind11_ArrayAdjacency_setitem(TArray &self, index index_, py::buffer row)
void pybind11_ArrayAdjacency_define(py::module_ &m)
tPy_ArrayAdjacencyPair< _row_size, _row_max, _align > pybind11_ArrayAdjacencyPair_get_class(py::module_ &m)
DNDS_CONSTANT const rowsize UnInitRowsize
Sentinel "not initialised" rowsize value (= INT32_MIN).
Convenience bundle of a father, son, and attached ArrayTransformer.
Lightweight bundle of an MPI communicator and the calling rank's coordinates.
Tag type for naming objects created via make_ssp.