Hex  1.0
Hydrogen-electron collision solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Static Public Member Functions
Preconditioners Class Reference

Preconditioner traits. More...

#include <preconditioners.h>

Public Types

typedef std::tuple
< ILUCGPreconditioner,
NoPreconditioner,
CGPreconditioner,
JacobiCGPreconditioner,
GPUCGPreconditioner,
SSORCGPreconditioner
AvailableTypes
 List of available preconditioners. More...
 

Static Public Member Functions

static size_t size ()
 Number of available preconditioners. More...
 
template<int i = 0>
static std::enable_if<(i
< std::tuple_size
< AvailableTypes >::value),
PreconditionerBase * >::type 
choose (Parallel const &par, InputFile const &inp, std::vector< std::pair< int, int >> const &ll, Bspline const &bspline, CommandLine const &cmd)
 Return pointer to new preconditioner object. More...
 
template<int i = 0>
static std::enable_if<(i==std::tuple_size
< AvailableTypes >::value),
PreconditionerBase * >::type 
choose (Parallel const &par, InputFile const &inp, std::vector< std::pair< int, int >> const &ll, Bspline const &bspline, CommandLine const &cmd)
 
template<int i = 0>
static std::enable_if<(i
< std::tuple_size
< AvailableTypes >::value),
int >::type 
findByName (std::string name)
 Find preconditioner by name. More...
 
template<int i = 0>
static std::enable_if<(i==std::tuple_size
< AvailableTypes >::value),
int >::type 
findByName (std::string name)
 
template<int i = 0>
static std::enable_if<(i
< std::tuple_size
< AvailableTypes >::value),
std::string >::type 
name (unsigned idx)
 Get name of the preconditioner. More...
 
template<int i = 0>
static std::enable_if<(i==std::tuple_size
< AvailableTypes >::value),
std::string >::type 
name (unsigned idx)
 
template<int i = 0>
static std::enable_if<(i
< std::tuple_size
< AvailableTypes >::value),
std::string >::type 
description (unsigned idx)
 Get description of the preconditioner. More...
 
template<int i = 0>
static std::enable_if<(i==std::tuple_size
< AvailableTypes >::value),
std::string >::type 
description (unsigned idx)
 

Detailed Description

This class is used for accessing all available preconditioners. Preconditioner types and objects are never accessed in any other way than by calling the member functions of this class or through the pointer retrieved from the method "choose".

For this reason, addition of a new preconditioner is very simple. One just needs to derive the new preconditioner class from PreconditionerBase, specify a name to be used on command line as static attribute (see code below) and add the class name to the tuple AvailableTypes.

* class MyNewPreconditioner
* {
* public:
* static const std::string name;
*
* // other compulsory methods
* // ...
* };
*

Member Typedef Documentation

First one (ILUCGPreconditioner at the moment) is considered default. This tuple is the only place that has to be modified when adding a new preconditioner to Hex-ECS (besides the obvious declaration and definition somewhere in reach, ideally in "preconditioners.h" and "preconditioners.cpp").

Member Function Documentation

template<int i = 0>
static std::enable_if<(i < std::tuple_size<AvailableTypes>::value), PreconditionerBase*>::type Preconditioners::choose ( Parallel const &  par,
InputFile const &  inp,
std::vector< std::pair< int, int >> const &  ll,
Bspline const &  bspline,
CommandLine const &  cmd 
)
inlinestatic

The preconditioner index from CommandLine::preconditioner is used to choose the correct preconditioner.

template<int i = 0>
static std::enable_if<(i == std::tuple_size<AvailableTypes>::value), PreconditionerBase*>::type Preconditioners::choose ( Parallel const &  par,
InputFile const &  inp,
std::vector< std::pair< int, int >> const &  ll,
Bspline const &  bspline,
CommandLine const &  cmd 
)
inlinestatic
template<int i = 0>
static std::enable_if<(i < std::tuple_size<AvailableTypes>::value),std::string>::type Preconditioners::description ( unsigned  idx)
inlinestatic
template<int i = 0>
static std::enable_if<(i == std::tuple_size<AvailableTypes>::value),std::string>::type Preconditioners::description ( unsigned  idx)
inlinestatic
template<int i = 0>
static std::enable_if<(i < std::tuple_size<AvailableTypes>::value),int>::type Preconditioners::findByName ( std::string  name)
inlinestatic

Return index of the corresponding preconditioner in AvailableTypes or (-1) if none such exists. "Corresponding preconditioner" is such type that has a static member

* std::string name;
*

equal to the argument of this function.

template<int i = 0>
static std::enable_if<(i == std::tuple_size<AvailableTypes>::value),int>::type Preconditioners::findByName ( std::string  name)
inlinestatic
template<int i = 0>
static std::enable_if<(i < std::tuple_size<AvailableTypes>::value),std::string>::type Preconditioners::name ( unsigned  idx)
inlinestatic
template<int i = 0>
static std::enable_if<(i == std::tuple_size<AvailableTypes>::value),std::string>::type Preconditioners::name ( unsigned  idx)
inlinestatic
static size_t Preconditioners::size ( )
inlinestatic

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