FML
Namespaces | Data Structures | Typedefs | Functions
FML::UTILS Namespace Reference

This namespace contains useful things that don't fit anywhere else. More...

Namespaces

namespace  Matplotlib
 Make plots with matplotlib from within C++.
 

Data Structures

class  ConstantsAndUnits
 Class for dealing with physical units. More...
 
class  ParameterMap
 For holding a map of parameters of different types with easy set and get's allowing for fiducial values if the parameter is not in the map. More...
 
class  Timings
 Class for performing timings of the code using std::chrono. More...
 

Typedefs

using ParameterTypes = std::variant< bool, int, double, std::string, std::vector< int >, std::vector< double >, std::vector< std::string > >
 All the types we can have in the parameter file: string, int, boolean, double and vectors of double and ints Can be extended if needed. More...
 
using TimePoint = std::chrono::time_point< std::chrono::steady_clock >
 

Functions

std::ostream & operator<< (std::ostream &s, std::vector< double > const &v)
 
std::ostream & operator<< (std::ostream &s, std::vector< int > const &v)
 
std::ostream & operator<< (std::ostream &s, std::vector< std::string > const &v)
 
template std::string ParameterMap::get< std::string > (std::string) const
 
template std::vector< double > ParameterMap::get< std::vector< double > > (std::string) const
 
template std::vector< int > ParameterMap::get< std::vector< int > > (std::string) const
 
template std::string ParameterMap::get< std::string > (std::string, std::string) const
 
template std::vector< double > ParameterMap::get< std::vector< double > > (std::string, std::vector< double >) const
 
template std::vector< int > ParameterMap::get< std::vector< int > > (std::string, std::vector< int >) const
 
template<typename T0 , typename... Ts>
std::ostream & operator<< (std::ostream &s, std::variant< T0, Ts... > const &v)
 cout for a variant More...
 

Detailed Description

This namespace contains useful things that don't fit anywhere else.

Typedef Documentation

◆ ParameterTypes

using FML::UTILS::ParameterTypes = typedef std::variant<bool, int, double, std::string, std::vector<int>, std::vector<double>, std::vector<std::string> >

All the types we can have in the parameter file: string, int, boolean, double and vectors of double and ints Can be extended if needed.

Only thing that is required is that the type you add have a cout-overload for printing the value

Definition at line 28 of file ParameterMap.h.

◆ TimePoint

using FML::UTILS::TimePoint = typedef std::chrono::time_point<std::chrono::steady_clock>

Definition at line 19 of file Timings.h.

Function Documentation

◆ operator<<() [1/4]

template<typename T0 , typename... Ts>
std::ostream & FML::UTILS::operator<< ( std::ostream &  s,
std::variant< T0, Ts... > const &  v 
)

cout for a variant

Definition at line 20 of file ParameterMap.h.

20 {
21 std::visit([&](auto && arg) { s << arg; }, v);
22 return s;
23 }

◆ operator<<() [2/4]

std::ostream & FML::UTILS::operator<< ( std::ostream &  s,
std::vector< double > const &  v 
)

Definition at line 6 of file ParameterMap.cpp.

6 {
7 s << "[";
8 for (auto & e : v)
9 s << e << " ";
10 s << "]";
11 return s;
12 }

◆ operator<<() [3/4]

std::ostream & FML::UTILS::operator<< ( std::ostream &  s,
std::vector< int > const &  v 
)

Definition at line 14 of file ParameterMap.cpp.

14 {
15 s << "[";
16 for (auto & e : v)
17 s << e << " ";
18 s << "]";
19 return s;
20 }

◆ operator<<() [4/4]

std::ostream & FML::UTILS::operator<< ( std::ostream &  s,
std::vector< std::string > const &  v 
)

Definition at line 22 of file ParameterMap.cpp.

22 {
23 s << "[";
24 for (auto & e : v)
25 s << e << " ";
26 s << "]";
27 return s;
28 }

◆ ParameterMap::get< std::string >() [1/2]

template std::string FML::UTILS::ParameterMap::get< std::string > ( std::string  ) const

◆ ParameterMap::get< std::string >() [2/2]

template std::string FML::UTILS::ParameterMap::get< std::string > ( std::string  ,
std::string   
) const

◆ ParameterMap::get< std::vector< double > >() [1/2]

template std::vector< double > FML::UTILS::ParameterMap::get< std::vector< double > > ( std::string  ) const

◆ ParameterMap::get< std::vector< double > >() [2/2]

template std::vector< double > FML::UTILS::ParameterMap::get< std::vector< double > > ( std::string  ,
std::vector< double >   
) const

◆ ParameterMap::get< std::vector< int > >() [1/2]

template std::vector< int > FML::UTILS::ParameterMap::get< std::vector< int > > ( std::string  ) const

◆ ParameterMap::get< std::vector< int > >() [2/2]

template std::vector< int > FML::UTILS::ParameterMap::get< std::vector< int > > ( std::string  ,
std::vector< int >   
) const