LHAPDF  6.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
LogBicubicInterpolator.h
1 // -*- C++ -*-
2 //
3 // This file is part of LHAPDF
4 // Copyright (C) 2012-2020 The LHAPDF collaboration (see AUTHORS for details)
5 //
6 #pragma once
7 #ifndef LHAPDF_LogBicubicInterpolator_H
8 #define LHAPDF_LogBicubicInterpolator_H
9 
10 #include "LHAPDF/Interpolator.h"
11 
12 namespace LHAPDF {
13 
14 
19  public:
20 
22  double _interpolateXQ2(const KnotArray1F& subgrid, double x, size_t ix, double q2, size_t iq2) const;
23 
25  struct XCache {
27  double x = -1;
28  //size_t ix;
29 
31  double logx;
32  double dlogx_1;
33  double tlogx;
34  };
35 
37  struct XCaches {
38 
40  static size_t SIZE;
42  static int UPDATE_STEP;
44  static bool UPDATE_ON_HIT;
45 
47  static void setup(size_t size, int update_step=+1, bool update_on_hit=true);
49  static void init();
50 
52  size_t ilast = 0;
53 
55  vector<XCache> caches{SIZE};
56 
58  size_t size() { return caches.size(); }
59 
61  XCache& operator[] (size_t index) { return caches[index]; }
62 
63  };
64 
65 
67  struct Q2Cache {
69  double q2 = -1;
70 
72  double logq2;
73  double dlogq_0;
74  double dlogq_1;
75  double dlogq_2;
76  double tlogq;
77  };
78 
80  struct Q2Caches {
81 
83  static size_t SIZE;
85  static int UPDATE_STEP;
87  static bool UPDATE_ON_HIT;
88 
90  static void setup(size_t size, int update_step=+1, bool update_on_hit=true);
92  static void init();
93 
95  size_t ilast = 0;
96 
98  vector<Q2Cache> caches{SIZE};
99 
101  size_t size() { return caches.size(); }
102 
104  Q2Cache& operator[] (size_t index) { return caches[index]; }
105 
106  };
107 
108 
113  static XCache& _getCacheX(const KnotArray1F& subgrid, double x, size_t ix);
114  static Q2Cache& _getCacheQ2(const KnotArray1F& subgrid, double q2, size_t iq2);
116 
117  };
118 
119 
120 }
121 
122 #endif
static int UPDATE_STEP
Cache access strategy.
Definition: LogBicubicInterpolator.h:85
size_t size()
Get the length of the cache vector.
Definition: LogBicubicInterpolator.h:58
static int UPDATE_STEP
Cache access strategy.
Definition: LogBicubicInterpolator.h:42
static void init()
Initialize a cache on this thread (call with explicit locks to ensure safe initialisation for each th...
double logx
Cached params.
Definition: LogBicubicInterpolator.h:31
size_t ilast
Latest-call index.
Definition: LogBicubicInterpolator.h:95
static bool UPDATE_ON_HIT
Cache access strategy.
Definition: LogBicubicInterpolator.h:87
size_t size()
Get the length of the cache vector.
Definition: LogBicubicInterpolator.h:101
static void init()
Initialize a cache on this thread (call with explicit locks to ensure safe initialisation for each th...
Q2Cache & operator[](size_t index)
Access the index&#39;th element of the cache.
Definition: LogBicubicInterpolator.h:104
double _interpolateXQ2(const KnotArray1F &subgrid, double x, size_t ix, double q2, size_t iq2) const
Implementation of (x,Q2) interpolation.
static size_t SIZE
Number of cache levels.
Definition: LogBicubicInterpolator.h:40
static void setup(size_t size, int update_step=+1, bool update_on_hit=true)
(Re)define cache size and search strategy
A multi-level Q2-variable cache for a single subgrid hash.
Definition: LogBicubicInterpolator.h:80
A single set of cached x-variables.
Definition: LogBicubicInterpolator.h:25
size_t ilast
Latest-call index.
Definition: LogBicubicInterpolator.h:52
static XCache & _getCacheX(const KnotArray1F &subgrid, double x, size_t ix)
Get and update the current caching structs for interpolation params.
vector< XCache > caches
List of N cached-value sets.
Definition: LogBicubicInterpolator.h:55
XCache & operator[](size_t index)
Access the index&#39;th element of the cache.
Definition: LogBicubicInterpolator.h:61
Implementation of bicubic interpolation.
Definition: LogBicubicInterpolator.h:18
The general interface for interpolating between grid points.
Definition: Interpolator.h:21
A single set of cached Q2-variables.
Definition: LogBicubicInterpolator.h:67
static size_t SIZE
Number of cache levels.
Definition: LogBicubicInterpolator.h:83
static void setup(size_t size, int update_step=+1, bool update_on_hit=true)
(Re)define cache size and search strategy
static bool UPDATE_ON_HIT
Cache access strategy.
Definition: LogBicubicInterpolator.h:44
A multi-level x-variable cache for a single subgrid hash.
Definition: LogBicubicInterpolator.h:37
Internal storage class for PDF data point grids.
Definition: KnotArray.h:20
vector< Q2Cache > caches
List of N cached-value sets.
Definition: LogBicubicInterpolator.h:98
double logq2
Cached params.
Definition: LogBicubicInterpolator.h:72