cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
N/A
Central exclusive processes event generator
Toggle main menu visibility
Main Page
Related Pages
Packages
Package List
Package Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Variables
Typedefs
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
b
c
d
e
g
h
i
l
m
n
p
r
t
u
w
x
y
z
Related Symbols
d
g
h
o
u
v
Files
File List
File Members
All
_
a
b
c
d
e
h
o
p
r
s
Functions
Variables
Macros
_
b
c
d
e
p
r
s
▼
CepGen
Reference manual
Bibliography
►
Packages
►
Classes
▼
Files
▼
File List
▼
include
▼
CepGen
►
Cards
►
Core
►
Event
►
EventFilter
►
FormFactors
►
Integration
►
Modules
►
PartonFluxes
►
Physics
►
Process
►
StructureFunctions
▼
Utils
►
AbortHandler.h
►
Algebra.h
►
ArgumentsParser.h
►
Caller.h
►
Collections.h
►
Derivator.h
►
DocumentationGenerator.h
►
Drawable.h
►
Drawer.h
►
Environment.h
►
EventUtils.h
►
Filesystem.h
►
Functional.h
►
FunctionWrapper.h
►
Graph.h
►
GridDrawer.h
►
GridHandler.h
►
GSLFunctionWrapper.h
►
GSLMonteFunctionWrapper.h
►
Hasher.h
►
Histogram.h
►
Limits.h
►
Logger.h
►
Math.h
►
Message.h
►
Piper.h
►
ProcessVariablesAnalyser.h
►
ProgressBar.h
►
RandomGenerator.h
►
StreamCollector.h
►
String.h
►
Test.h
►
TimeKeeper.h
►
Timer.h
►
Value.h
►
Generator.h
►
Version.h
►
CepGenBoost
►
CepGenHepMC2
►
CepGenHepMC3
►
CepGenHerwig6
►
CepGenMadGraph
►
CepGenPythia6
►
CepGenPythia8
►
CepGenPython
►
CepGenRoot
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
GridHandler.h
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2018-2025 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef CepGen_Utils_GridHandler_h
20
#define CepGen_Utils_GridHandler_h
21
22
#include <gsl/gsl_interp.h>
23
#include <gsl/gsl_spline.h>
24
#include <gsl/gsl_version.h>
25
#if defined(GSL_MAJOR_VERSION) && (GSL_MAJOR_VERSION > 2 || (GSL_MAJOR_VERSION == 2 && GSL_MINOR_VERSION >= 1))
26
#include <gsl/gsl_spline2d.h>
27
#define GSL_VERSION_ABOVE_2_1 1
28
#endif
29
30
#include <array>
31
#include <map>
32
#include <memory>
33
34
#include "
CepGen/Utils/Limits.h
"
35
36
namespace
cepgen
{
38
enum struct
GridType
{
linear
,
logarithmic
,
square
};
42
template
<
size_t
D,
size_t
N = 1>
43
class
GridHandler
{
44
public
:
45
explicit
GridHandler
(
const
GridType
& grid_type);
46
virtual
~GridHandler
() =
default
;
47
48
using
coord_t
= std::vector<double>;
49
using
values_t
= std::array<double, N>;
50
51
values_t
eval
(
const
coord_t
& in_coords)
const
;
52
53
void
insert
(
const
coord_t
& coord,
values_t
value);
54
inline
std::map<coord_t, values_t>
values
()
const
{
return
values_raw_
; }
55
56
void
initialise
();
57
std::array<Limits, D>
boundaries
()
const
;
58
std::array<double, D>
min
()
const
;
59
std::array<double, D>
max
()
const
;
60
61
protected
:
62
const
GridType
grid_type_
;
63
std::map<coord_t, values_t>
values_raw_
;
65
std::vector<std::unique_ptr<gsl_interp_accel, void (*)(gsl_interp_accel*)> >
accelerators_
;
66
std::vector<std::unique_ptr<gsl_spline, void (*)(gsl_spline*)> >
splines_1d_
;
67
#ifdef GSL_VERSION_ABOVE_2_1
69
std::vector<std::unique_ptr<gsl_spline2d, void (*)(gsl_spline2d*)> > splines_2d_;
70
#endif
71
std::array<coord_t, D>
coordinates_
;
72
std::array<std::unique_ptr<double[]>, N>
values_
;
73
74
private
:
75
void
findIndices(
const
coord_t
& coord,
coord_t
&
min
,
coord_t
&
max
)
const
;
77
struct
grid_point_t :
values_t
{
78
grid_point_t(
const
values_t
& arr) :
values_t
(arr) {}
79
grid_point_t operator*(
double
c)
const
;
80
grid_point_t operator+(
const
grid_point_t& rhs)
const
;
81
};
82
bool
initialised_{
false
};
83
};
84
}
// namespace cepgen
85
86
#endif
56
void
initialise
(); {
…
}
43
class
GridHandler
{
…
};
Limits.h
cepgen::GridHandler
A generic class for grid interpolation.
Definition
GridHandler.h:43
cepgen::GridHandler::splines_1d_
std::vector< std::unique_ptr< gsl_spline, void(*)(gsl_spline *)> > splines_1d_
Splines for linear interpolations.
Definition
GridHandler.h:66
cepgen::GridHandler::eval
values_t eval(const coord_t &in_coords) const
Interpolate a point to a given coordinate.
cepgen::GridHandler::initialise
void initialise()
Initialise the grid and all useful interpolators/accelerators.
cepgen::GridHandler::values_raw_
std::map< coord_t, values_t > values_raw_
List of coordinates and associated value(s) in the grid Grid interpolation accelerator.
Definition
GridHandler.h:63
cepgen::GridHandler::values_
std::array< std::unique_ptr< double[]>, N > values_
Values for all points in the grid.
Definition
GridHandler.h:72
cepgen::GridHandler::values_t
std::array< double, N > values_t
Value(s) at a given coordinate.
Definition
GridHandler.h:49
cepgen::GridHandler::insert
void insert(const coord_t &coord, values_t value)
Insert a new value in the grid.
cepgen::GridHandler::accelerators_
std::vector< std::unique_ptr< gsl_interp_accel, void(*)(gsl_interp_accel *)> > accelerators_
Definition
GridHandler.h:65
cepgen::GridHandler::coordinates_
std::array< coord_t, D > coordinates_
Coordinates building up the grid.
Definition
GridHandler.h:71
cepgen::GridHandler::boundaries
std::array< Limits, D > boundaries() const
Grid boundaries (collection of (min,max))
cepgen::GridHandler::~GridHandler
virtual ~GridHandler()=default
cepgen::GridHandler::coord_t
std::vector< double > coord_t
Coordinates container.
Definition
GridHandler.h:48
cepgen::GridHandler::max
std::array< double, D > max() const
Highest bound of the grid coordinates.
cepgen::GridHandler::grid_type_
const GridType grid_type_
Type of interpolation for the grid members.
Definition
GridHandler.h:62
cepgen::GridHandler::min
std::array< double, D > min() const
Lowest bound of the grid coordinates.
cepgen::GridHandler::GridHandler
GridHandler(const GridType &grid_type)
Build a grid interpolator from a grid type.
cepgen::GridHandler::values
std::map< coord_t, values_t > values() const
List of values in the grid.
Definition
GridHandler.h:54
cepgen
Common namespace for this Monte Carlo generator.
Definition
Handler.h:26
cepgen::GridType
GridType
Interpolation type for the grid coordinates.
Definition
GridHandler.h:38
cepgen::GridType::square
@ square
cepgen::GridType::logarithmic
@ logarithmic
cepgen::GridType::linear
@ linear
include
CepGen
Utils
GridHandler.h
Generated on Tue Apr 22 2025 for CepGen by
1.10.0