isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
gpuTopoLayers.h
1 //
2 // Author: Bryan Riel
3 // Copyright 2018
4 //
5 
6 #pragma once
7 
8 #include "forward.h"
9 
10 #include <iostream>
11 #include <isce3/core/Common.h>
12 #include <isce3/geometry/forward.h>
13 
14 // DEMInterpolator declaration
16 
17  public:
18  // Constructor for host only - allocate memory on device
19  CUDA_HOST gpuTopoLayers(const isce3::geometry::TopoLayers & layers);
20 
21  // Copy constructor on device (these should nominally be CUDA_HOSTDEV)
22  CUDA_HOSTDEV
23  gpuTopoLayers(const gpuTopoLayers & layers) :
24  _x(layers._x),
25  _y(layers._y),
26  _z(layers._z),
27  _inc(layers._inc),
28  _hdg(layers._hdg),
29  _localInc(layers._localInc),
30  _localPsi(layers._localPsi),
31  _sim(layers._sim),
32  _crossTrack(layers._crossTrack),
33  _length(layers.length()),
34  _width(layers.width()),
35  _nbytes_double(layers.nbytes_double()),
36  _nbytes_float(layers.nbytes_float()),
37  _owner(false)
38  {}
39 
40  // Destructor
41  CUDA_HOST ~gpuTopoLayers();
42 
43  // Set values for a single index; on GPU, all arrays are flattened
44  CUDA_DEV inline void x(size_t index, double value) {
45  _x[index] = value;
46  }
47 
48  CUDA_DEV inline void y(size_t index, double value) {
49  _y[index] = value;
50  }
51 
52  CUDA_DEV inline void z(size_t index, double value) {
53  _z[index] = value;
54  }
55 
56  CUDA_DEV inline void inc(size_t index, float value) {
57  _inc[index] = value;
58  }
59 
60  CUDA_DEV inline void hdg(size_t index, float value) {
61  _hdg[index] = value;
62  }
63 
64  CUDA_DEV inline void localInc(size_t index, float value) {
65  _localInc[index] = value;
66  }
67 
68  CUDA_DEV inline void localPsi(size_t index, float value) {
69  _localPsi[index] = value;
70  }
71 
72  CUDA_DEV inline void sim(size_t index, float value) {
73  _sim[index] = value;
74  }
75 
76  CUDA_DEV inline void crossTrack(size_t index, double value) {
77  _crossTrack[index] = value;
78  }
79 
80  // Get sizes on host or device
81  CUDA_HOSTDEV inline size_t length() const { return _length; }
82  CUDA_HOSTDEV inline size_t width() const { return _width; }
83  CUDA_HOSTDEV inline size_t nbytes_double() const { return _nbytes_double; }
84  CUDA_HOSTDEV inline size_t nbytes_float() const { return _nbytes_float; }
85 
86  // Copy results to host TopoLayers
87  CUDA_HOST void copyToHost(isce3::geometry::TopoLayers & layers);
88 
89  // Unlike CPU version, make the data pointers public to allow for easy
90  // copy construction on the device; still use the underbar convention to discourage
91  // interfacing with pointers directly
92  double * _x;
93  double * _y;
94  double * _z;
95  float * _inc;
96  float * _hdg;
97  float * _localInc;
98  float * _localPsi;
99  float * _sim;
100  double * _crossTrack;
101 
102  private:
103  size_t _length;
104  size_t _width;
105  size_t _nbytes_double, _nbytes_float;
106  bool _owner;
107 };
Definition: gpuTopoLayers.h:15
Definition: TopoLayers.h:15

Generated for ISCE3.0 by doxygen 1.8.5.