isce3 0.25.0
Loading...
Searching...
No Matches
gpuLUT2d.h
1#pragma once
2
3#include "forward.h"
4#include <isce3/core/forward.h>
5#include <isce3/cuda/core/forward.h>
6
7#include <cmath>
8
9#include <isce3/core/Common.h>
10#include <isce3/core/Constants.h>
11
12namespace isce3 { namespace cuda { namespace core {
13
14template<typename T>
15class gpuLUT2d {
16public:
19
21 gpuLUT2d(const gpuLUT2d<T>&);
22
24 CUDA_HOSTDEV gpuLUT2d(gpuLUT2d<T>&);
25
27 CUDA_HOSTDEV gpuLUT2d& operator=(gpuLUT2d<T>&);
28
30 ~gpuLUT2d();
31
33 CUDA_HOSTDEV double xStart() const { return _xstart; }
34
36 CUDA_HOSTDEV double yStart() const { return _ystart; }
37
39 CUDA_HOSTDEV double xEnd() const { return xStart() + (width() - 1) * xSpacing(); }
40
42 CUDA_HOSTDEV double yEnd() const { return yStart() + (length() - 1) * ySpacing(); }
43
45 CUDA_HOSTDEV double xSpacing() const { return _dx; }
46
48 CUDA_HOSTDEV double ySpacing() const { return _dy; }
49
51 CUDA_HOSTDEV size_t length() const { return _length; }
52
54 CUDA_HOSTDEV size_t width() const { return _width; }
55
57 CUDA_HOSTDEV T refValue() const { return _refValue; }
58
60 CUDA_HOSTDEV bool haveData() const { return _haveData; }
61
63 CUDA_HOSTDEV bool boundsError() const { return _boundsError; }
64
66 CUDA_HOSTDEV
67 isce3::core::dataInterpMethod interpMethod() const { return _interpMethod; }
68
70 CUDA_HOSTDEV gpuInterpolator<T>** interp() const { return _interp; }
71
73 CUDA_HOSTDEV T* data() { return _data; }
74
76 CUDA_HOSTDEV const T* data() const { return _data; }
77
79 CUDA_HOSTDEV void data(T* v) { _data = v; }
80
88 CUDA_DEV T eval(double y, double x) const;
89
91 T eval_h(double y, double x);
92
94 CUDA_HOSTDEV bool contains(double y, double x) const
95 {
96 // Treat default-constructed LUT as having infinite extent.
97 if (not _haveData) {
98 return true;
99 }
100
101 return (x >= xStart()) and (x <= xEnd()) and
102 (y >= yStart()) and (y <= yEnd());
103 }
104
105private:
106 // Flags
107 bool _haveData;
108 bool _boundsError;
109 T _refValue;
110 // Coordinates
111 double _xstart, _ystart, _dx, _dy;
112 // LUT data
113 size_t _length, _width;
114 T* _data;
115 // Interpolator pointer
116 isce3::core::dataInterpMethod _interpMethod;
117 gpuInterpolator<T>** _interp;
118 // Do I own data?
119 bool _owner;
120
121 // Interpolation pointer handlers
122
124 void _initInterp();
125
127 void _finalizeInterp();
128};
129
130}}} // namespace isce3::cuda::core
Data structure to store 2D Lookup table.
Definition LUT2d.h:20
Definition gpuInterpolator.h:13
CUDA_HOSTDEV const T * data() const
Read-only access to data values.
Definition gpuLUT2d.h:76
CUDA_HOSTDEV double yStart() const
Get starting Y-coordinate.
Definition gpuLUT2d.h:36
CUDA_HOSTDEV double xSpacing() const
Get X-spacing.
Definition gpuLUT2d.h:45
CUDA_HOSTDEV size_t width() const
Get LUT width (number of samples)
Definition gpuLUT2d.h:54
CUDA_HOSTDEV bool boundsError() const
Get bounds error flag.
Definition gpuLUT2d.h:63
CUDA_HOSTDEV bool haveData() const
Get flag for having data.
Definition gpuLUT2d.h:60
~gpuLUT2d()
Destructor.
Definition gpuLUT2d.cu:150
CUDA_HOSTDEV bool contains(double y, double x) const
Check if point resides in domain of LUT.
Definition gpuLUT2d.h:94
CUDA_HOSTDEV isce3::core::dataInterpMethod interpMethod() const
Get interp method.
Definition gpuLUT2d.h:67
CUDA_HOSTDEV gpuInterpolator< T > ** interp() const
Get pointer to interpolator.
Definition gpuLUT2d.h:70
CUDA_HOSTDEV double yEnd() const
Get end Y-coordinate.
Definition gpuLUT2d.h:42
gpuLUT2d(const isce3::core::LUT2d< T > &)
Deep copy constructor from CPU LUT1d.
Definition gpuLUT2d.cu:74
CUDA_HOSTDEV double xStart() const
Get starting X-coordinate.
Definition gpuLUT2d.h:33
CUDA_HOSTDEV T refValue() const
Get the reference value.
Definition gpuLUT2d.h:57
CUDA_HOSTDEV gpuLUT2d & operator=(gpuLUT2d< T > &)
Shallow assignment operator on device.
Definition gpuLUT2d.cu:131
CUDA_HOSTDEV double xEnd() const
Get end X-coordinate.
Definition gpuLUT2d.h:39
CUDA_HOSTDEV void data(T *v)
Set the data values pointer.
Definition gpuLUT2d.h:79
CUDA_DEV T eval(double y, double x) const
Evaluate the LUT.
Definition gpuLUT2d.cu:161
T eval_h(double y, double x)
Evaluate the LUT from host (test function)
Definition gpuLUT2d.cu:199
CUDA_HOSTDEV double ySpacing() const
Get Y-spacing.
Definition gpuLUT2d.h:48
CUDA_HOSTDEV size_t length() const
Get LUT length (number of lines)
Definition gpuLUT2d.h:51
CUDA_HOSTDEV T * data()
Access to data values.
Definition gpuLUT2d.h:73
base interpolator is an abstract base class
Definition BinarySearchFunc.cpp:5

Generated for ISCE3.0 by doxygen 1.13.2.