SAMRAI::tbox::Statistic Class Reference

#include <source/toolbox/timers/Statistic.h>

Inheritance diagram for SAMRAI::tbox::Statistic:

Inheritance graph
[legend]
List of all members.

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

Friends

class Statistician

Classes

struct  PatchStat
struct  PatchStatRecord
struct  ProcStat

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


Constructor & Destructor Documentation

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

Virtual destructor destroys recorded object data.

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.


Member Function Documentation

std::string SAMRAI::tbox::Statistic::getName (  )  const [inline]

Return string name identifier for statistic object.

std::string SAMRAI::tbox::Statistic::getType (  )  const [inline]

Return string statistic type identifier for statistic object.

int SAMRAI::tbox::Statistic::getInstanceId (  )  const [inline]

Return integer instance identifier for statistic object.

int SAMRAI::tbox::Statistic::getStatSequenceLength (  )  const [inline]

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.

void SAMRAI::tbox::Statistic::reset (  )  [inline]

Reset the state of the statistic information.

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.

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.

bool SAMRAI::tbox::Statistic::canEstimateDataStreamSize (  )  [inline]

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.

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.

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

Pack contents of statistic data structure into message stream.

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

Unpack contents of statistic data structure from message stream.

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).

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.

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.

const Array< Statistic::ProcStat > & SAMRAI::tbox::Statistic::getProcStatSeqArray (  )  const [inline, protected]

Return const reference to list of processor records.

const Array< Statistic::PatchStat > & SAMRAI::tbox::Statistic::getPatchStatSeqArray (  )  const [inline, protected]

Return const reference to list of patch records.


Friends And Related Function Documentation

friend class Statistician [friend]


The documentation for this class was generated from the following files:
Generated on Thu Jun 18 11:29:08 2009 for SAMRAI by  doxygen 1.5.1