Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
shammodels::sph::PhantomDump Struct Reference

Class representing a Phantom dump file. More...

#include <shammodels/sph/include/shammodels/sph/io/PhantomDump.hpp>

+ Collaboration diagram for shammodels::sph::PhantomDump:

Public Types

using fort_real = f64
 Floating-point type used in the phantom dump format.
 
using fort_int = int
 Integer type used in the phantom dump format.
 

Public Member Functions

void override_magic_number ()
 Overrides the magic numbers used in the PhantomDump struct.
 
void check_magic_numbers ()
 Checks if the magic numbers in the PhantomDump struct match the expected values.
 
shambase::FortranIOFile gen_file ()
 Generates a Phantom dump file from the current state of the object.
 
bool has_header_entry (std::string s) const
 Checks if a given string is present in any of the table headers.
 
template<class T >
read_header_float (std::string s) const
 Retrieves a floating-point value from the table headers.
 
template<class T >
std::vector< T > read_header_floats (std::string s)
 Reads multiple float values from the table headers based on the given string.
 
template<class T >
read_header_int (std::string s) const
 Retrieves an integer value from the table headers.
 
template<class T >
std::vector< T > read_header_ints (std::string s)
 Retrieves multiple integer values from the table headers based on the given string.
 
void print_state ()
 Print current state of the data stored in the class.
 

Static Public Member Functions

static PhantomDump from_file (shambase::FortranIOFile &phfile)
 Reads a Phantom dump file and returns a PhantomDump object.
 

Public Attributes

fort_int i1
 Magic number used in the phantom dump format.
 
fort_int i2
 Magic number used in the phantom dump format.
 
fort_int iversion
 Magic number used in the phantom dump format.
 
fort_int i3
 Magic number used in the phantom dump format.
 
fort_real r1
 Magic number used in the phantom dump format.
 
std::string fileid
 Magic number used in the phantom dump format.
 
PhantomDumpTableHeader< fort_inttable_header_fort_int
 Table header for integer data.
 
PhantomDumpTableHeader< i8table_header_i8
 Table header for signed 8-bit integer data.
 
PhantomDumpTableHeader< i16table_header_i16
 Table header for signed 16-bit integer data.
 
PhantomDumpTableHeader< i32table_header_i32
 Table header for signed 32-bit integer data.
 
PhantomDumpTableHeader< i64table_header_i64
 Table header for signed 64-bit integer data.
 
PhantomDumpTableHeader< fort_realtable_header_fort_real
 Table header for floating-point data.
 
PhantomDumpTableHeader< f32table_header_f32
 Table header for 32-bit floating-point data.
 
PhantomDumpTableHeader< f64table_header_f64
 Table header for 64-bit floating-point data.
 
std::vector< PhantomDumpBlockblocks
 List of blocks in the Phantom dump file.
 

Detailed Description

Class representing a Phantom dump file.

The class provides methods to read and write Phantom dump files, as well as to retrieve data from the file.

Todo:
add example of usage

Definition at line 347 of file PhantomDump.hpp.

Member Typedef Documentation

◆ fort_int

Integer type used in the phantom dump format.

Definition at line 352 of file PhantomDump.hpp.

◆ fort_real

Floating-point type used in the phantom dump format.

Definition at line 350 of file PhantomDump.hpp.

Member Function Documentation

◆ check_magic_numbers()

void shammodels::sph::PhantomDump::check_magic_numbers ( )
inline

Checks if the magic numbers in the PhantomDump struct match the expected values.

Exceptions
std::runtime_errorif any of the magic numbers do not match the expected values

Definition at line 380 of file PhantomDump.hpp.

+ Here is the call graph for this function:

◆ from_file()

shammodels::sph::PhantomDump shammodels::sph::PhantomDump::from_file ( shambase::FortranIOFile phfile)
static

Reads a Phantom dump file and returns a PhantomDump object.

Parameters
phfilePhantom dump file to read
Returns
a PhantomDump object containing the data from the file

Definition at line 315 of file PhantomDump.cpp.

+ Here is the call graph for this function:

◆ gen_file()

shambase::FortranIOFile shammodels::sph::PhantomDump::gen_file ( )

Generates a Phantom dump file from the current state of the object.

Returns
a Phantom dump file

Definition at line 268 of file PhantomDump.cpp.

+ Here is the call graph for this function:

◆ has_header_entry()

bool shammodels::sph::PhantomDump::has_header_entry ( std::string  s) const
inline

Checks if a given string is present in any of the table headers.

Parameters
sthe string to be searched in the table headers
Returns
true if the string is found in any of the table headers, false otherwise

Definition at line 436 of file PhantomDump.hpp.

+ Here is the call graph for this function:

◆ override_magic_number()

void shammodels::sph::PhantomDump::override_magic_number ( )
inline

Overrides the magic numbers used in the PhantomDump struct.

Definition at line 368 of file PhantomDump.hpp.

◆ print_state()

void shammodels::sph::PhantomDump::print_state ( )

Print current state of the data stored in the class.

Definition at line 370 of file PhantomDump.cpp.

◆ read_header_float()

template<class T >
T shammodels::sph::PhantomDump::read_header_float ( std::string  s) const
inline

Retrieves a floating-point value from the table headers.

Parameters
sthe string to be searched in the table headers
Returns
the floating-point value associated with the given string
Exceptions
std::runtime_errorif the entry cannot be found in the table headers

Definition at line 478 of file PhantomDump.hpp.

+ Here is the call graph for this function:

◆ read_header_floats()

template<class T >
std::vector< T > shammodels::sph::PhantomDump::read_header_floats ( std::string  s)
inline

Reads multiple float values from the table headers based on the given string.

Parameters
sthe string to be searched in the table headers
Returns
a vector of float values found in the table headers

Definition at line 506 of file PhantomDump.hpp.

+ Here is the call graph for this function:

◆ read_header_int()

template<class T >
T shammodels::sph::PhantomDump::read_header_int ( std::string  s) const
inline

Retrieves an integer value from the table headers.

Parameters
sthe string to be searched in the table headers
Returns
the integer value associated with the given string
Exceptions
std::runtime_errorif the entry cannot be found in the table headers

Definition at line 528 of file PhantomDump.hpp.

+ Here is the call graph for this function:

◆ read_header_ints()

template<class T >
std::vector< T > shammodels::sph::PhantomDump::read_header_ints ( std::string  s)
inline

Retrieves multiple integer values from the table headers based on the given string.

Parameters
sthe string to be searched in the table headers
Returns
a vector of integer values found in the table headers

Definition at line 562 of file PhantomDump.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ blocks

std::vector<PhantomDumpBlock> shammodels::sph::PhantomDump::blocks

List of blocks in the Phantom dump file.

Definition at line 412 of file PhantomDump.hpp.

◆ fileid

std::string shammodels::sph::PhantomDump::fileid

Magic number used in the phantom dump format.

Definition at line 365 of file PhantomDump.hpp.

◆ i1

fort_int shammodels::sph::PhantomDump::i1

Magic number used in the phantom dump format.

Definition at line 355 of file PhantomDump.hpp.

◆ i2

fort_int shammodels::sph::PhantomDump::i2

Magic number used in the phantom dump format.

Definition at line 357 of file PhantomDump.hpp.

◆ i3

fort_int shammodels::sph::PhantomDump::i3

Magic number used in the phantom dump format.

Definition at line 361 of file PhantomDump.hpp.

◆ iversion

fort_int shammodels::sph::PhantomDump::iversion

Magic number used in the phantom dump format.

Definition at line 359 of file PhantomDump.hpp.

◆ r1

fort_real shammodels::sph::PhantomDump::r1

Magic number used in the phantom dump format.

Definition at line 363 of file PhantomDump.hpp.

◆ table_header_f32

PhantomDumpTableHeader<f32> shammodels::sph::PhantomDump::table_header_f32

Table header for 32-bit floating-point data.

Definition at line 408 of file PhantomDump.hpp.

◆ table_header_f64

PhantomDumpTableHeader<f64> shammodels::sph::PhantomDump::table_header_f64

Table header for 64-bit floating-point data.

Definition at line 410 of file PhantomDump.hpp.

◆ table_header_fort_int

PhantomDumpTableHeader<fort_int> shammodels::sph::PhantomDump::table_header_fort_int

Table header for integer data.

Definition at line 396 of file PhantomDump.hpp.

◆ table_header_fort_real

PhantomDumpTableHeader<fort_real> shammodels::sph::PhantomDump::table_header_fort_real

Table header for floating-point data.

Definition at line 406 of file PhantomDump.hpp.

◆ table_header_i16

PhantomDumpTableHeader<i16> shammodels::sph::PhantomDump::table_header_i16

Table header for signed 16-bit integer data.

Definition at line 400 of file PhantomDump.hpp.

◆ table_header_i32

PhantomDumpTableHeader<i32> shammodels::sph::PhantomDump::table_header_i32

Table header for signed 32-bit integer data.

Definition at line 402 of file PhantomDump.hpp.

◆ table_header_i64

PhantomDumpTableHeader<i64> shammodels::sph::PhantomDump::table_header_i64

Table header for signed 64-bit integer data.

Definition at line 404 of file PhantomDump.hpp.

◆ table_header_i8

PhantomDumpTableHeader<i8> shammodels::sph::PhantomDump::table_header_i8

Table header for signed 8-bit integer data.

Definition at line 398 of file PhantomDump.hpp.


The documentation for this struct was generated from the following files: