Ponca  93eea5457c48839cb5d16642765afa89fc7cfe66
Point Cloud Analysis library
Loading...
Searching...
No Matches
defines.h
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7
8#pragma once
9
18// Compatibility types, macros, functions
19//
20#ifdef __CUDACC__
21# include <cuda.h>
22# define PONCA_MULTIARCH __host__ __device__
23# define PONCA_MULTIARCH_HOST __host__
24#else
25# define PONCA_MULTIARCH
26# define PONCA_MULTIARCH_HOST
27
28// GCC: compile with -std=c++0x
29# if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ >= 5))
30# if defined(nullptr_t) || (__cplusplus > 199711L) || defined(HACK_GCC_ITS_CPP0X)
31# define __CPP0X__
32# endif
33# endif
34
35#endif // ifdef __CUDACC__
36
37#ifdef __CUDA_ARCH__
38 #define PONCA_MULTIARCH_INCLUDE_STD(FILENAME) "defines.h"
39 #define PONCA_MULTIARCH_STD_MATH(FUNC)
40 #define PONCA_MULTIARCH_STD_MATH_NAMESPACE(FUNC) FUNC
41
42 //see https://nvidia.github.io/libcudacxx/standard_api.html
43 #define PONCA_MULTIARCH_CU_STD_NAMESPACE(FUNC) cuda::std::FUNC
44 #define PONCA_MULTIARCH_INCLUDE_CU_STD(FILENAME) <cuda/std/FILENAME>
45
46 #define PONCA_CUDA_ARCH
47#else
48 #define PONCA_MULTIARCH_INCLUDE_STD(FILENAME) <FILENAME>
49 #define PONCA_MULTIARCH_STD_MATH(FUNC) using std::FUNC;
50 #define PONCA_MULTIARCH_STD_MATH_NAMESPACE(FUNC) std::FUNC
51 #define PONCA_MULTIARCH_CU_STD_NAMESPACE(FUNC) std::FUNC
52 #define PONCA_MULTIARCH_INCLUDE_CU_STD(FILENAME) <FILENAME>
53 #define PONCA_CPU_ARCH
54#endif
55
56#ifndef PONCA_DEBUG
57#define STD_SAFE_AT(C,i) C[i]
58#else
59#define STD_SAFE_AT(C,i) C.at(i)
60#endif
61
62namespace Ponca
63{
74 template <typename T, typename = void>
75 struct hasNormal : std::false_type {};
76
78 template <typename T>
79 struct hasNormal<T, std::void_t<decltype(std::declval<T>().normal())>> : std::true_type {};
80} // namespace Ponca
81
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Utility structure used to detect if a Point has a normal field.
Definition defines.h:75