dynLattice
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
CSVDataPrinter Class Reference

CSV data printer for simulation output. More...

#include "CSVDataPrinter.h"

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

Public Types

enum  mode { EMPTY , TABLES , VECTORS , SPARSEVECTORS }
 Output mode enumeration for CSV printer state. More...
 

Public Member Functions

 CSVDataPrinter (const String &name="CSVDataPrinter")
 Constructs a new CSVDataPrinter object.
 
virtual void printTable (Output &out, const String &label, const Table &table, const Properties &globdat) override
 Print table data in CSV format with timestamps.
 
virtual void printVector (Output &out, const String &label, const Vector &vec, const DofSpace &dofs, const Properties &globdat) override
 Print vector data in CSV format with DOF information.
 
virtual void printSparseVector (Output &out, const String &label, const Vector &vec, const IdxVector &idofs, const DofSpace &dofs, const Properties &globdat) override
 Print sparse vector data in CSV format.
 

Protected Member Functions

virtual ~CSVDataPrinter ()
 

Detailed Description

Extends the standard DataPrinter to output data in CSV format with timestamps. Supports three output modes: tables, vectors, and sparse vectors. Once a mode is set for an instance, it cannot be changed during the simulation.

Usage

The printer automatically detects output mode from first print call:

Author
Til Gärtner
See also
jive::app::DataPrinter

Member Enumeration Documentation

◆ mode

Enumerator
EMPTY 

No output mode set yet.

TABLES 

Table output mode active.

VECTORS 

Vector output mode active.

SPARSEVECTORS 

Sparse vector output mode active.

Constructor & Destructor Documentation

◆ CSVDataPrinter()

CSVDataPrinter::CSVDataPrinter ( const String &  name = "CSVDataPrinter")
explicit
Parameters
[in]nameName of the data printer instance for identification

◆ ~CSVDataPrinter()

CSVDataPrinter::~CSVDataPrinter ( )
protectedvirtual

Member Function Documentation

◆ printSparseVector()

void CSVDataPrinter::printSparseVector ( Output &  out,
const String &  label,
const Vector &  vec,
const IdxVector &  idofs,
const DofSpace &  dofs,
const Properties &  globdat 
)
overridevirtual

Similar to printVector but handles sparse data with specified DOF indices. Sets printer mode to SPARSEVECTORS on first call.

Parameters
[in]outOutput stream for CSV data
[in]labelData label for identification
[in]vecVector containing sparse data to print
[in]idofsDOF indices for sparse vector entries
[in]dofsDegree of freedom space for context
[in]globdatGlobal data properties with simulation context

◆ printTable()

void CSVDataPrinter::printTable ( Output &  out,
const String &  label,
const Table &  table,
const Properties &  globdat 
)
overridevirtual

Sets printer mode to TABLES on first call. All subsequent calls must be to printTable() or an exception will be thrown.

Parameters
[in]outOutput stream for CSV data
[in]labelData label for identification
[in]tableTable containing data to print
[in]globdatGlobal data properties with simulation context

◆ printVector()

void CSVDataPrinter::printVector ( Output &  out,
const String &  label,
const Vector &  vec,
const DofSpace &  dofs,
const Properties &  globdat 
)
overridevirtual

Sets printer mode to VECTORS on first call. Cannot be mixed with table output.

Parameters
[in]outOutput stream for CSV data
[in]labelData label for identification
[in]vecVector containing data to print
[in]dofsDegree of freedom space for context
[in]globdatGlobal data properties with simulation context