Ponca  7d8ac87a7de01d881c9fde3c42e397b44bffb901
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#pragma once
8
17// Compatibility types, macros, functions
18//
19#ifdef __CUDACC__
20# include <cuda.h>
21# define PONCA_MULTIARCH __host__ __device__
22# define PONCA_MULTIARCH_HOST __host__
23#else
24# define PONCA_MULTIARCH
25# define PONCA_MULTIARCH_HOST
26
27// GCC: compile with -std=c++0x
28# if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ >= 5))
29# if defined(nullptr_t) || (__cplusplus > 199711L) || defined(HACK_GCC_ITS_CPP0X)
30# define __CPP0X__
31# endif
32# endif
33
34#endif // ifdef __CUDACC__
35
36#ifdef __CUDACC__
37# define PONCA_MULTIARCH_INCLUDE_STD(FILENAME) "defines.h"
38// __device__ version of math function are implicitly defined by cuda and are not inside any
39// namespaces. However, other classes (such as numeric_limits) are not. We distinguish both
40// cases with the two following macros.
41// Note: When the new min supported version of cuda will be 13.0, we will be
42// able to merge both maccros due to new addition to libcu++ library.
43# define PONCA_MULTIARCH_CU_STD_FUNC(FUNC) using cuda::std::FUNC;
44# define PONCA_MULTIARCH_STD_MATH(FUNC)
45# define PONCA_MULTIARCH_STD_MATH_NAMESPACE(FUNC) FUNC
46
47// see https://nvidia.github.io/libcudacxx/standard_api.html
48# define PONCA_MULTIARCH_CU_STD_NAMESPACE(FUNC) cuda::std::FUNC
49# define PONCA_MULTIARCH_INCLUDE_CU_STD(FILENAME) <cuda/std/FILENAME>
50
51# define PONCA_CUDA_ARCH
52#else
53# define PONCA_MULTIARCH_INCLUDE_STD(FILENAME) <FILENAME>
54# define PONCA_MULTIARCH_CU_STD_FUNC(FUNC) using std::FUNC;
55# define PONCA_MULTIARCH_STD_MATH(FUNC) using std::FUNC;
56# define PONCA_MULTIARCH_STD_MATH_NAMESPACE(FUNC) std::FUNC
57# define PONCA_MULTIARCH_CU_STD_NAMESPACE(FUNC) std::FUNC
58# define PONCA_MULTIARCH_INCLUDE_CU_STD(FILENAME) <FILENAME>
59# define PONCA_CPU_ARCH
60#endif
61
62#ifndef PONCA_DEBUG
63# define STD_SAFE_AT(C, i) C[i]
64#else
65# define STD_SAFE_AT(C, i) C.at(i)
66#endif
67
68#ifndef M_PI
69// Source: http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html
70# define M_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406
71#endif
72
73namespace Ponca
74{
85 template <typename T, typename = void>
86 struct hasNormal : std::false_type
87 {
88 };
89
91 template <typename T>
92 struct hasNormal<T, std::void_t<decltype(std::declval<T>().normal())>> : std::true_type
93 {
94 };
95} // namespace Ponca
96
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:318
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:87