Coverage Report

Created: 2025-10-14 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/methods/finitedifferences/meshers/fdmmesher.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
/*! \file fdmmesher.hpp
23
    \brief mesher for a fdm grid
24
*/
25
#ifndef quantlib_fdm_mesher_hpp
26
#define quantlib_fdm_mesher_hpp
27
28
#include <ql/math/array.hpp>
29
#include <ql/shared_ptr.hpp>
30
#include <utility>
31
#include <vector>
32
33
namespace QuantLib {
34
    class FdmLinearOpLayout;
35
    class FdmLinearOpIterator;
36
37
    class FdmMesher {
38
      public:
39
        explicit FdmMesher(ext::shared_ptr<FdmLinearOpLayout> layout)
40
0
        : layout_(std::move(layout)) {}
41
0
        virtual ~FdmMesher() = default;
42
43
        virtual Real dplus(const FdmLinearOpIterator& iter,
44
                           Size direction)  const = 0;
45
        virtual Real dminus(const FdmLinearOpIterator& iter,
46
                            Size direction) const = 0;
47
        virtual Real location(const FdmLinearOpIterator& iter ,
48
                              Size direction) const = 0;
49
        virtual Array locations(Size direction) const = 0;
50
51
0
        const ext::shared_ptr<FdmLinearOpLayout>& layout() const {
52
0
            return layout_;
53
0
        }
54
55
      protected:
56
        const ext::shared_ptr<FdmLinearOpLayout> layout_;
57
    };
58
}
59
60
#endif