Partial differential equations stack.
- PDEStack() explicit
- Constructor: register partial differential equations into factory.
- auto selectedCG() const -> std::vector<CGPDE>
- Instantiate selected PDEs using continuous Galerkin discretization.
- auto selectedDG() const -> std::vector<DGPDE>
- Instantiate selected PDEs using discontinuous Galerkin discretization.
- auto cgfactory() const -> const CGFactory&
- auto dgfactory() const -> const DGFactory&
- auto info() const -> std::vector<std::vector<std::pair<std::string, std::string>>>
- Return info on selected partial differential equations.
- auto cgntypes() const -> std::size_t
- auto dgntypes() const -> std::size_t
PDEStack:: PDEStack() explicit
Constructor: register partial differential equations into factory.
This constructor consists of several blocks, each registering a potentially large number of entries in a partial differential equation factory, a standard associative container. At this time, each type of partial differential equation can be configured to use a unique physics policy and a unique problem policy. (More types of policies might be introduced in the future.) Policy classes are template arguments to the partial differential equation classes and influence their behavior in a different way, abstracting away certain functions, e.g., how to set problem-specific initial and/or boundary conditions and how to update their coefficients during time integration. For more information on policy-based design, see http://en.wikipedia.org/wiki/Policy-based_
Since the functionality of the policies are orthogonal to each other, i.e., they do not depend on each other or their host (the partial differential equation class), a Cartesian product of combinations are possible, depending on which policies are selected. This constructor registers all possible combinations of policies for all available differential equations. By register, we mean, an entry is recorded in an associative container, a std::map, that associates a lightweight key of type inciter::
Since all partial differential equation types (registered in the factory) "inherit" from a common "base", client-code is unform and generic, and thus immune to changes in the inner workings of the particular partial differential equations as long as they fullfill certain concepts, i.e., implement certain member functinos, enforced by the common base, PDE. The words "inherit and "base" are quoted here, because the common base does not use inheritance in the normal OOP sense and does not use reference semantics, i.e., pointers, visible to client-code either. The relationship is more of a models a-type, which simplifies client-code and allows for the benfits of runtime inheritance with value-semantics which is less error prone and easier to read. See more about the models-a relationship and its implementation in, e.g., PDE/CGPDE.h.
The design discussed above allows the registration, instantiation, and use of the partial differential equations to be generic, which eliminates a lot of boiler-plate code and makes client-code uniform.
Details of registration using brigand::for_each and tk::
The template argument to brigand::for_each, as used below, requires a list of list of types. We use brigand::list of brigand::list of types, listing all possible policies, where the inner list must have exactly two types, as the list of lists is constructed from two lists using the cartesian product, and the length of the outer list (the list of lists) is arbitrary. The constructor argument to brigand::for_each is a functor that is to be applied to all members of the outer list. tk::
std::vector<std::vector<std::pair<std::string, std::string>>> inciter::
PDEStack:: info() const
Return info on selected partial differential equations.
|Returns||A vector of vector of pair of strings, containing the configuration for each selected partial differential equation|
PDEStack:: cgntypes() const
|Returns||The number of unique equation types registered into the CG factory the factory|
Return number of unique equation types registered into the CG factory