Jpp
18.2.1-ARCA-DF-PATCH
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JTools
JMultiGrid.hh
Go to the documentation of this file.
1
#ifndef __JTOOLS__JMULTIGRID__
2
#define __JTOOLS__JMULTIGRID__
3
4
#include "
JTools/JAbstractMultiMap.hh
"
5
#include "
JTools/JGrid.hh
"
6
7
8
/**
9
* \author mdejong
10
*/
11
12
namespace
JTOOLS {}
13
namespace
JPP {
using namespace
JTOOLS; }
14
15
namespace
JTOOLS {
16
17
18
/**
19
* Simple data structure for an abstract multidimensional map of equidistant elements.
20
*
21
* This class implements the JAbstractMultiMap interface.
22
*/
23
template
<
unsigned
int
N,
class
JAbscissa_t>
24
class
JMultiGrid
:
25
public
virtual
JAbstractMultiMap
<N, JAbscissa_t>,
26
public
JMultiGrid
<N - 1, JAbscissa_t>
27
{
28
public
:
29
typedef
JAbscissa_t
abscissa_type
;
30
typedef
JMultiKey
<
N
- 1,
abscissa_type
>
key_type
;
31
32
using
JMultiGrid<N - 1, JAbscissa_t>::operator
();
33
34
35
/**
36
* Default constructor.
37
*/
38
JMultiGrid
() :
39
JMultiGrid
<
N
- 1, JAbscissa_t>()
40
{}
41
42
43
/**
44
* Constructor.
45
*
46
* \param bounds bounds
47
*/
48
JMultiGrid
(
const
JGrid<abscissa_type>
&
bounds
) :
49
JMultiGrid
<
N
- 1, JAbscissa_t>(bounds)
50
{
51
this->bounds =
bounds
;
52
}
53
54
55
/**
56
* Set bounds.
57
*
58
* \param index index of dimension
59
* \param bounds bounds
60
* \return true if correctly set; else false
61
*/
62
bool
set
(
unsigned
int
index,
const
JGrid<abscissa_type>
&
bounds
)
63
{
64
if
(index ==
N
- 1) {
65
66
this->bounds =
bounds
;
67
68
}
else
if
(index <
N
- 1) {
69
70
return
static_cast<
JMultiGrid
<
N
- 1,
abscissa_type
>
&>(*this).set(index, bounds);
71
}
72
73
return
false
;
74
}
75
76
77
/**
78
* Get abscissa values as a function of given key.
79
*
80
* \param key key
81
* \return abscissa values
82
*/
83
virtual
const
JGrid<abscissa_type>
&
operator()
(
const
key_type
& key)
const override
84
{
85
return
bounds
;
86
}
87
88
protected
:
89
JGrid<JAbscissa_t>
bounds
;
90
};
91
92
93
/**
94
* Terminator class of recursive class JMultiGrid.
95
* This class provides for dummy implementations of interface methods.
96
*/
97
template
<
class
JAbscissa_t>
98
class
JMultiGrid
<0, JAbscissa_t>
99
{
100
protected
:
101
102
typedef
JAbscissa_t
abscissa_type
;
103
104
friend
class
JMultiGrid
<1, JAbscissa_t>;
105
106
107
/**
108
* Default constructor.
109
*/
110
JMultiGrid
()
111
{}
112
113
114
/**
115
* Constructor.
116
*
117
* \param bounds bounds
118
*/
119
JMultiGrid
(
const
JGrid<abscissa_type>
&
bounds
)
120
{}
121
122
123
/**
124
* This method does nothing.
125
*
126
* \param index index
127
* \param bounds bounds
128
* \return false
129
*/
130
bool
set
(
unsigned
int
index,
const
JGrid<abscissa_type>
&
bounds
)
const
131
{
132
return
false
;
133
}
134
135
136
/**
137
* Dummy operator.
138
*/
139
void
operator()
()
const
140
{}
141
};
142
143
144
/**
145
* Helper method for JMultiGrid.
146
*
147
* \param bounds bounds
148
* \return multidimensional grid
149
*/
150
template
<
unsigned
int
N,
class
JAbscissa_t>
151
inline
JMultiGrid<N, JAbscissa_t>
make_multigrid
(
const
JGrid<JAbscissa_t>
& bounds)
152
{
153
return
JMultiGrid<N, JAbscissa_t>
(bounds);
154
}
155
}
156
157
#endif
JTOOLS::JMultiGrid::bounds
JGrid< JAbscissa_t > bounds
Definition:
JMultiGrid.hh:89
JTOOLS::JMultiGrid< 0, JAbscissa_t >::operator()
void operator()() const
Dummy operator.
Definition:
JMultiGrid.hh:139
JTOOLS::JMultiGrid::JMultiGrid
JMultiGrid(const JGrid< abscissa_type > &bounds)
Constructor.
Definition:
JMultiGrid.hh:48
JTOOLS::JMultiGrid::operator()
virtual const JGrid< abscissa_type > & operator()(const key_type &key) const override
Get abscissa values as a function of given key.
Definition:
JMultiGrid.hh:83
JTOOLS::JAbstractMultiMap
Abstract interface for abscissa values of a multidimensional map.
Definition:
JAbstractMultiMap.hh:24
JTOOLS::JAbstractMultiMap::abscissa_type
JAbscissa_t abscissa_type
Definition:
JAbstractMultiMap.hh:27
JAbstractMultiMap.hh
JTOOLS::JMultiKey
Multidimensional key.
Definition:
JMultiKey.hh:34
JTOOLS::JMultiGrid< 0, JAbscissa_t >::JMultiGrid
JMultiGrid()
Default constructor.
Definition:
JMultiGrid.hh:110
JTOOLS::JMultiGrid::JMultiGrid
JMultiGrid()
Default constructor.
Definition:
JMultiGrid.hh:38
JTOOLS::JMultiGrid< 0, JAbscissa_t >::abscissa_type
JAbscissa_t abscissa_type
Definition:
JMultiGrid.hh:102
JTOOLS::JMultiGrid::set
bool set(unsigned int index, const JGrid< abscissa_type > &bounds)
Set bounds.
Definition:
JMultiGrid.hh:62
JGrid.hh
JTOOLS::JMultiGrid< 0, JAbscissa_t >::set
bool set(unsigned int index, const JGrid< abscissa_type > &bounds) const
This method does nothing.
Definition:
JMultiGrid.hh:130
JTOOLS::JMultiGrid< 0, JAbscissa_t >::JMultiGrid
JMultiGrid(const JGrid< abscissa_type > &bounds)
Constructor.
Definition:
JMultiGrid.hh:119
N
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition:
JMuonPostfit.sh:40
JTOOLS::JMultiGrid::abscissa_type
JAbscissa_t abscissa_type
Definition:
JMultiGrid.hh:29
JTOOLS::JGrid
Simple data structure for an abstract collection of equidistant abscissa values.
Definition:
JGrid.hh:38
JTOOLS::JMultiGrid::key_type
JMultiKey< N-1, abscissa_type > key_type
Definition:
JMultiGrid.hh:30
JTOOLS::JMultiGrid
Simple data structure for an abstract multidimensional map of equidistant elements.
Definition:
JMultiGrid.hh:24
JTOOLS::make_multigrid
JMultiGrid< N, JAbscissa_t > make_multigrid(const JGrid< JAbscissa_t > &bounds)
Helper method for JMultiGrid.
Definition:
JMultiGrid.hh:151
Generated by
1.8.5