Coverage Report

Created: 2025-11-04 06:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/methods/finitedifferences/utilities/fdmdirichletboundary.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2008 Andreas Gaida
5
 Copyright (C) 2008 Ralph Schreyer
6
 Copyright (C) 2008 Klaus Spanderen
7
8
 This file is part of QuantLib, a free-software/open-source library
9
 for financial quantitative analysts and developers - http://quantlib.org/
10
11
 QuantLib is free software: you can redistribute it and/or modify it
12
 under the terms of the QuantLib license.  You should have received a
13
 copy of the license along with this program; if not, please email
14
 <quantlib-dev@lists.sf.net>. The license is also available online at
15
 <https://www.quantlib.org/license.shtml>.
16
17
 This program is distributed in the hope that it will be useful, but WITHOUT
18
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 FOR A PARTICULAR PURPOSE.  See the license for more details.
20
*/
21
22
23
/*! \file fdmdirichletboundary.hpp
24
    \brief Dirichlet boundary conditions for differential operators
25
*/
26
27
#ifndef quantlib_fdm_dirichlet_boundary_hpp
28
#define quantlib_fdm_dirichlet_boundary_hpp
29
30
#include <ql/methods/finitedifferences/boundarycondition.hpp>
31
#include <ql/methods/finitedifferences/operators/fdmlinearop.hpp>
32
33
namespace QuantLib {
34
35
    class FdmMesher;
36
    class FdmLinearOpLayout;
37
38
    class FdmDirichletBoundary : public BoundaryCondition<FdmLinearOp> {
39
      public:
40
        // types and enumerations
41
        typedef FdmLinearOp operator_type;
42
        typedef FdmLinearOp::array_type array_type;
43
        typedef BoundaryCondition<FdmLinearOp>::Side Side;
44
45
        FdmDirichletBoundary(const ext::shared_ptr<FdmMesher>& mesher,
46
                             Real valueOnBoundary, Size direction, Side side);
47
48
        void applyBeforeApplying(operator_type&) const override;
49
        void applyBeforeSolving(operator_type&, array_type&) const override;
50
        void applyAfterApplying(array_type&) const override;
51
        void applyAfterSolving(array_type&) const override;
52
0
        void setTime(Time) override {}
53
54
        Real applyAfterApplying(Real x, Real value) const;
55
56
      private:
57
        const Side side_;  
58
        const Real valueOnBoundary_;
59
        const std::vector<Size> indices_;
60
61
        Real xExtreme_;
62
    };
63
}
64
65
#endif