DOLFINx 0.10.0.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
Table Class Reference

This class provides storage and pretty-printing for tables. More...

#include <Table.h>

Public Types

enum class  Reduction : std::uint8_t { average , max , min }

Public Member Functions

 Table (std::string title="", bool right_justify=true)
 Create empty table.
 Table (const Table &table)=default
 Copy constructor.
 Table (Table &&table)=default
 Move constructor.
 ~Table ()=default
 Destructor.
Tableoperator= (const Table &table)=default
 Assignment operator.
Tableoperator= (Table &&table)=default
 Move assignment.
void set (const std::string &row, const std::string &col, std::variant< std::string, int, double > value)
std::variant< std::string, int, double > get (const std::string &row, const std::string &col) const
Table reduce (MPI_Comm comm, Reduction reduction) const
std::string str () const
 Return string representation of the table.

Public Attributes

std::string name
 Table name.

Detailed Description

This class provides storage and pretty-printing for tables.

Example usage:

Table table("Timings"); table.set("Foo", "Assemble", 0.010); table.set("Foo", "Solve", 0.020); table.set("Bar", "Assemble", 0.011); table.set("Bar", "Solve", 0.019);

Member Enumeration Documentation

◆ Reduction

enum class Reduction : std::uint8_t
strong

Types of MPI reduction available for Table, to get the max, min or average values over an MPI_Comm

Member Function Documentation

◆ get()

std::variant< std::string, int, double > get ( const std::string & row,
const std::string & col ) const

Get value of table entry

Parameters
[in]rowRow name
[in]colColumn name
Returns
Returns the entry for requested row and columns

◆ reduce()

Table reduce ( MPI_Comm comm,
Table::Reduction reduction ) const

Do MPI reduction on Table

Parameters
[in]commMPI communicator
[in]reductionType of reduction to perform
Returns
Reduced Table

◆ set()

void set ( const std::string & row,
const std::string & col,
std::variant< std::string, int, double > value )

Set table entry

Parameters
[in]rowRow name
[in]colColumn name
[in]valueThe value to set

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