version 0.4.1
nonlinearsolverfactory.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2024 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 nonLinOp = NonLinearOperatorFactory::op(assembler);
56 std::function updateF = [assembler, setting = settings](decltype(nonLinOp.firstParameter())& a,
57 const decltype(nonLinOp.derivative())& b) {
58 if (assembler->dBCOption() == DBCOption::Reduced) {
59 setting.updateFunction(a, assembler->createFullVector(b));
60 } else
61 setting.updateFunction(a, b);
62 };
63 auto settingsNew = settings.rebindUpdateFunction(std::move(updateF));
64 return createNonlinearSolver(std::move(settingsNew), std::move(nonLinOp));
65 }
66};
67}; // namespace Ikarus
Contains the generic NonLinearOperatorFactory class.
Collection of fallback default functions.
Definition: assemblermanipulatorbuildingblocks.hh:22
::value auto createNonlinearSolver(NRConfig &&config, NLO &&nonLinearOperator)
Function to create a NewtonRaphson solver instance.
Definition: newtonraphson.hh:65
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, typename traits::remove_pointer_t< std::remove_cvref_t< Assembler > >::FERequirement &req, AffordanceCollection< Affordances... > affordances, DBCOption dbcOption)
Definition: nonlinopfactory.hh:22
Concept representing the requirements for a FlatAssembler.A type T satisfies FlatAssembler if it prov...
Definition: concepts.hh:500