Skip to content

Commit cb2be7c

Browse files
gshiromaLiang Yu
authored andcommitted
Update GCOV projection (#742)
* push GCOV projection changes from #604 * add default pixel spacing in geogrid.py if outputEPSG differs from the DEM epsg code * revert changes to .ci/jenkins/PR-isce-develop/build.sh * revert changes to .ci/jenkins/PR-isce-develop/build.sh (2) * remove unnecessary comments, whitespaces, simplify code * substitute (int) 0 by 0 * fix block reading of the input raster * substitute C-style cast by static_cast * substitute C-style cast by static_cast (2) * substitute C-style cast by static_cast (3) * Update python/packages/pybind_nisar/workflows/geogrid.py Co-Authored-By: Liang Yu <[email protected]> * use OSGEO OSR to test if EPSG reffers to geographic coordinates (lat/lon) * add comment to the margin of 100 pixels used to load the DEM for geocoding the geogrid block * substitute C-style cast with static cast * merge develop into update_gcov_projection (2) * fix load of DEM from the RTC module * fix print of geogrid parameters using pyre * rename GetDemCoordsSameEpsg() to getDemCoordsSameEpsg() * include <functional> in order to get access to std::function * substitute C-style cast with static_cast * make non-public local function static * add more comments explaining use of getDemCoords() * add comments about cropping indexes between min X, Y and max X, Y * pass std::function by const reference * run "git-clang-format develop" Co-authored-by: Liang Yu <[email protected]>
1 parent 38a142c commit cb2be7c

38 files changed

+1585
-1524
lines changed

cxx/isce3/core/DenseMatrix.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <cmath>
66
#define EIGEN_MPL2_ONLY
77
#include <Eigen/Dense>
8+
89
#include "Common.h"
910
#include "Vector.h"
1011

@@ -16,16 +17,19 @@ class DenseMatrix : public Eigen::Matrix<T, N, N> {
1617
using super_t::super_t;
1718

1819
static_assert(N > 0);
20+
1921
public:
2022
DenseMatrix() = default;
2123
CUDA_HOSTDEV auto operator[](int i) { return this->row(i); }
2224
CUDA_HOSTDEV auto operator[](int i) const { return this->row(i); }
2325

24-
CUDA_HOSTDEV auto dot(const DenseMatrix& other) const {
26+
CUDA_HOSTDEV auto dot(const DenseMatrix& other) const
27+
{
2528
return *this * other;
2629
}
2730

28-
CUDA_HOSTDEV auto dot(const Vector<N, T>& other) const {
31+
CUDA_HOSTDEV auto dot(const Vector<N, T>& other) const
32+
{
2933
return *this * other;
3034
}
3135

@@ -87,8 +91,8 @@ CUDA_HOSTDEV Mat3 DenseMatrix<N, T>::enuToXyz(double lat, double lon)
8791
// multiplication produced incorrect results (or raised "illegal memory access"
8892
// errors in debug mode).
8993
template<int N, typename T>
90-
CUDA_HOSTDEV auto
91-
operator*(const DenseMatrix<N, T>& a, const DenseMatrix<N, T>& b)
94+
CUDA_HOSTDEV auto operator*(
95+
const DenseMatrix<N, T>& a, const DenseMatrix<N, T>& b)
9296
{
9397
DenseMatrix<N, T> out;
9498
for (int i = 0; i < N; ++i) {
@@ -100,8 +104,7 @@ operator*(const DenseMatrix<N, T>& a, const DenseMatrix<N, T>& b)
100104
}
101105

102106
template<int N, typename T>
103-
CUDA_HOSTDEV auto
104-
operator*(const DenseMatrix<N, T>& m, const Vector<N, T>& v)
107+
CUDA_HOSTDEV auto operator*(const DenseMatrix<N, T>& m, const Vector<N, T>& v)
105108
{
106109
Vector<N, T> out;
107110
for (int i = 0; i < N; ++i) {

cxx/isce3/cuda/core/InterpolatorHandle.cu

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,39 @@
1-
#include "InterpolatorHandle.h"
1+
#include <cuda_runtime.h>
2+
#include <thrust/complex.h>
3+
#include <thrust/device_vector.h>
4+
5+
#include <pyre/journal.h>
26

37
#include <isce3/cuda/except/Error.h>
48
#include <isce3/except/Error.h>
59

6-
#include <pyre/journal.h>
7-
8-
#include <cuda_runtime.h>
9-
#include <thrust/complex.h>
10-
#include <thrust/device_vector.h>
10+
#include "InterpolatorHandle.h"
1111

1212
template<class T>
1313
using DeviceInterp = isce3::cuda::core::gpuInterpolator<T>;
1414

1515
namespace isce3::cuda::core {
1616

1717
template<class T>
18-
__global__ void init_interp(
19-
DeviceInterp<T>** interp, isce3::core::dataInterpMethod interp_method,
20-
bool * unsupported_interp)
18+
__global__ void init_interp(DeviceInterp<T>** interp,
19+
isce3::core::dataInterpMethod interp_method, bool* unsupported_interp)
2120
{
2221
if (threadIdx.x == 0 && blockIdx.x == 0) {
2322
// Choose interpolator
24-
switch(interp_method) {
25-
case isce3::core::BILINEAR_METHOD:
26-
(*interp) = new isce3::cuda::core::gpuBilinearInterpolator<T>();
27-
break;
28-
case isce3::core::BICUBIC_METHOD:
29-
(*interp) = new isce3::cuda::core::gpuBicubicInterpolator<T>();
30-
break;
31-
case isce3::core::BIQUINTIC_METHOD:
32-
{
33-
size_t order = 6;
34-
(*interp) = new isce3::cuda::core::gpuSpline2dInterpolator<T>(order);
35-
break;
36-
}
37-
default:
38-
*unsupported_interp = true;
39-
break;
23+
switch (interp_method) {
24+
case isce3::core::BILINEAR_METHOD:
25+
(*interp) = new isce3::cuda::core::gpuBilinearInterpolator<T>();
26+
break;
27+
case isce3::core::BICUBIC_METHOD:
28+
(*interp) = new isce3::cuda::core::gpuBicubicInterpolator<T>();
29+
break;
30+
case isce3::core::BIQUINTIC_METHOD: {
31+
size_t order = 6;
32+
(*interp) =
33+
new isce3::cuda::core::gpuSpline2dInterpolator<T>(order);
34+
break;
35+
}
36+
default: *unsupported_interp = true; break;
4037
}
4138
}
4239
}
@@ -56,19 +53,19 @@ InterpolatorHandle<T>::InterpolatorHandle(
5653
checkCudaErrors(cudaMalloc(&_interp, sizeof(DeviceInterp<T>**)));
5754

5855
thrust::device_vector<bool> d_unsupported_interp(1, false);
59-
init_interp<<<1, 1>>>(_interp, interp_method, d_unsupported_interp.data().get());
56+
init_interp<<<1, 1>>>(
57+
_interp, interp_method, d_unsupported_interp.data().get());
6058
checkCudaErrors(cudaPeekAtLastError());
6159
checkCudaErrors(cudaDeviceSynchronize());
6260

6361
bool unsupported_interp = d_unsupported_interp[0];
64-
if (unsupported_interp)
65-
{
62+
if (unsupported_interp) {
6663
pyre::journal::error_t error(
6764
"isce.cuda.core.InterpolatorHandle.InterpolatorHandle");
6865
error << "Unsupported interpolator method provided."
6966
<< pyre::journal::endl;
70-
throw isce3::except::InvalidArgument(ISCE_SRCINFO(),
71-
"Unsupported interpolator method provided.");
67+
throw isce3::except::InvalidArgument(
68+
ISCE_SRCINFO(), "Unsupported interpolator method provided.");
7269
}
7370
}
7471

cxx/isce3/cuda/core/ProjectionBaseHandle.cu

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
#include "ProjectionBaseHandle.h"
1+
#include <cuda_runtime.h>
2+
#include <thrust/device_vector.h>
3+
4+
#include <pyre/journal.h>
25

36
#include <isce3/cuda/except/Error.h>
47
#include <isce3/except/Error.h>
58

6-
#include <pyre/journal.h>
7-
8-
#include <cuda_runtime.h>
9-
#include <thrust/device_vector.h>
9+
#include "ProjectionBaseHandle.h"
1010

1111
namespace isce3::cuda::core {
1212

1313
using isce3::cuda::core::ProjectionBase;
1414

15-
__global__ void init_proj(ProjectionBase** proj, int epsg_code,
16-
bool * proj_invalid)
15+
__global__ void init_proj(
16+
ProjectionBase** proj, int epsg_code, bool* proj_invalid)
1717
{
1818

1919
if (threadIdx.x == 0 && blockIdx.x == 0) {
@@ -41,14 +41,12 @@ ProjectionBaseHandle::ProjectionBaseHandle(int epsg)
4141
checkCudaErrors(cudaDeviceSynchronize());
4242

4343
bool proj_invalid = d_proj_invalid[0];
44-
if (proj_invalid)
45-
{
44+
if (proj_invalid) {
4645
pyre::journal::error_t error(
4746
"isce.cuda.core.ProjectionBaseHandle.ProjectionBaseHandle");
48-
error << "Unsupported EPSG provided."
49-
<< pyre::journal::endl;
50-
throw isce3::except::InvalidArgument(ISCE_SRCINFO(),
51-
"Unsupported ESPG provided.");
47+
error << "Unsupported EPSG provided." << pyre::journal::endl;
48+
throw isce3::except::InvalidArgument(
49+
ISCE_SRCINFO(), "Unsupported ESPG provided.");
5250
}
5351
}
5452

cxx/isce3/cuda/focus/Backproject.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
#include <isce3/container/forward.h>
44
#include <isce3/cuda/container/forward.h>
55
#include <isce3/cuda/geometry/forward.h>
6-
#include <isce3/geometry/detail/Geo2Rdr.h>
7-
#include <isce3/geometry/detail/Rdr2Geo.h>
86
#include <isce3/geometry/forward.h>
97

108
#include <complex>
119

1210
#include <isce3/core/Kernels.h>
1311
#include <isce3/focus/Backproject.h>
1412
#include <isce3/focus/DryTroposphereModel.h>
13+
#include <isce3/geometry/detail/Geo2Rdr.h>
14+
#include <isce3/geometry/detail/Rdr2Geo.h>
1515

1616
namespace isce3 { namespace cuda { namespace focus {
1717

18+
using isce3::focus::DryTroposphereModel;
1819
using isce3::geometry::detail::Geo2RdrParams;
1920
using isce3::geometry::detail::Rdr2GeoParams;
20-
using isce3::focus::DryTroposphereModel;
2121

2222
/**
2323
* Focus in azimuth via time-domain backprojection

0 commit comments

Comments
 (0)