Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
shammodels::sph::PhantomDumpTableHeader< T > Struct Template Reference

Phantom dump table header for a specific type. More...

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

+ Collaboration diagram for shammodels::sph::PhantomDumpTableHeader< T >:

Public Member Functions

void add (std::string s, T val)
 Adds an entry to the header.
 
void write (shambase::FortranIOFile &phfile)
 Writes the header to a Phantom dump file.
 
std::optional< T > fetch (std::string s) const
 Fetches the value of a given entry from the header.
 
template<class Tb >
void fetch_multiple (std::vector< Tb > &vec, std::string s)
 Fetches the values of all entries with a given name from the header into the supplied vector.
 
void print_state ()
 Prints the state of the header.
 
template<class Tconv >
void add_to_map (std::unordered_map< std::string, Tconv > &map)
 

Static Public Member Functions

static PhantomDumpTableHeader< T > from_file (shambase::FortranIOFile &phfile)
 Reads the header from a Phantom dump file.
 

Public Attributes

std::vector< std::pair< std::string, T > > entries
 A vector of pairs containing the name and the value of each entry in the table.
 

Detailed Description

template<class T>
struct shammodels::sph::PhantomDumpTableHeader< T >

Phantom dump table header for a specific type.

This class is used to store the header of a Phantom dump file for one type.

Template Parameters
Ttype of the data

Definition at line 41 of file PhantomDump.hpp.

Member Function Documentation

◆ add()

template<class T >
void shammodels::sph::PhantomDumpTableHeader< T >::add ( std::string  s,
val 
)
inline

Adds an entry to the header.

Parameters
sthe name of the entry
valthe value of the entry

Definition at line 62 of file PhantomDump.hpp.

◆ add_to_map()

template<class T >
template<class Tconv >
void shammodels::sph::PhantomDumpTableHeader< T >::add_to_map ( std::unordered_map< std::string, Tconv > &  map)
inline

Definition at line 114 of file PhantomDump.hpp.

◆ fetch()

template<class T >
std::optional< T > shammodels::sph::PhantomDumpTableHeader< T >::fetch ( std::string  s) const
inline

Fetches the value of a given entry from the header.

Parameters
sthe name of the entry
Returns
the value of the entry

Definition at line 80 of file PhantomDump.hpp.

◆ fetch_multiple()

template<class T >
template<class Tb >
void shammodels::sph::PhantomDumpTableHeader< T >::fetch_multiple ( std::vector< Tb > &  vec,
std::string  s 
)
inline

Fetches the values of all entries with a given name from the header into the supplied vector.

Parameters
vecthe vector to store the values in
sthe name of the entries

Definition at line 100 of file PhantomDump.hpp.

◆ from_file()

Reads the header from a Phantom dump file.

Parameters
phfilethe file to read from
Returns
the header

Definition at line 59 of file PhantomDump.cpp.

+ Here is the call graph for this function:

◆ print_state()

template<class T >
void shammodels::sph::PhantomDumpTableHeader< T >::print_state ( )

Prints the state of the header.

Definition at line 110 of file PhantomDump.cpp.

◆ write()

template<class T >
void shammodels::sph::PhantomDumpTableHeader< T >::write ( shambase::FortranIOFile phfile)

Writes the header to a Phantom dump file.

Parameters
phfilethe file to write to

Definition at line 87 of file PhantomDump.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ entries

template<class T >
std::vector<std::pair<std::string, T> > shammodels::sph::PhantomDumpTableHeader< T >::entries

A vector of pairs containing the name and the value of each entry in the table.

Definition at line 46 of file PhantomDump.hpp.


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