version 0.4.1
nonlinearsolverfactory.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2025 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
9#pragma once
10
11#include <utility>
12
16
17namespace Ikarus {
18
27template <typename NLSSetting>
29{
36 : settings(s) {}
37
38 NLSSetting settings;
39
52 template <typename Assembler>
54 auto create(Assembler&& assembler) const {
55 auto f = DifferentiableFunctionFactory::op(assembler);
56 using fTraits = typename decltype(f)::Traits;
57
58 using CorrectionType = typename fTraits::template Range<1>;
59 using Domain = typename fTraits::Domain;
60 auto updateF = [assembler, setting = settings]<typename D, typename C>(D& x, const C& b) {
61 if (assembler->dBCOption() == DBCOption::Reduced) {
62 setting.updateFunction(x, assembler->createFullVector(b));
63 } else
64 setting.updateFunction(x, b);
65 };
66 auto settingsNew = settings.rebindUpdateFunction(std::move(updateF));
67 return createNonlinearSolver(std::move(settingsNew), std::move(f));
68 }
69};
70}; // namespace Ikarus
Contains the generic DifferentiableFunctionFactory class.
Collection of fallback default functions.
Definition: assemblermanipulatorbuildingblocks.hh:22
::value auto createNonlinearSolver(NRConfig &&config, F &&f)
Function to create a NewtonRaphson solver instance.
Definition: newtonraphson.hh:82
A factory class for creating nonlinear solvers.
Definition: nonlinearsolverfactory.hh:29
NonlinearSolverFactory(NLSSetting s)
Constructs a NonlinearSolverFactory with the given settings.
Definition: nonlinearsolverfactory.hh:35
NLSSetting settings
Definition: nonlinearsolverfactory.hh:38
auto create(Assembler &&assembler) const
Creates a nonlinear solver using the provided assembler.
Definition: nonlinearsolverfactory.hh:54
static auto op(Assembler &&as, AffordanceCollection< Affordances... > affordances, DBCOption dbcOption=DBCOption::Full)
Definition: differentiablefunctionfactory.hh:25
Concept representing the requirements for a FlatAssembler.A type T satisfies FlatAssembler if it prov...
Definition: utils/concepts.hh:507