Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TextAttrRecorder Class Reference

#include <AttrRecorderInterface.h>

Inheritance diagram for TextAttrRecorder:
Inheritance graph
[legend]
Collaboration diagram for TextAttrRecorder:
Collaboration graph
[legend]

Public Member Functions

 TextAttrRecorder (std::FILE *fp)
 
void ensure_closed ()
 
void record_arr (const char *name, const double *arr, int length) override
 
void record_arr (const char *name, const int *arr, int length) override
 
void record_arr (const char *name, const long *arr, int length) override
 
void record (const char *name, const char *val) override
 
void record (const char *name, double val) override
 
void record (const char *name, int val) override
 
void record (const char *name, long val) override
 
- Public Member Functions inherited from AttrRecorderInterface
void record_triple (const char *name, double a, double b, double c)
 
void record_triple (const char *name, int a, int b, int c)
 

Detailed Description

Provides a nice wrapper around an text file pointer for the purpose of recording attributes

We intentionally target TOML Formatting so that users can use a toml parser (like python's built-in tomllib module) to read in the header values. Users would do that that for all contents between BEGIN-HEADER and END-HEADER.

Note
Rather than having this simply be an ephemeral class that temporarily wraps a previously created std::FILE pointer, it might be more robust if this was slightly extended so that this wrapped all operations related to serializing simulation data to a text file.
  • this change would involve moving a bunch of logic from Write_Grid_Text_ into a method of this class and renaming this class to something like TextRecorder
  • the benefit of this change is we wouldn't need to worry about explictly calling this class's ensure_closed method

Member Function Documentation

◆ ensure_closed()

void TextAttrRecorder::ensure_closed ( )
inline

Ensure this attribute recorder is closed.

This is needed for the text header recorder (rather than simply handling this stuff in the destructor) because:

  1. we enclose the header header information b/t BEGIN-HEADER and END-HEADER
  2. we need to make sure we write END-HEADER before we start writing actual field data and the we may not have the control over exactly when the descructor runs

◆ record() [1/4]

void TextAttrRecorder::record ( const char *  name,
const char *  val 
)
inlineoverridevirtual

record a scalar attribute

Implements AttrRecorderInterface.

◆ record() [2/4]

void TextAttrRecorder::record ( const char *  name,
double  val 
)
inlineoverridevirtual

Implements AttrRecorderInterface.

◆ record() [3/4]

void TextAttrRecorder::record ( const char *  name,
int  val 
)
inlineoverridevirtual

Implements AttrRecorderInterface.

◆ record() [4/4]

void TextAttrRecorder::record ( const char *  name,
long  val 
)
inlineoverridevirtual

Implements AttrRecorderInterface.

◆ record_arr() [1/3]

void TextAttrRecorder::record_arr ( const char *  name,
const double *  arr,
int  length 
)
inlineoverridevirtual

record a 1d array of values

Implements AttrRecorderInterface.

◆ record_arr() [2/3]

void TextAttrRecorder::record_arr ( const char *  name,
const int *  arr,
int  length 
)
inlineoverridevirtual

Implements AttrRecorderInterface.

◆ record_arr() [3/3]

void TextAttrRecorder::record_arr ( const char *  name,
const long *  arr,
int  length 
)
inlineoverridevirtual

Implements AttrRecorderInterface.


The documentation for this class was generated from the following file: