Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
pyAMRGrid.cpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
15
20#include <pybind11/numpy.h>
21
23 auto &m = root_module;
24
26
27 shamcomm::logs::debug_ln("[Py]", "registering shamrock.AMRGrid");
28 py::class_<Grid>(m, "AMRGrid")
29 .def(py::init([](ShamrockCtx &ctx) {
30 return std::make_unique<Grid>(*ctx.sched);
31 }))
32 .def(
33 "make_base_grid",
34 [](Grid &grid,
35 std::array<u64, 3> min,
36 std::array<u64, 3> cell_size,
37 std::array<u32, 3> cell_count) {
38 grid.make_base_grid(
39 u64_3{min[0], min[1], min[2]},
40 u64_3{cell_size[0], cell_size[1], cell_size[2]},
41 cell_count);
42 });
43}
The AMR grid only sees the grid as an integer map.
Definition AMRGrid.hpp:44
Pybind11 include and definitions.
#define ON_PYTHON_INIT
Register a Python module init function using static initialization.
void debug_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
Definition logs.hpp:133