isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
gpuPoly2d.h
1 //
2 // Author: Liang Yu
3 // Copyright 2018
4 //
5 
6 #pragma once
7 
8 #include <isce3/core/forward.h>
9 #include <isce3/core/Common.h>
10 
11 #include <cmath>
12 
13 namespace isce3 { namespace cuda { namespace core {
14  struct gpuPoly2d{
15  int rangeOrder;
16  int azimuthOrder;
17  double rangeMean;
18  double azimuthMean;
19  double rangeNorm;
20  double azimuthNorm;
21  double *coeffs;
22  // True if copy-constructed from Orbit (on host),
23  // False if copy-constructed from gpuOrbit (on device)
24  bool owner;
25 
26  // Shallow-copy copy constructor only allowed on device, not host, but not allowed to free
27  // own memory (host copy of gpuPoly2d is only one allowed)
28  CUDA_DEV gpuPoly2d(int ro, int ao, double rm, double am, double rn, double an) : rangeOrder(ro),
29  azimuthOrder(ao),
30  rangeMean(rm),
31  azimuthMean(am),
32  rangeNorm(rn),
33  azimuthNorm(an),
34  owner(false)
35  {}
36  CUDA_HOSTDEV gpuPoly2d() : gpuPoly2d(-1,-1,0.,0.,1.,1.) {}
37  // Advanced "copy constructor only allowed on host (manages deep copies from host to device)
38  CUDA_DEV gpuPoly2d(const gpuPoly2d &p) : rangeOrder(p.rangeOrder), azimuthOrder(p.azimuthOrder),
39  rangeMean(p.rangeMean), azimuthMean(p.azimuthMean),
40  rangeNorm(p.rangeNorm), azimuthNorm(p.azimuthNorm),
41  coeffs(p.coeffs), owner(false) {}
42  CUDA_HOST gpuPoly2d(const isce3::core::Poly2d&);
43  ~gpuPoly2d();
44 
45  CUDA_HOSTDEV inline gpuPoly2d& operator=(const gpuPoly2d&);
46 
47  CUDA_DEV double eval(double, double) const;
48 
49  // Host function to test underlying device function in a single-threaded context
50  CUDA_HOST double eval_h(double, double);
51  };
52 
53 
54  CUDA_HOSTDEV inline gpuPoly2d& gpuPoly2d::operator=(const gpuPoly2d &rhs)
55  {
56  rangeOrder = rhs.rangeOrder;
57  azimuthOrder = rhs.azimuthOrder;
58  rangeMean = rhs.rangeMean;
59  azimuthMean = rhs.azimuthMean;
60  rangeNorm = rhs.rangeNorm;
61  azimuthNorm = rhs.azimuthNorm;
62  coeffs = rhs.coeffs;
63  return *this;
64  }
65 
66 
67 }}}
Data structure for representing 1D polynomials.
Definition: Poly2d.h:25
Definition: gpuPoly2d.h:14

Generated for ISCE3.0 by doxygen 1.8.5.