template<typename ZObject, typename IndexType = int, typename XType = double, typename YType = double>
class genie::BLI2DNonUnifObjectGrid< ZObject, IndexType, XType, YType >
A class template that performs bilinear interpolation on a non-uniform grid with an implementation similar to that of genie::BLI2DNonUnifGrid.
The main differences between this class template and genie::BLI2DNonUnifGrid are
Values for the z coordinate can be any arbitrary object Object
that implements the member functions operator*(double),
operator*(const Object&), and operator+(const Object&)
Rather than C-style arrays, the grid values are accessed via
pointers to std::vector objects
Upper and lower bounds on the grid are found using
std::lower_bound() rather than a manual linear search
The genie::BLI2DNonUnifGrid object does not take ownership of the
grid vectors, which must be stored elsewhere
- Template Parameters
-
ZObject | Type of the object describing each z coordinate |
IndexType | Type to use when computing indices in the vectors |
XType | Type used to represent x coordinates |
YType | Type used to represent y coordinates |
- Todo:
- Think about how to have this class inherit from the other BLI2D classes
- Author
- Steven Gardiner <gardiner fnal.gov> Fermi National Accelerator Laboratory
August 23, 2018
Copyright (c) 2003-2018, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE
Definition at line 49 of file BLI2DNonUnifObjectGrid.h.
template<typename ZObject, typename IndexType = int, typename XType = double, typename YType = double>
template<typename Type >
Determines the indices for the two gridpoints surrounding a requested x or y coordinate. If the x or y coordinate is outside of the grid, this function returns the two closest grid points.
- Parameters
-
[in] | vec | A vector of grid point coordinates |
[in] | val | The requested x or y coordinate |
[out] | lower_index | The index of the closest grid point less than or equal to the requested value, or the lower of the two nearest grid points if the value falls outside of the grid |
[out] | upper_index | The index of the closest grid point greater than the requested value, or the higher of the two nearest grid points if the value falls outside of the grid |
- Returns
- true if the requested value is within the grid, or false otherwise
- Todo:
- Check that the vector contains at least two entries
Definition at line 161 of file BLI2DNonUnifObjectGrid.h.
169 Iterator
begin = vec->begin();
170 Iterator
end = vec->end();
174 Iterator not_less_point = std::lower_bound(begin, end,
val);
176 Iterator lower_point;
179 if (not_less_point == begin) {
182 if (*begin !=
val) within =
false;
184 else if (not_less_point == end) {
187 lower_point = end - 2;
191 lower_point = not_less_point - 1;
195 upper_index = lower_index + 1;
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.