Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels::sph::PhantomDumpBlock Struct Reference

A class to represent a single block of data in a Phantom dump. More...

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

Collaboration diagram for shammodels::sph::PhantomDumpBlock:

Public Types

using fort_real = f64
 The type for Phantom's real type.
using fort_int = int
 The type for Phantom's integer type.

Public Member Functions

u64 get_ref_fort_int (std::string s)
 Gets the index of a block of type fort_int with the given name.
u64 get_ref_i8 (std::string s)
 Gets the index of a block of type i8 with the given name.
u64 get_ref_i16 (std::string s)
 Gets the index of a block of type i16 with the given name.
u64 get_ref_i32 (std::string s)
 Gets the index of a block of type i32 with the given name.
u64 get_ref_i64 (std::string s)
 Gets the index of a block of type i64 with the given name.
u64 get_ref_fort_real (std::string s)
 Gets the index of a block of type fort_real with the given name.
u64 get_ref_f32 (std::string s)
 Gets the index of a block of type f32 with the given name.
u64 get_ref_f64 (std::string s)
 Gets the index of a block of type f64 with the given name.
void print_state ()
 Prints the state of the block.
void write (shambase::FortranIOFile &phfile, i64 tot_count, std::array< i32, 8 > numarray)
 Writes a block to a file.
template<class T>
void fill_vec (std::string field_name, std::vector< T > &vec)
 Fills a vector with the values of a given field name.

Static Public Member Functions

static PhantomDumpBlock from_file (shambase::FortranIOFile &phfile, i64 tot_count, std::array< i32, 8 > numarray)
 Reads a block from a file.

Public Attributes

i64 tot_count
 The total number of values in the block.
std::vector< PhantomDumpBlockArray< fort_int > > blocks_fort_int
 The blocks of values of type fort_int.
std::vector< PhantomDumpBlockArray< i8 > > blocks_i8
 The blocks of values of type i8.
std::vector< PhantomDumpBlockArray< i16 > > blocks_i16
 The blocks of values of type i16.
std::vector< PhantomDumpBlockArray< i32 > > blocks_i32
 The blocks of values of type i32.
std::vector< PhantomDumpBlockArray< i64 > > blocks_i64
 The blocks of values of type i64.
std::vector< PhantomDumpBlockArray< fort_real > > blocks_fort_real
 The blocks of values of type fort_real.
std::vector< PhantomDumpBlockArray< f32 > > blocks_f32
 The blocks of values of type f32.
std::vector< PhantomDumpBlockArray< f64 > > blocks_f64
 The blocks of values of type f64.

Detailed Description

A class to represent a single block of data in a Phantom dump.

Template Parameters
TThe type of the values in the block.

Definition at line 185 of file PhantomDump.hpp.

Member Typedef Documentation

◆ fort_int

The type for Phantom's integer type.

Definition at line 192 of file PhantomDump.hpp.

◆ fort_real

The type for Phantom's real type.

Definition at line 190 of file PhantomDump.hpp.

Member Function Documentation

◆ fill_vec()

template<class T>
void shammodels::sph::PhantomDumpBlock::fill_vec ( std::string field_name,
std::vector< T > & vec )
inline

Fills a vector with the values of a given field name.

Parameters
field_namethe name of the field to look for
vecthe vector to fill

Definition at line 307 of file PhantomDump.hpp.

◆ from_file()

shammodels::sph::PhantomDumpBlock shammodels::sph::PhantomDumpBlock::from_file ( shambase::FortranIOFile & phfile,
i64 tot_count,
std::array< i32, 8 > numarray )
static

Reads a block from a file.

Parameters
phfilethe file to read from
tot_countthe total number of values to read
numarraythe number of values of each type
Returns
the block that was read

Definition at line 153 of file PhantomDump.cpp.

Here is the call graph for this function:

◆ get_ref_f32()

u64 shammodels::sph::PhantomDumpBlock::get_ref_f32 ( std::string s)

Gets the index of a block of type f32 with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

Definition at line 243 of file PhantomDump.cpp.

◆ get_ref_f64()

u64 shammodels::sph::PhantomDumpBlock::get_ref_f64 ( std::string s)

Gets the index of a block of type f64 with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

◆ get_ref_fort_int()

u64 shammodels::sph::PhantomDumpBlock::get_ref_fort_int ( std::string s)

Gets the index of a block of type fort_int with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

◆ get_ref_fort_real()

u64 shammodels::sph::PhantomDumpBlock::get_ref_fort_real ( std::string s)

Gets the index of a block of type fort_real with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

Definition at line 219 of file PhantomDump.cpp.

◆ get_ref_i16()

u64 shammodels::sph::PhantomDumpBlock::get_ref_i16 ( std::string s)

Gets the index of a block of type i16 with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

◆ get_ref_i32()

u64 shammodels::sph::PhantomDumpBlock::get_ref_i32 ( std::string s)

Gets the index of a block of type i32 with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

◆ get_ref_i64()

u64 shammodels::sph::PhantomDumpBlock::get_ref_i64 ( std::string s)

Gets the index of a block of type i64 with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

◆ get_ref_i8()

u64 shammodels::sph::PhantomDumpBlock::get_ref_i8 ( std::string s)

Gets the index of a block of type i8 with the given name.

Parameters
sThe name of the block to search for.
Returns
The index of the block in the vector, or 0 if no such block exists.

◆ print_state()

void shammodels::sph::PhantomDumpBlock::print_state ( )

Prints the state of the block.

Definition at line 117 of file PhantomDump.cpp.

◆ write()

void shammodels::sph::PhantomDumpBlock::write ( shambase::FortranIOFile & phfile,
i64 tot_count,
std::array< i32, 8 > numarray )

Writes a block to a file.

Parameters
phfilethe file to write to
tot_countthe total number of values to write
numarraythe number of values of each type

Definition at line 189 of file PhantomDump.cpp.

Member Data Documentation

◆ blocks_f32

std::vector<PhantomDumpBlockArray<f32> > shammodels::sph::PhantomDumpBlock::blocks_f32

The blocks of values of type f32.

Definition at line 207 of file PhantomDump.hpp.

◆ blocks_f64

std::vector<PhantomDumpBlockArray<f64> > shammodels::sph::PhantomDumpBlock::blocks_f64

The blocks of values of type f64.

Definition at line 209 of file PhantomDump.hpp.

◆ blocks_fort_int

std::vector<PhantomDumpBlockArray<fort_int> > shammodels::sph::PhantomDumpBlock::blocks_fort_int

The blocks of values of type fort_int.

Definition at line 195 of file PhantomDump.hpp.

◆ blocks_fort_real

std::vector<PhantomDumpBlockArray<fort_real> > shammodels::sph::PhantomDumpBlock::blocks_fort_real

The blocks of values of type fort_real.

Definition at line 205 of file PhantomDump.hpp.

◆ blocks_i16

std::vector<PhantomDumpBlockArray<i16> > shammodels::sph::PhantomDumpBlock::blocks_i16

The blocks of values of type i16.

Definition at line 199 of file PhantomDump.hpp.

◆ blocks_i32

std::vector<PhantomDumpBlockArray<i32> > shammodels::sph::PhantomDumpBlock::blocks_i32

The blocks of values of type i32.

Definition at line 201 of file PhantomDump.hpp.

◆ blocks_i64

std::vector<PhantomDumpBlockArray<i64> > shammodels::sph::PhantomDumpBlock::blocks_i64

The blocks of values of type i64.

Definition at line 203 of file PhantomDump.hpp.

◆ blocks_i8

std::vector<PhantomDumpBlockArray<i8> > shammodels::sph::PhantomDumpBlock::blocks_i8

The blocks of values of type i8.

Definition at line 197 of file PhantomDump.hpp.

◆ tot_count

i64 shammodels::sph::PhantomDumpBlock::tot_count

The total number of values in the block.

Definition at line 187 of file PhantomDump.hpp.


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