class
RiemannSolverGeneric Riemann solver interface class for various Riemann solvers.
Contents
This class uses runtime polymorphism without client-side inheritance: inheritance is confined to the internals of this class, invisble to client-code. The class exclusively deals with ownership enabling client-side value semantics. Credit for this idea goes to Sean Parent at Adobe: https:/
Constructors, destructors, conversion operators
-
template<typename T>RiemannSolver(T x) explicit
- Constructor taking an object modeling Concept.
-
template<typename T, typename... Args>RiemannSolver(std::function<T(Args...)> x, Args&&... args) explicit
- Constructor taking a function pointer (std::function) to a constructor of an object modeling Concept.
- RiemannSolver(const RiemannSolver& x)
- Copy constructor.
- RiemannSolver(RiemannSolver&&) noexcept defaulted
- Move constructor.
Public functions
-
auto flux(const std::array<tk::
real, 3>& fn, const std::array<std::vector<tk:: real>, 2>& u, const std::vector<std::array<tk:: real, 3>>& v) const -> std::vector<tk:: real> - Public interface to computing the Riemann flux.
- auto operator=(const RiemannSolver& x) -> RiemannSolver&
- Copy assignment.
- auto operator=(RiemannSolver&&) noexcept -> RiemannSolver& defaulted
- Move assignment.
Function documentation
template<typename T>
inciter:: RiemannSolver:: RiemannSolver(T x) explicit
Constructor taking an object modeling Concept.
Parameters | |
---|---|
x in | Instantiated object of type T given by the template argument. |
The object of class T comes pre-constructed.
template<typename T, typename... Args>
inciter:: RiemannSolver:: RiemannSolver(std::function<T(Args...)> x,
Args&&... args) explicit
Constructor taking a function pointer (std::function) to a constructor of an object modeling Concept.
Parameters | |
---|---|
x in | Function pointer (std::function) to a constructor of an object modeling Concept. |
args in | Zero or more constructor arguments |
Passing std::function allows late execution of the constructor, i.e., as late as inside this class' constructor, and thus usage from a factory. Note that there are at least two different ways of using this constructor:
- Bind T's constructor arguments and place it in std::function<T()> and passing no arguments as args.... This case then instantiates the model via its constructor and stores it in here.
Bind a single placeholder argument to T's constructor and pass it in as host's args..., which then forwards it to model's constructor. This allows late binding, i.e., binding the argument only here.