QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdmtimedepdirichletboundary.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2012 Peter Caspers
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20
25#ifndef quantlib_fdm_time_dep_dirichlet_boundary_hpp
26#define quantlib_fdm_time_dep_dirichlet_boundary_hpp
27
28#include <ql/methods/finitedifferences/boundarycondition.hpp>
29#include <ql/methods/finitedifferences/operators/fdmlinearop.hpp>
30#include <ql/functional.hpp>
31
32namespace QuantLib {
33
34 class FdmMesher;
35 class FdmLinearOpLayout;
36
37 class FdmTimeDepDirichletBoundary : public BoundaryCondition<FdmLinearOp> {
38 public:
39 // types and enumerations
43
44 FdmTimeDepDirichletBoundary(const ext::shared_ptr<FdmMesher>& mesher,
45 ext::function<Real(Real)> valueOnBoundary,
46 Size direction,
47 Side side);
48
49 FdmTimeDepDirichletBoundary(const ext::shared_ptr<FdmMesher>& mesher,
50 ext::function<Array(Real)> valueOnBoundary,
51 Size direction,
52 Side side);
53
54 void setTime(Time) override;
55 void applyBeforeApplying(operator_type&) const override {}
56 void applyBeforeSolving(operator_type&, array_type&) const override {}
57 void applyAfterApplying(array_type&) const override;
58 void applyAfterSolving(array_type&) const override;
59
60 private:
61 const std::vector<Size> indices_;
62 const ext::function<Real (Real)> valueOnBoundary_;
63 const ext::function<Array(Real)> valuesOnBoundary_;
64
66 };
67}
68
69#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Abstract boundary condition class for finite difference problems.
void applyAfterSolving(array_type &) const override
BoundaryCondition< FdmLinearOp >::Side Side
void applyAfterApplying(array_type &) const override
void applyBeforeApplying(operator_type &) const override
void applyBeforeSolving(operator_type &, array_type &) const override
const ext::function< Array(Real)> valuesOnBoundary_
const ext::function< Real(Real)> valueOnBoundary_
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35