11#include <spdlog/spdlog.h> 
   25  template <
typename BC>
 
   38    constexpr bool isDomainAVector = 
Concepts::EigenVector<
typename std::remove_cvref_t<
decltype(state)>::Domain>;
 
   41        init<isDomainAVector>();
 
   44        iterationEnded<isDomainAVector>();
 
   47        rNorm_ = state.information.residualNorm;
 
   50        if constexpr (not isDomainAVector)
 
   51          lambda_ = state.domain.parameter();
 
   54        dNorm_ = state.information.correctionNorm;
 
   57        finishedSuccessfully(state.information.iterations);
 
   70  template <
bool isDomainAVector>
 
   75    spdlog::info(
"Non-linear solver started:");
 
   76    if (not isDomainAVector) {
 
   77      spdlog::info(
"{:<11} {:<20} {:<20} {:<20}", 
"Ite", 
"normR", 
"normD", 
"lambda");
 
   78      spdlog::info(
"-------------------------------------------------------------------------------");
 
   80      spdlog::info(
"{:<11} {:<20} {:<20}", 
"Ite", 
"normR", 
"normD");
 
   81      spdlog::info(
"-------------------------------------------------");
 
   85  template <
bool isDomainAVector>
 
   86  void iterationEnded() {
 
   87    if (not isDomainAVector)
 
   88      spdlog::info(
"{} {:<10d} {:<20.2e} {:<20.2e} {:<20.2e}", 
"", iters_, rNorm_, dNorm_, lambda_);
 
   90      spdlog::info(
"{} {:<10d} {:<20.2e} {:<20.2e}", 
"", iters_, rNorm_, dNorm_);
 
   94  void finishedSuccessfully(
int numberOfIterations) { spdlog::info(
"Number of iterations: {}", numberOfIterations); }
 
Implementation of the observer design pattern with broadcasters.
 
Enums for observer messages.
 
Definition: assemblermanipulatorbuildingblocks.hh:22
 
NonLinearSolverMessages
Enum class defining non-linear solver-related messages.
Definition: broadcastermessages.hh:22
 
Implements a listener.
Definition: listener.hh:28
 
auto subscribe(Broadcaster &broadcaster, std::function< void(typename Broadcaster::MessageType, const typename Broadcaster::State &)> callback)
Function to subscribe to a broadcaster with a given function (either a lambda, std::function or funct...
Definition: listener.hh:41
 
Implementation of an observer for logging non-linear solvers.
Definition: nonlinearsolverlogger.hh:23
 
void update(NonLinearSolverMessages message, const Concepts::NonLinearSolverState auto &state)
Implementation of the update method for logging control messages with a control routine state.
Definition: nonlinearsolverlogger.hh:37
 
NonLinearSolverLogger & subscribeTo(BC &bc)
Definition: nonlinearsolverlogger.hh:26
 
Concept defining the requirements for Eigen vectors.
Definition: utils/concepts.hh:365
 
Concept to check if a type represents a nonlinear solver state.
Definition: utils/concepts.hh:664