1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Boundary conditions for finite-difference operators.
//!
//! Port of `ql/methods/finitedifferences/boundarycondition.hpp:35`.
//!
//! The header's `NeumannBC` (`:71`) and `DirichletBC` (`:90`) are not ported:
//! both are `BoundaryCondition<TridiagonalOperator>` classes of the old FD
//! framework and carry an upstream `[[deprecated]]` marker as of QuantLib
//! 1.42. They are dropped, not deferred - the FDM path uses the
//! `BoundaryCondition<FdmLinearOp>` family instead.
use crateArray;
use crateFdmLinearOp;
use crateTime;
/// The grid edge a boundary condition acts on (`boundarycondition.hpp:41`).
/// A condition the grid values and the operator must satisfy at a boundary.
///
/// C++ templates this on the operator (`boundarycondition.hpp:34`). Of its two
/// instantiations only `BoundaryCondition<FdmLinearOp>` is live - it is what
/// `OperatorTraits<FdmLinearOp>::bc_set` (`operatortraits.hpp:38`) and every
/// `Fdm*Boundary` use - while `BoundaryCondition<TridiagonalOperator>` belongs
/// to the deprecated pair above. The Rust trait therefore fixes the operator to
/// [`FdmLinearOp`] and takes no type parameter, which also keeps it usable as
/// `dyn BoundaryCondition` in [`FdmBoundaryConditionSet`].
///
/// [`FdmBoundaryConditionSet`]: crate::methods::finitedifferences::utilities::FdmBoundaryConditionSet
///
/// C++ declares `setTime` non-const (`:62`); the Rust method takes `&self`
/// because the set holds each condition as a [`Shared`], which yields no
/// `&mut`. Time-dependent conditions keep their state behind interior
/// mutability, as [`FdmInnerValueCalculator`] already does for its cache.
///
/// [`Shared`]: crate::shared::Shared
/// [`FdmInnerValueCalculator`]: crate::methods::finitedifferences::utilities::FdmInnerValueCalculator