Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
pyPhantomDump.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
21#include <memory>
22
24 auto &m = root_module;
25
27
28 shamcomm::logs::debug_ln("[Py]", "registering shamrock.PhantomDump");
29 py::class_<T>(m, "PhantomDump")
30 .def(
31 "save_dump",
32 [](T &self, std::string fname) {
33 auto file = self.gen_file();
34 file.write_to_file(fname);
35 })
36 .def(
37 "read_header_float",
38 [](T &self, std::string s) {
39 return self.read_header_float<f64>(s);
40 })
41 .def(
42 "read_header_int",
43 [](T &self, std::string s) {
44 return self.read_header_int<i64>(s);
45 })
47
48 m.def("load_phantom_dump", [](std::string fname) {
51 });
52
53 m.def(
54 "compare_phantom_dumps",
56 return shammodels::sph::compare_phantom_dumps(dump_1, dump_2);
57 });
58}
double f64
Alias for double.
std::int64_t i64
64 bit integer
Class for reading and writing Fortran-style binary files.
FortranIOFile load_fortran_file(const std::string &fname)
Load a Fortran formatted file from disk.
bool compare_phantom_dumps(PhantomDump &dump1, PhantomDump &dump2)
Compare two phantom dumps and report offenses.
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
Class representing a Phantom dump file.
static PhantomDump from_file(shambase::FortranIOFile &phfile)
Reads a Phantom dump file and returns a PhantomDump object.
void print_state()
Print current state of the data stored in the class.