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
20#include <pybind11/numpy.h>
21
22Register_pymod(pyamrgridinit) {
23
25
26 shamcomm::logs::debug_ln("[Py]", "registering shamrock.AMRGrid");
27 py::class_<Grid>(m, "AMRGrid")
28 .def(py::init([](ShamrockCtx &ctx) {
29 return std::make_unique<Grid>(*ctx.sched);
30 }))
31 .def(
32 "make_base_grid",
33 [](Grid &grid,
34 std::array<u64, 3> min,
35 std::array<u64, 3> cell_size,
36 std::array<u32, 3> cell_count) {
37 grid.make_base_grid(
38 u64_3{min[0], min[1], min[2]},
39 u64_3{cell_size[0], cell_size[1], cell_size[2]},
40 cell_count);
41 });
42}
The AMR grid only sees the grid as an integer map.
Definition AMRGrid.hpp:44
Pybind11 include and definitions.
#define Register_pymod(placeholdername)
Register a python module init function using static initialisation.
void debug_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
Definition logs.hpp:133