SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::equations::EquationSum< FirstT, RestTs > Class Template Referencefinal

Sum multiple equations together. More...

#include <arithmetic.hpp>

Collaboration diagram for serif::equations::EquationSum< FirstT, RestTs >:
[legend]

Public Types

using Test = typename FirstT::Test
 The test type of the summed equations is the same as the test type of the first equation.
 

Public Member Functions

 EquationSum (FirstT first, RestTs... rest)
 Construct a summed equation.
 
const auto & contributions () const noexcept
 Return the contributions of the summed equations.
 

Static Public Attributes

static constexpr std::string_view name = "equation sum"
 Compile time name for the summed equations, used for debugging and logging.
 

Private Attributes

std::tuple< FirstT, RestTs... > m_equations
 The equations being summed together.
 

Detailed Description

template<Equation FirstT, Equation... RestTs>
requires (std::same_as<typename FirstT::Test, typename RestTs::Test> && ...)
class serif::equations::EquationSum< FirstT, RestTs >

Sum multiple equations together.

This class is a compile-time tag that indicates that the weak contributions from multiple equations should be summed together. The actual summation is performed by the backend. A simple example would be if two equations are summed together, then the weak contributions from both equations would be integrated and then added together to form the final residual. Note also that we do not define a coefficient here. The backend only ever sums things, as you can see in EquationDifference to subtract we locally introduce a -1 scaling factor.

Requirements
  • The FirstT and RestTs equations must share the same test type, otherwise the summation is not well-defined.
Equation Contributions
  • Residuals to all rows which are shared by the summed equations
Note
Only equations sharing a residual row can or should be summed together.
Template Parameters
FirstTThe first equation type to sum.
RestTsThe remaining equation types to sum.

Member Typedef Documentation

◆ Test

template<Equation FirstT, Equation... RestTs>
using serif::equations::EquationSum< FirstT, RestTs >::Test = typename FirstT::Test

The test type of the summed equations is the same as the test type of the first equation.

Constructor & Destructor Documentation

◆ EquationSum()

template<Equation FirstT, Equation... RestTs>
serif::equations::EquationSum< FirstT, RestTs >::EquationSum ( FirstT first,
RestTs... rest )
inlineexplicit

Construct a summed equation.

Parameters
firstThe first equation to sum.
restPack of the remaining equations to sum.
Note
the constructor uses the initializer list for m_equations, note that the coefficient defaults to 1.0

Member Function Documentation

◆ contributions()

template<Equation FirstT, Equation... RestTs>
const auto & serif::equations::EquationSum< FirstT, RestTs >::contributions ( ) const
inlinenodiscardnoexcept

Return the contributions of the summed equations.

Returns
A tuple containing the contributions of the summed equations.

Member Data Documentation

◆ m_equations

template<Equation FirstT, Equation... RestTs>
std::tuple<FirstT, RestTs...> serif::equations::EquationSum< FirstT, RestTs >::m_equations
private

The equations being summed together.

◆ name

template<Equation FirstT, Equation... RestTs>
std::string_view serif::equations::EquationSum< FirstT, RestTs >::name = "equation sum"
staticconstexpr

Compile time name for the summed equations, used for debugging and logging.


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