MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
LinearInterpolatingFunction.hh
1
4//
5// This file is part of MARLEY (Model of Argon Reaction Low Energy Yields)
6//
7// MARLEY is free software: you can redistribute it and/or modify it under the
8// terms of version 3 of the GNU General Public License as published by the
9// Free Software Foundation.
10//
11// For the full text of the license please see COPYING or
12// visit http://opensource.org/licenses/GPL-3.0
13//
14// Please respect the MCnet academic usage guidelines. See GUIDELINES
15// or visit https://www.montecarlonet.org/GUIDELINES for details.
16
17#pragma once
18#include <functional>
19#include <vector>
20
21#include "marley/InterpolationGrid.hh"
22#include "marley/InterpolatingFunction.hh"
23
24namespace marley {
25
27 constexpr size_t DEFAULT_N_LINEAR = 200u;
28
31 class LinearInterpolatingFunction : public InterpolatingFunction {
32
33 public:
34
35 LinearInterpolatingFunction( const std::function< double(double) >& func,
36 double x_min, double x_max, size_t N = DEFAULT_N_LINEAR );
37
38 inline double evaluate( double x ) const override {
39 return interp_grid_->interpolate( x );
40 }
41
42 inline int N() const { return interp_grid_->size(); }
43
44 protected:
45
46 std::shared_ptr< InterpolationGrid<double, double> > interp_grid_;
47 };
48
49}
double evaluate(double x) const override
Returns an approximate value of the represented function.