ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TransformationConverter.cu
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <cuda.h>
9 #include <cuda_runtime.h>
10 
11 #include "cloudViewer/t/pipelines/kernel/TransformationConverterImpl.h"
12 
13 namespace cloudViewer {
14 namespace t {
15 namespace pipelines {
16 namespace kernel {
17 
18 template <typename scalar_t>
19 __global__ void PoseToTransformationKernel(scalar_t *transformation_ptr,
20  const scalar_t *X_ptr) {
21  PoseToTransformationImpl(transformation_ptr, X_ptr);
22 }
23 
24 template <typename scalar_t>
25 void PoseToTransformationCUDA(scalar_t *transformation_ptr,
26  const scalar_t *X_ptr) {
27  utility::LogError("Unsupported data type.");
28 }
29 
30 template <>
31 void PoseToTransformationCUDA<float>(float *transformation_ptr,
32  const float *X_ptr) {
33  PoseToTransformationKernel<float>
34  <<<1, 1, 0, core::cuda::GetStream()>>>(transformation_ptr, X_ptr);
35 }
36 
37 template <>
38 void PoseToTransformationCUDA<double>(double *transformation_ptr,
39  const double *X_ptr) {
40  PoseToTransformationKernel<double>
41  <<<1, 1, 0, core::cuda::GetStream()>>>(transformation_ptr, X_ptr);
42 }
43 
44 template <typename scalar_t>
45 __global__ void TransformationToPoseKernel(scalar_t *X_ptr,
46  const scalar_t *transformation_ptr) {
47  TransformationToPoseImpl(X_ptr, transformation_ptr);
48 }
49 
50 template <typename scalar_t>
51 void TransformationToPoseCUDA(scalar_t *X_ptr,
52  const scalar_t *transformation_ptr) {
53  utility::LogError("Unsupported data type.");
54 }
55 
56 template <>
57 void TransformationToPoseCUDA<float>(float *X_ptr,
58  const float *transformation_ptr) {
59  TransformationToPoseKernel<float>
60  <<<1, 1, 0, core::cuda::GetStream()>>>(X_ptr, transformation_ptr);
61 }
62 
63 template <>
64 void TransformationToPoseCUDA<double>(double *X_ptr,
65  const double *transformation_ptr) {
66  TransformationToPoseKernel<double>
67  <<<1, 1, 0, core::cuda::GetStream()>>>(X_ptr, transformation_ptr);
68 }
69 
70 } // namespace kernel
71 } // namespace pipelines
72 } // namespace t
73 } // namespace cloudViewer