inciter::PDEStack class

Partial differential equations stack.

Constructors, destructors, conversion operators

PDEStack() explicit
Constructor: register partial differential equations into factory.

Public functions

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 selectedFV() const -> std::vector<FVPDE>
Instantiate selected PDEs using finite volume discretization.
auto cgfactory() const -> const CGFactory&
auto dgfactory() const -> const DGFactory&
auto fvfactory() const -> const FVFactory&
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
auto fvntypes() const -> std::size_t

Function documentation

inciter::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_design. This abstraction allows separation of concerns.

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::ctr::PDEKey, consisting of only an enum for each policy type, to an std::function object that holds the constructor bound to its arguments corresponding to a particular partial differential equation + policies combination. Note that registering these entries in the map does not invoke the constructors. The mapped value simply stores how the constructors should be invoked at a later time. At some point later, based on user input, we then instantiate only the partial differential equations (and only those configurations) that are requested by the user.

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::cartesian_product:

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::cartesian_product will create all possible combinations of these types and call the functor with each type of the created sequence as a template parameter. The functor here inherits from registerPDE, which, i.e., its constructor call, needs a single template argument, a class templated on policy classes. This is the partial differential equation class to be configured by selecting policies and to be registered. The arguments to registerPDE's constructor are the factory, the enum denoting the differential equation type, and a reference to a variable of type std::set< ctr::PDEType >, which is only used internally to PDEStack for counting up the number of unique differential equation types registered, used for diagnostics purposes.

std::vector<CGPDE> inciter::PDEStack::selectedCG() const

Instantiate selected PDEs using continuous Galerkin discretization.

Returns std::vector of instantiated partial differential equation objects

std::vector<DGPDE> inciter::PDEStack::selectedDG() const

Instantiate selected PDEs using discontinuous Galerkin discretization.

Returns std::vector of instantiated partial differential equation objects

std::vector<FVPDE> inciter::PDEStack::selectedFV() const

Instantiate selected PDEs using finite volume discretization.

Returns std::vector of instantiated partial differential equation objects

const CGFactory& inciter::PDEStack::cgfactory() const

Returns Constant reference to the CGPDE factory

Constant accessor to CGPDE factory

const DGFactory& inciter::PDEStack::dgfactory() const

Returns Constant reference to the DGPDE factory

Constant accessor to DGPDE factory

const FVFactory& inciter::PDEStack::fvfactory() const

Returns Constant reference to the FVPDE factory

Constant accessor to FVPDE factory

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

std::size_t inciter::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

std::size_t inciter::PDEStack::dgntypes() const

Returns The number of unique equation types registered into the DG factory the factory

Return number of unique equation types registered into the DG factory

std::size_t inciter::PDEStack::fvntypes() const

Returns The number of unique equation types registered into the FV factory the factory

Return number of unique equation types registered into the FV factory