Coverage Report

Created: 2026-03-11 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/methods/finitedifferences/meshers/fdm1dmesher.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 fdm1dmesher.hpp
23
    \brief One-dimensional simple FDM mesher object working on an index
24
*/
25
26
#ifndef quantlib_fdm_1d_mesher_hpp
27
#define quantlib_fdm_1d_mesher_hpp
28
29
#include <ql/types.hpp>
30
#include <vector>
31
32
namespace QuantLib {
33
34
    class Fdm1dMesher {
35
      public:
36
        explicit Fdm1dMesher(Size size)
37
0
        : locations_(size), dplus_(size), dminus_(size) {}
38
0
        virtual ~Fdm1dMesher() = default;
39
40
0
        Size size() const { return locations_.size(); }
41
0
        Real dplus(Size index) const {return dplus_[index];}
42
0
        Real dminus(Size index) const {return dminus_[index];}
43
0
        Real location(Size index) const {return locations_[index];}
44
0
        const std::vector<Real>& locations() const {return locations_;}
45
46
      protected:
47
        std::vector<Real> locations_;
48
        std::vector<Real> dplus_, dminus_;
49
    };
50
}
51
52
#endif