QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmmesher.hpp
Go to the documentation of this file.
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 <http://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
33namespace QuantLib {
34 class FdmLinearOpLayout;
35 class FdmLinearOpIterator;
36
37 class FdmMesher {
38 public:
39 explicit FdmMesher(ext::shared_ptr<FdmLinearOpLayout> layout)
40 : layout_(std::move(layout)) {}
41 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 const ext::shared_ptr<FdmLinearOpLayout>& layout() const {
52 return layout_;
53 }
54
55 protected:
56 const ext::shared_ptr<FdmLinearOpLayout> layout_;
57 };
58}
59
60#endif
1-D array used in linear algebra.
1-D array used in linear algebra.
Definition: array.hpp:52
FdmMesher(ext::shared_ptr< FdmLinearOpLayout > layout)
Definition: fdmmesher.hpp:39
virtual Real location(const FdmLinearOpIterator &iter, Size direction) const =0
virtual Array locations(Size direction) const =0
virtual ~FdmMesher()=default
virtual Real dminus(const FdmLinearOpIterator &iter, Size direction) const =0
const ext::shared_ptr< FdmLinearOpLayout > layout_
Definition: fdmmesher.hpp:56
const ext::shared_ptr< FdmLinearOpLayout > & layout() const
Definition: fdmmesher.hpp:51
virtual Real dplus(const FdmLinearOpIterator &iter, Size direction) const =0
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
STL namespace.
Maps shared_ptr to either the boost or std implementation.