iMSTK
Interactive Medical Simulation Toolkit
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
imstk::DataTracker Class Reference

Store time based data to write to a file. More...

#include <imstkDataTracker.h>

Classes

struct  Element
 
struct  ePhysics
 Common data values to track. More...
 
struct  Physics
 Header names of the common data values to track. More...
 

Public Types

enum  eDecimalFormat_Type { SystemFormatting = 0, DefaultFloat, FixedMantissa, SignificantDigits }
 C++ I/O manipulation flags.
 

Public Member Functions

void useTabDelimiter ()
 
void useCommaDelimiter ()
 
void setFilename (const std::string &fn)
 
StopWatchgetStopWatch (int idx)
 An available timer for each data item tracked.
 
void probe (int idx, double value)
 Track a data value associated with a header id. More...
 
int probe (const std::string &name, double value)
 Track a data value associated with a header string. More...
 
void probeElapsedTime_s (int idx)
 Track a time duration associated with a header. More...
 
int configureProbe (const std::string &name, std::streamsize precision=3, eDecimalFormat_Type notation=eDecimalFormat_Type::SystemFormatting)
 Create and configure a probe and how it is written to file. More...
 
int configureProbe (const std::string &name, int index, std::streamsize precision=6, eDecimalFormat_Type notation=eDecimalFormat_Type::SystemFormatting)
 Create and configure a probe and how it is written to file. More...
 
double getValue (int idx)
 
double getValue (const std::string &name)
 
std::string getName (int idx)
 
void streamProbesToFile (double time)
 Write the current probe values to a row in the data file. More...
 

Protected Member Functions

void createFile ()
 
ElementgetElement (int idx)
 
ElementgetElement (std::string const &name)
 

Protected Attributes

std::string m_filename
 
char m_delimiter
 
std::vector< Elementm_elements
 
std::ofstream m_file
 
std::map< int, StopWatchm_timers
 
int m_nextIndex
 

Detailed Description

Store time based data to write to a file.

Definition at line 24 of file imstkDataTracker.h.

Member Function Documentation

◆ configureProbe() [1/2]

int imstk::DataTracker::configureProbe ( const std::string &  name,
std::streamsize  precision = 3,
eDecimalFormat_Type  notation = eDecimalFormat_Type::SystemFormatting 
)

Create and configure a probe and how it is written to file.

Parameters
headername
C++precision
C++I/O manipulation type
Returns
ID of the probe created

Definition at line 28 of file imstkDataTracker.cpp.

◆ configureProbe() [2/2]

int imstk::DataTracker::configureProbe ( const std::string &  name,
int  index,
std::streamsize  precision = 6,
eDecimalFormat_Type  notation = eDecimalFormat_Type::SystemFormatting 
)

Create and configure a probe and how it is written to file.

Parameters
IDof the header added
IndexID to associate with this header Note, if you are going to mix probing via index and name, use a negative number, as auto indexing uses positive
C++precision
C++I/O manipulation type
Returns
ID of the probe created, should be the same as the index provided

Definition at line 37 of file imstkDataTracker.cpp.

◆ probe() [1/2]

void imstk::DataTracker::probe ( int  idx,
double  value 
)

Track a data value associated with a header id.

Parameters
IDof the header to add to, This is the ID returned from configureProbe
valueto track

Definition at line 55 of file imstkDataTracker.cpp.

◆ probe() [2/2]

int imstk::DataTracker::probe ( const std::string &  name,
double  value 
)

Track a data value associated with a header string.

Parameters
Stringof the header to add to
valueto track
Returns
the idx ID for this header string

Definition at line 47 of file imstkDataTracker.cpp.

◆ probeElapsedTime_s()

void imstk::DataTracker::probeElapsedTime_s ( int  idx)

Track a time duration associated with a header.

Parameters
IDof the header to add to, This is the ID returned from configureProbe

Definition at line 62 of file imstkDataTracker.cpp.

Here is the call graph for this function:

◆ streamProbesToFile()

void imstk::DataTracker::streamProbesToFile ( double  time)

Write the current probe values to a row in the data file.

Parameters
Currentsimulation time

Definition at line 152 of file imstkDataTracker.cpp.


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