version 0.4.4
Ikarus::NewtonRaphson< F, LS, UF, IDBCF > Class Template Reference

Implementation of the Newton-Raphson method for solving nonlinear equations. More...

#include <ikarus/solver/nonlinearsolver/newtonraphson.hh>

Inheritance diagram for Ikarus::NewtonRaphson< F, LS, UF, IDBCF >:
[legend]

Public Types

using Settings = NRSettings
 
using SignatureTraits = typename F::Traits
 
using CorrectionType = typename SignatureTraits::template Range< 0 >
 Type of the correction of x += deltaX. More...
 
using JacobianType = typename SignatureTraits::template Range< 1 >
 Compile-time boolean indicating if the linear solver satisfies the non-linear solver concept. More...
 
using Domain = typename SignatureTraits::Domain
 Type representing the parameter vector of the function. More...
 
using UpdateFunction = UF
 Type representing the update function. More...
 
using DifferentiableFunction = F
 Type of the non-linear operator. More...
 
using IDBCForceFunction = IDBCF
 Type representing the force function to handle inhomogeneous Dirichlet BCs. More...
 
using State = NonlinearSolverStateType< F >
 
using MessageType = NonLinearSolverMessages
 
using Callback = std::function< void(NonLinearSolverMessages, const State &)>
 
using Token = std::shared_ptr< Callback >
 

Public Member Functions

template<typename LS2 = LS, typename UF2 = UF, typename IDBCF2 = IDBCF>
 NewtonRaphson (const DifferentiableFunction &residual, LS2 &&linearSolver={}, UF2 &&updateFunction={}, IDBCF2 &&idbcForceFunction={})
 Constructor for NewtonRaphson. More...
 
void setup (const Settings &settings)
 Set up the solver with the given settings. More...
 
NonLinearSolverInformation solve (Domain &x, double stepSize=0.0)
 Solve the nonlinear system. More...
 
auto & residual ()
 Access the function. More...
 
const auto & residual () const
 Access the function. More...
 
const UpdateFunctionupdateFunction () const
 Access the update function. More...
 
const IDBCForceFunctionidbcForceFunction () const
 Access the force function calculating internal forces due to inhomogeneous Dirichlet BCs. More...
 
Token registerListener (Callback callback)
 This method is used to register a Listener function. More...
 
void unregisterListener (Token token)
 deregisters a specific function More...
 
void notify (NonLinearSolverMessages message, const State &data)
 This calls all the registered functions. More...
 

Static Public Attributes

static constexpr bool isLinearSolver = Ikarus::Concepts::LinearSolverCheck<LS, JacobianType, CorrectionType>
 

Detailed Description

template<typename F, typename LS, typename UF, typename IDBCF>
class Ikarus::NewtonRaphson< F, LS, UF, IDBCF >
Template Parameters
FType of the differentiable function to solve.
LSType of the linear solver used internally (default is SolverDefault).
UFType of the update function (default is UpdateDefault).
IDBCFType of the force function to handle inhomogeneous Dirichlet BCs (defaults to IDBCForceDefault).

Member Typedef Documentation

◆ Callback

using Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::Callback = std::function<void(NonLinearSolverMessages , const State&)>
inherited

◆ CorrectionType

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::CorrectionType = typename SignatureTraits::template Range<0>

◆ DifferentiableFunction

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::DifferentiableFunction = F

◆ Domain

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::Domain = typename SignatureTraits::Domain

◆ IDBCForceFunction

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::IDBCForceFunction = IDBCF

◆ JacobianType

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::JacobianType = typename SignatureTraits::template Range<1>

◆ MessageType

◆ Settings

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::Settings = NRSettings

◆ SignatureTraits

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::SignatureTraits = typename F::Traits

◆ State

using Ikarus::NonlinearSolverBase< F, Args >::State = NonlinearSolverStateType<F>
inherited

◆ Token

using Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::Token = std::shared_ptr<Callback>
inherited

◆ UpdateFunction

template<typename F , typename LS , typename UF , typename IDBCF >
using Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::UpdateFunction = UF

Constructor & Destructor Documentation

◆ NewtonRaphson()

template<typename F , typename LS , typename UF , typename IDBCF >
template<typename LS2 = LS, typename UF2 = UF, typename IDBCF2 = IDBCF>
Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::NewtonRaphson ( const DifferentiableFunction residual,
LS2 &&  linearSolver = {},
UF2 &&  updateFunction = {},
IDBCF2 &&  idbcForceFunction = {} 
)
inlineexplicit
Parameters
residualresidual to solve.
linearSolverLinear solver used internally (default is SolverDefault).
updateFunctionUpdate function (default is UpdateDefault).
idbcForceFunctionForce function to handle inhomogeneous Dirichlet BCs (default is IDBCForceDefault).

Member Function Documentation

◆ idbcForceFunction()

template<typename F , typename LS , typename UF , typename IDBCF >
const IDBCForceFunction & Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::idbcForceFunction ( ) const
inline
Returns
Reference to the function.

◆ notify()

void Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::notify ( NonLinearSolverMessages  message,
const State data 
)
inlineinherited

◆ registerListener()

Token Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::registerListener ( Callback  callback)
inlineinherited

The function that is passed in is first stored in a shared_ptr. After this, the shared_ptr is added to the vector of listener functions, which leads to a implicit conversion to a weak_ptr. The shared_ptr is then returned to the Listener that has called this function to be stored in a vector of shared_ptr<void> listener.hh.

Parameters
callbackthe callback function
Returns
Token

◆ residual() [1/2]

template<typename F , typename LS , typename UF , typename IDBCF >
auto & Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::residual ( )
inline
Returns
Reference to the function.

◆ residual() [2/2]

template<typename F , typename LS , typename UF , typename IDBCF >
const auto & Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::residual ( ) const
inline
Returns
Reference to the function.

◆ setup()

template<typename F , typename LS , typename UF , typename IDBCF >
void Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::setup ( const Settings settings)
inline
Parameters
settingsNewton-Raphson settings.

◆ solve()

template<typename F , typename LS , typename UF , typename IDBCF >
NonLinearSolverInformation Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::solve ( Domain x,
double  stepSize = 0.0 
)
inline
Parameters
xWhere the solution should be stored.
stepSizethe step size of the control routine (defaults to 0.0)
Returns
Information about the solution process.

◆ unregisterListener()

void Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::unregisterListener ( Token  token)
inlineinherited

◆ updateFunction()

template<typename F , typename LS , typename UF , typename IDBCF >
const UpdateFunction & Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::updateFunction ( ) const
inline
Returns
Reference to the function.

Member Data Documentation

◆ isLinearSolver

template<typename F , typename LS , typename UF , typename IDBCF >
constexpr bool Ikarus::NewtonRaphson< F, LS, UF, IDBCF >::isLinearSolver = Ikarus::Concepts::LinearSolverCheck<LS, JacobianType, CorrectionType>
staticconstexpr

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