Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/db/d97/classdolfinx_1_1Table.html
DOLFINx  0.5.1
DOLFINx C++ interface
Public Types | Public Member Functions | Public Attributes | List of all members
Table Class Reference

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

#include <Table.h>

Public Types

enum class  Reduction { average , max , min }
 Types of MPI reduction available for Table, to get the max, min or average values over an MPI_Comm.
 

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)
 Set table entry. More...
 
std::variant< std::string, int, double > get (std::string row, std::string col) const
 Get value of table entry. More...
 
Table reduce (MPI_Comm comm, Reduction reduction) const
 Do MPI reduction on Table. More...
 
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 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: