DOLFINx 0.9.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 { 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 (std::string row, std::string col, std::variant< std::string, int, double > value)
 
std::variant< std::string, int, double > get (std::string row, 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
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 ( std::string row,
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 ( std::string row,
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: