We collect in this namespace some wrappers around commonly used deal.II classes, derived from the ParameterAcceptor class. More...
Namespaces | |
Components | |
Utilities for extracting components and boundary condition types from strings. | |
Classes | |
class | BoundaryConditions |
A wrapper for boundary conditions. More... | |
class | Constants |
A wrapper for physical constants to be shared among functions and classes. More... | |
class | DataOut |
class | FiniteElement |
Parsed FiniteElement. More... | |
class | Function |
A wrapper for the FunctionParser class. More... | |
class | GridGenerator |
GridGenerator class. More... | |
struct | GridInfo |
Gather information about a Triangulation. More... | |
class | GridRefinement |
A wrapper for refinement strategies. More... | |
class | MappingEulerian |
A wrapper class for MappingFEField or MappingQEulerian. More... | |
class | NonMatchingCoupling |
Wrapper around several functions in the NonMatching namespace. More... | |
class | Proxy |
A proxy ParameterAcceptor wrapper for classes that have a member function add_parameters , which takes a ParameterHandler as argument, and use the ParameterHandler::add_parameter() method to add parameters. More... | |
class | SymbolicFunction |
A wrapper for the Functions::SymbolicFunction class. More... | |
Typedefs | |
using | ConvergenceTable = Proxy< ParsedConvergenceTable > |
A class that provides a wrapper around deal.II's ParsedConvergenceTable class, and makes it a ParameterAcceptor class as well. More... | |
Enumerations | |
enum class | BoundaryConditionType { dirichlet = 0 , neumann = 1 , first_dof = 2 } |
Implemented boundary ids. More... | |
enum class | RefinementStrategy { global = 1 , fixed_fraction = 2 , fixed_number = 3 } |
Refinement strategy implemented in the GridRefinement class. More... | |
Functions | |
Constants::operator const std::map< std::string, double > & () const | |
We collect in this namespace some wrappers around commonly used deal.II classes, derived from the ParameterAcceptor class.
When building non-trivial applications, it is desirable to drive the execution of the final program from a configuration file, rather than changing the source code and recompile (with the exceptions of some very performance critical parameters, such as degrees and number of quadrature points in the MatrixFree framework).
While there is nothing conceptually difficult to do, the task of parsing a configuration file, together with the definition of how the parameters are written to file, their default values, their types, and their documentation is tedious and error prone, and often left as a last step in every user program. The deal.II library offers a nice parameter handling framework, which is based on the ParameterHandler class. Such class allows you to define entries in a parameter file, split by subsections, and provides a basic type checking mechanism which relies on Patterns matching.
The use of ParameterHandler is demonstrated in several deal.II examples (e.g., step-19, step-29, step-33, etc.), and it is usually a four step task:
Even thought this is very convenient and not difficult, it has a few draw backs:
Nothing difficult, but for large programs, with hundreds of paramters, this may become difficult. Building on top of [3], deal.II offers an alternative framework for the handling of parameter files and classes, based on the ParameterAcceptor class.
ParameterAcceptor provides a global subscription mechanism. Whenever an object of a class derived from ParameterAcceptor is constructed, a pointer to that object-of-derived-type is registered, together with a section entry in the parameter file. Such registry is traversed upon invocation of the single function ParameterAcceptor::initialize("file.prm"), usually in the source file containing the main()
function of your application, which in turn makes sure that all classes stored in the global registry declare the parameters they will be using, and after having declared them, it reads the content of file.prm
to parse the actual parameters. This part condenses two of the steps above (2 and 3) into a single function call to the static ParameterAcceptor::initialize() function, right after you have built all the objects you will use, and right before you start using them.
In user codes, the other two steps (1 and 4) are condensed (usually in the constructor) to a single call to the ParameterAcceptor::add_parameter() function, for each of the parameters you want to be syncronized with a file. The function above is templated on the type of the object, say T
, it interprets the object according to the Patterns::Tools::Convert<T> struct, which is a converter to and from strings to the type T
, and then creates an entry for the parameter, and a callback that will update the parameter when the file is read and parsed, without any other intervention from the user side, effectively removing all syncronization issues of steps 1 and 4 above.
If you call the method ParameterAcceptor::add_parameter() for each of the parameters you want to use in your code, there is nothing else you need to do: the declaration of the parameters is done automatically, and the parsing step is done as soon a new file is parsed. The only requirement is that you specify in the constructor of the ParameterAcceptor class a name for the section in the parameter file used to store all parameters of a given class.
Every class in this namespace is derived from ParameterAcceptor, and takes as a first argument the name of the section in the parameter file where the class will store and parse its parameters from.
using ParsedTools::ConvergenceTable = typedef Proxy<ParsedConvergenceTable> |
A class that provides a wrapper around deal.II's ParsedConvergenceTable class, and makes it a ParameterAcceptor class as well.
Definition at line 35 of file convergence_table.h.
|
strong |
Implemented boundary ids.
Enumerator | |
---|---|
dirichlet | |
neumann | |
first_dof |
Definition at line 42 of file boundary_conditions.h.
|
strong |
Refinement strategy implemented in the GridRefinement class.
Enumerator | |
---|---|
global | |
fixed_fraction | |
fixed_number |
Definition at line 44 of file grid_refinement.h.
ParsedTools::Constants::operator const std::map< std::string, double > & | ( | ) | const |
Definition at line 75 of file constants.cc.