#include <anderson.hpp>
|
| | AndersonCore (AndersonState state, int window=5, double mixing=1.0) |
| | Allocates the history (design §6.3: (2m+3)·n_s·8·n_pad bytes).
|
| | AndersonCore (const AndersonCore &)=delete |
| AndersonCore & | operator= (const AndersonCore &)=delete |
| | AndersonCore (AndersonCore &&)=default |
| AndersonCore & | operator= (AndersonCore &&)=default |
| bool | prepare (bool accelerate) |
| | §4.3 steps 0–1.
|
| bool | stepFailed (const std::string &what) |
| | §4.3 step 2, the caller's step threw.
|
| void | complete (bool pressureSolveFailed=false) |
| | §4.3 steps 3–7, after the caller's step.
|
| void | reset () |
| | Clears the history and the counters (design §4.2); keeps the previous evaluation, so the next call forms a column at once.
|
| void | invalidate () |
| | The caller's map changed (flow: its parameter signature) or the state was written: reset() and forget the previous evaluation; counts in numResets().
|
| void | disable () |
| | Stops acceleration for good: prepare/complete become no-ops around a plain step.
|
| Status | status () const |
| const char * | statusName () const |
| | "active" | "disabled".
|
| const std::string & | reason () const |
| double | residual () const |
| | Relative velocity residual of the last evaluation whose output the state holds (design §3.2; after a restart, the restored output's); +inf before the first.
|
| int | numRestarts () const |
| int | numResets () const |
| int | numColumns () const |
| | Window columns in use (mk).
|
| int | window () const |
| double | mixing () const |
| bool | engaged () const |
| bool | pending () const |
| | A mix is pending for the next accelerated call.
|
| std::vector< double > | gamma () const |
| | The pending coefficients γ, oldest column first (numColumns() of them).
|
| std::size_t | memoryBytes () const |
| | Bytes held by the history, X, Rprev and Gprev: equals memoryBytesFor(window(), n_s, n_pad).
|
| const AndersonState & | state () const |
|
| static std::size_t | memoryBytesFor (int window, std::size_t numFields, Index nPad) |
| | The §6.3 memory formula: (2m + 3)·n_s·8·n_pad bytes.
|
Definition at line 329 of file anderson.hpp.
◆ Status
◆ AndersonCore() [1/3]
| peclet::core::solver::AndersonCore::AndersonCore |
( |
AndersonState | state, |
|
|
int | window = 5, |
|
|
double | mixing = 1.0 ) |
|
inlineexplicit |
Allocates the history (design §6.3: (2m+3)·n_s·8·n_pad bytes).
Collective over state.comm (one 2-double sum {invalid descriptor, failed allocation}, so that every rank throws when one rank's descriptor is inconsistent or one rank's allocation fails). Throws std::invalid_argument (on every rank) for an inconsistent descriptor and std::runtime_error (on every rank) when the history does not fit.
Definition at line 349 of file anderson.hpp.
References mixing(), state(), and window().
Referenced by AndersonCore(), AndersonCore(), operator=(), and operator=().
◆ AndersonCore() [2/3]
| peclet::core::solver::AndersonCore::AndersonCore |
( |
const AndersonCore & | | ) |
|
|
delete |
◆ AndersonCore() [3/3]
| peclet::core::solver::AndersonCore::AndersonCore |
( |
AndersonCore && | | ) |
|
|
default |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ memoryBytesFor()
| std::size_t peclet::core::solver::AndersonCore::memoryBytesFor |
( |
int | window, |
|
|
std::size_t | numFields, |
|
|
Index | nPad ) |
|
inlinestatic |
The §6.3 memory formula: (2m + 3)·n_s·8·n_pad bytes.
Definition at line 406 of file anderson.hpp.
References window().
◆ prepare()
| bool peclet::core::solver::AndersonCore::prepare |
( |
bool | accelerate | ) |
|
|
inline |
§4.3 steps 0–1.
Detects an external write of the state (inner entries only), then either applies the pending mix (accelerate, pending, active) or records the input. Returns whether the state now holds a mixed iterate. Collective (one 1-double sum) while active; one host synchronisation (the COUNT read-back).
Definition at line 417 of file anderson.hpp.
References Active, peclet::core::solver::detail::anderson::MixColumns::count, peclet::core::solver::detail::anderson::countChanged(), peclet::core::solver::detail::anderson::MixColumns::dG, peclet::core::solver::detail::anderson::MixColumns::dR, peclet::core::solver::detail::anderson::MixColumns::gamma, invalidate(), and peclet::core::solver::detail::anderson::mix().
◆ stepFailed()
| bool peclet::core::solver::AndersonCore::stepFailed |
( |
const std::string & | what | ) |
|
|
inline |
§4.3 step 2, the caller's step threw.
Returns true when the failure was absorbed: the input was a mixed iterate, so the state is restored to the last map output, acceleration is disabled and the caller continues (plain). Returns false when the caller must rethrow.
Definition at line 461 of file anderson.hpp.
References Active, Disabled, and reset().
◆ complete()
| void peclet::core::solver::AndersonCore::complete |
( |
bool | pressureSolveFailed = false | ) |
|
|
inline |
§4.3 steps 3–7, after the caller's step.
pressureSolveFailed must be rank-consistent. Collective while active: a (2·columns + 2)-double sum and a broadcast of rank 0's decisions; one host synchronisation (the pass-2 read-back). The device copies are stream-ordered.
Definition at line 480 of file anderson.hpp.
References Active, kEngageDecreases, and kMaxWindow.
◆ reset()
| void peclet::core::solver::AndersonCore::reset |
( |
| ) |
|
|
inline |
Clears the history and the counters (design §4.2); keeps the previous evaluation, so the next call forms a column at once.
Definition at line 531 of file anderson.hpp.
Referenced by invalidate(), and stepFailed().
◆ invalidate()
| void peclet::core::solver::AndersonCore::invalidate |
( |
| ) |
|
|
inline |
◆ disable()
| void peclet::core::solver::AndersonCore::disable |
( |
| ) |
|
|
inline |
Stops acceleration for good: prepare/complete become no-ops around a plain step.
Definition at line 547 of file anderson.hpp.
References Active, and Disabled.
◆ status()
| Status peclet::core::solver::AndersonCore::status |
( |
| ) |
const |
|
inline |
◆ statusName()
| const char * peclet::core::solver::AndersonCore::statusName |
( |
| ) |
const |
|
inline |
◆ reason()
| const std::string & peclet::core::solver::AndersonCore::reason |
( |
| ) |
const |
|
inline |
◆ residual()
| double peclet::core::solver::AndersonCore::residual |
( |
| ) |
const |
|
inline |
Relative velocity residual of the last evaluation whose output the state holds (design §3.2; after a restart, the restored output's); +inf before the first.
Definition at line 564 of file anderson.hpp.
◆ numRestarts()
| int peclet::core::solver::AndersonCore::numRestarts |
( |
| ) |
const |
|
inline |
◆ numResets()
| int peclet::core::solver::AndersonCore::numResets |
( |
| ) |
const |
|
inline |
◆ numColumns()
| int peclet::core::solver::AndersonCore::numColumns |
( |
| ) |
const |
|
inline |
◆ window()
| int peclet::core::solver::AndersonCore::window |
( |
| ) |
const |
|
inline |
◆ mixing()
| double peclet::core::solver::AndersonCore::mixing |
( |
| ) |
const |
|
inline |
◆ engaged()
| bool peclet::core::solver::AndersonCore::engaged |
( |
| ) |
const |
|
inline |
◆ pending()
| bool peclet::core::solver::AndersonCore::pending |
( |
| ) |
const |
|
inline |
A mix is pending for the next accelerated call.
Definition at line 573 of file anderson.hpp.
◆ gamma()
| std::vector< double > peclet::core::solver::AndersonCore::gamma |
( |
| ) |
const |
|
inline |
◆ memoryBytes()
| std::size_t peclet::core::solver::AndersonCore::memoryBytes |
( |
| ) |
const |
|
inline |
◆ state()
| const AndersonState & peclet::core::solver::AndersonCore::state |
( |
| ) |
const |
|
inline |
◆ kMaxWindow
◆ kEngageDecreases
| int peclet::core::solver::AndersonCore::kEngageDecreases = 2 |
|
staticconstexpr |
◆ kRestartGrowth
| double peclet::core::solver::AndersonCore::kRestartGrowth = 4.0 |
|
staticconstexpr |
◆ kMaxRestarts
| int peclet::core::solver::AndersonCore::kMaxRestarts = 5 |
|
staticconstexpr |
◆ kNoiseFloor
| double peclet::core::solver::AndersonCore::kNoiseFloor = 1e-10 |
|
staticconstexpr |
◆ kCondMin
| double peclet::core::solver::AndersonCore::kCondMin = 1e-12 |
|
staticconstexpr |
The documentation for this class was generated from the following file: