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
21#include <memory>
22
23Register_pymod(pyphantomdump) {
24
26
27 shamcomm::logs::debug_ln("[Py]", "registering shamrock.PhantomDump");
28 py::class_<T>(m, "PhantomDump")
29 .def(
30 "save_dump",
31 [](T &self, std::string fname) {
32 auto file = self.gen_file();
33 file.write_to_file(fname);
34 })
35 .def(
36 "read_header_float",
37 [](T &self, std::string s) {
38 return self.read_header_float<f64>(s);
39 })
40 .def(
41 "read_header_int",
42 [](T &self, std::string s) {
43 return self.read_header_int<i64>(s);
44 })
46
47 m.def("load_phantom_dump", [](std::string fname) {
50 });
51
52 m.def(
53 "compare_phantom_dumps",
55 return shammodels::sph::compare_phantom_dumps(dump_1, dump_2);
56 });
57}
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 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
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.