IBAMR  IBAMR version 0.19.
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
SAMRAI::tbox::Statistic Class Reference

#include <tbox/Statistic.h>

Inheritance diagram for SAMRAI::tbox::Statistic:
Inheritance graph
[legend]

Classes

struct  PatchStat
 
struct  PatchStatRecord
 
struct  ProcStat
 

Public Member Functions

virtual ~Statistic ()
 
std::string getName () const
 
std::string getType () const
 
int getInstanceId () const
 
int getStatSequenceLength () const
 
void reset ()
 
void recordProcStat (double value, int seq_num=-1)
 
void recordPatchStat (int patch_num, double value, int seq_num)
 
bool canEstimateDataStreamSize ()
 
int getDataStreamSize ()
 
void packStream (AbstractStream &stream)
 
void unpackStream (AbstractStream &stream)
 
virtual void printClassData (std::ostream &stream, int precision=12) const
 
virtual void putToDatabase (Pointer< Database > db)
 
virtual void getFromRestart (Pointer< Database > db)
 

Protected Member Functions

 Statistic (const std::string &name, const std::string &stat_type, int instance_id)
 
const Array< Statistic::ProcStat > & getProcStatSeqArray () const
 
const Array< Statistic::PatchStat > & getPatchStatSeqArray () const
 

Private Types

enum  STATISTIC_RECORD_TYPE { PROC_STAT = 0, PATCH_STAT = 1 }
 

Private Member Functions

void checkArraySizes (int seq_num)
 
 Statistic (const Statistic &)
 
void operator= (const Statistic &)
 

Private Attributes

std::string d_object_name
 
int d_instance_id
 
int d_stat_type
 
Array< Statistic::ProcStatd_proc_array
 
Array< Statistic::PatchStatd_patch_array
 
int d_seq_counter
 
int d_total_patch_entries
 
int d_proc_stat_array_size
 
int d_patch_stat_array_size
 

Static Private Attributes

static double s_empty_seq_tag_entry
 

Friends

class Statistician
 

Detailed Description

Class Statistic defines a simple object that can be used to record information generated during the course of a simulation for post- processing later. Each statistic object is created by the singleton Statistian object and is defined by a name string identifier and is characterized by the sort of information it may record. Depending on how the object is created, it may record processor information (i.e., a separate value for each processor), or patch information (i.e., a separate value for each patch on each processor). An example of the former may be the total number of cells on each processor. An example of the second may be the number of cells on each patch. Each recorded data item may be any numerical value, but it will always be stored as a double for simplicity. The string identifier for a processor stat is "PROC_STAT" and the string identifier for a patch stat is "PATCH_STAT".

An example use of a Statistic to record the number of gridcells on each processor is as follows:

Pointer<Statistic> stat_num_gridcells = Statistician::getStatistician()-> getStatistic("NumberGridcells", "PROC_STAT"); ... stat_num_gridcells->recordProcStat(num_cells_on_proc); ...

The type of the statistic restricts the way in which the statistic object may be used to record information. For a "processor" stat only the recordProcStat() functions can be used. For a "patch" stat only the recordPatchStat() functions can be used.

Typically, the information is recorded to generate a time sequence of values. But this need not be the case always. An optional time stamp may be provided for each value as it is recorded. In any case, the sequence order of the values is determined by the recording order.

Also, the Statistician class is used to manage Statistic objects. It provided a global point of access for creating and accessing statistic objects and supports post-processing statistic information in parallel.

In some cases, it may be desirable to record information for each level in a calculation; e.g., the number of cells on each processor on level zero, level 1, etc. In this case, one can cimply create a separate statistic object for each level.

See also
tbox::Statistician

Member Enumeration Documentation

◆ STATISTIC_RECORD_TYPE

Enumerator
PROC_STAT 
PATCH_STAT 

Constructor & Destructor Documentation

◆ ~Statistic()

virtual SAMRAI::tbox::Statistic::~Statistic ( )
virtual

Virtual destructor destroys recorded object data.

◆ Statistic() [1/2]

SAMRAI::tbox::Statistic::Statistic ( const std::string &  name,
const std::string &  stat_type,
int  instance_id 
)
protected

The constructor for the Statistic class sets the name string and the statistic type for a statistic object.

◆ Statistic() [2/2]

SAMRAI::tbox::Statistic::Statistic ( const Statistic )
private

Member Function Documentation

◆ getName()

std::string SAMRAI::tbox::Statistic::getName ( ) const

Return string name identifier for statistic object.

◆ getType()

std::string SAMRAI::tbox::Statistic::getType ( ) const

Return string statistic type identifier for statistic object.

◆ getInstanceId()

int SAMRAI::tbox::Statistic::getInstanceId ( ) const

Return integer instance identifier for statistic object.

◆ getStatSequenceLength()

int SAMRAI::tbox::Statistic::getStatSequenceLength ( ) const

Return integer length of list of statistic sequence records. This value is either the length of the processor statistic list or the patch statistic list, whichever corresponds to the statistic type.

◆ reset()

void SAMRAI::tbox::Statistic::reset ( )

Reset the state of the statistic information.

◆ recordProcStat()

void SAMRAI::tbox::Statistic::recordProcStat ( double  value,
int  seq_num = -1 
)

Record double processor statistic value. The optional sequence number argument identifies where in timestep sequence the value should be. If the sequence number is not specified, an internal counter will determine the appropriate sequence number. When assertion checking is active, an unrecoverable exception will result if this function is called and "PATCH_STAT" was specified in the constructor.

◆ recordPatchStat()

void SAMRAI::tbox::Statistic::recordPatchStat ( int  patch_num,
double  value,
int  seq_num 
)

Record double patch statistic value. The patch number refers to the global patch number on a level. The sequence number argument identifies where in timestep sequence the value should be. The sequence number MUST be explicitly specified because the number of patches on each processor will generally be different at each sequence step. When assertion checking is active, an unrecoverable exception will result if this function is called and "PROC_STAT" was specified in the constructor.

◆ canEstimateDataStreamSize()

bool SAMRAI::tbox::Statistic::canEstimateDataStreamSize ( )

Return true if size of stream required to pack all statistic data can be determined for all processors without exchanging any details of structure of statistic data. Otherwise, return false.

◆ getDataStreamSize()

int SAMRAI::tbox::Statistic::getDataStreamSize ( )

Return integer number of bytes needed to stream the statistic data. This is the amount needed by the stat transaction class.

◆ packStream()

void SAMRAI::tbox::Statistic::packStream ( AbstractStream stream)

Pack contents of statistic data structure into message stream.

◆ unpackStream()

void SAMRAI::tbox::Statistic::unpackStream ( AbstractStream stream)

Unpack contents of statistic data structure from message stream.

◆ printClassData()

virtual void SAMRAI::tbox::Statistic::printClassData ( std::ostream &  stream,
int  precision = 12 
) const
virtual

Print statistic data to given output stream. Floating point precision can be specified (default is 12).

◆ putToDatabase()

virtual void SAMRAI::tbox::Statistic::putToDatabase ( Pointer< Database db)
virtual

Write statistic data members to database. When assertion checking is on, the database pointer must be non-null.

◆ getFromRestart()

virtual void SAMRAI::tbox::Statistic::getFromRestart ( Pointer< Database db)
virtual

Read restarted times from restart database. When assertion checking is on, the database pointer must be non-null.

◆ getProcStatSeqArray()

const Array<Statistic::ProcStat>& SAMRAI::tbox::Statistic::getProcStatSeqArray ( ) const
protected

Return const reference to list of processor records.

◆ getPatchStatSeqArray()

const Array<Statistic::PatchStat>& SAMRAI::tbox::Statistic::getPatchStatSeqArray ( ) const
protected

Return const reference to list of patch records.

◆ checkArraySizes()

void SAMRAI::tbox::Statistic::checkArraySizes ( int  seq_num)
private

◆ operator=()

void SAMRAI::tbox::Statistic::operator= ( const Statistic )
private

Friends And Related Function Documentation

◆ Statistician

friend class Statistician
friend

Member Data Documentation

◆ s_empty_seq_tag_entry

double SAMRAI::tbox::Statistic::s_empty_seq_tag_entry
staticprivate

◆ d_object_name

std::string SAMRAI::tbox::Statistic::d_object_name
private

◆ d_instance_id

int SAMRAI::tbox::Statistic::d_instance_id
private

◆ d_stat_type

int SAMRAI::tbox::Statistic::d_stat_type
private

◆ d_proc_array

Array<Statistic::ProcStat> SAMRAI::tbox::Statistic::d_proc_array
private

◆ d_patch_array

Array<Statistic::PatchStat> SAMRAI::tbox::Statistic::d_patch_array
private

◆ d_seq_counter

int SAMRAI::tbox::Statistic::d_seq_counter
private

◆ d_total_patch_entries

int SAMRAI::tbox::Statistic::d_total_patch_entries
private

◆ d_proc_stat_array_size

int SAMRAI::tbox::Statistic::d_proc_stat_array_size
private

◆ d_patch_stat_array_size

int SAMRAI::tbox::Statistic::d_patch_stat_array_size
private

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