Add an accumulation type.
This commit is contained in:
parent
6a6dfd9225
commit
71a6ddccdd
3 changed files with 20 additions and 13 deletions
|
@ -32,6 +32,9 @@
|
||||||
#if !defined(DK_COORD_DISTANCE_TYPE)
|
#if !defined(DK_COORD_DISTANCE_TYPE)
|
||||||
# define DK_COORD_DISTANCE_TYPE int64_t
|
# define DK_COORD_DISTANCE_TYPE int64_t
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(DK_COORD_ACCUM_TYPE)
|
||||||
|
# define DK_COORD_ACCUM_TYPE float
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
# define MAKE_DK_NAME(a) a
|
# define MAKE_DK_NAME(a) a
|
||||||
|
@ -42,6 +45,7 @@ namespace dk {
|
||||||
|
|
||||||
typedef DK_COORD_SCALAR_TYPE MAKE_DK_NAME(CoordinateScalarType);
|
typedef DK_COORD_SCALAR_TYPE MAKE_DK_NAME(CoordinateScalarType);
|
||||||
typedef DK_COORD_DISTANCE_TYPE MAKE_DK_NAME(CoordinateDistType);
|
typedef DK_COORD_DISTANCE_TYPE MAKE_DK_NAME(CoordinateDistType);
|
||||||
|
typedef DK_COORD_ACCUM_TYPE MAKE_DK_NAME(CoordinateAccumType);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
} //namespace dk
|
} //namespace dk
|
||||||
|
@ -49,6 +53,7 @@ typedef DK_COORD_DISTANCE_TYPE MAKE_DK_NAME(CoordinateDistType);
|
||||||
|
|
||||||
#undef DK_COORD_SCALAR_TYPE
|
#undef DK_COORD_SCALAR_TYPE
|
||||||
#undef DK_COORD_DISTANCE_TYPE
|
#undef DK_COORD_DISTANCE_TYPE
|
||||||
|
#undef DK_COORD_ACCUM_TYPE
|
||||||
#undef MAKE_DK_NAME
|
#undef MAKE_DK_NAME
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(NO_DK_ASSERTIONS)
|
#if !defined(NDEBUG) && !defined(NO_DK_ASSERTIONS)
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#ifndef id134A9223C9F7403B9BC600DCAC4875BC
|
#ifndef id134A9223C9F7403B9BC600DCAC4875BC
|
||||||
#define id134A9223C9F7403B9BC600DCAC4875BC
|
#define id134A9223C9F7403B9BC600DCAC4875BC
|
||||||
|
|
||||||
#include "doorkeeper/implem/configuration.h"
|
|
||||||
#include "vectorwrapper/vectorwrapper.hpp"
|
#include "vectorwrapper/vectorwrapper.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
@ -28,30 +27,30 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace vwr {
|
namespace vwr {
|
||||||
template <std::size_t D>
|
template <typename T, std::size_t D>
|
||||||
struct VectorWrapperInfo<std::array<dk::CoordinateScalarType, D>> {
|
struct VectorWrapperInfo<std::array<T, D>> {
|
||||||
enum {
|
enum {
|
||||||
dimensions = D
|
dimensions = D
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef dk::CoordinateScalarType scalar_type;
|
typedef T scalar_type;
|
||||||
typedef std::array<dk::CoordinateScalarType, D> vector_type;
|
typedef std::array<T, D> vector_type;
|
||||||
typedef std::array<dk::CoordinateScalarType, D+1> higher_vector_type;
|
typedef std::array<T, D+1> higher_vector_type;
|
||||||
typedef std::array<dk::CoordinateScalarType, D-1> lower_vector_type;
|
typedef std::array<T, D-1> lower_vector_type;
|
||||||
|
|
||||||
static scalar_type& get_at (std::size_t parIndex, vector_type& parVector) {
|
static scalar_type& get_at (std::size_t parIndex, vector_type& parVector) {
|
||||||
return parVector[parIndex];
|
return parVector[parIndex];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <>
|
template <typename T>
|
||||||
struct VectorWrapperInfo<std::array<dk::CoordinateScalarType, 1>> {
|
struct VectorWrapperInfo<std::array<T, 1>> {
|
||||||
enum {
|
enum {
|
||||||
dimensions = 1
|
dimensions = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef dk::CoordinateScalarType scalar_type;
|
typedef T scalar_type;
|
||||||
typedef std::array<dk::CoordinateScalarType, 1> vector_type;
|
typedef std::array<T, 1> vector_type;
|
||||||
typedef std::array<dk::CoordinateScalarType, 2> higher_vector_type;
|
typedef std::array<T, 2> higher_vector_type;
|
||||||
|
|
||||||
static scalar_type& get_at (std::size_t, vector_type& parVector) {
|
static scalar_type& get_at (std::size_t, vector_type& parVector) {
|
||||||
return parVector[0];
|
return parVector[0];
|
||||||
|
|
|
@ -25,8 +25,11 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace dk {
|
namespace dk {
|
||||||
|
template <typename T, uint32_t D>
|
||||||
|
using VectorT = vwr::Vec<std::array<T, D>>;
|
||||||
|
|
||||||
template <uint32_t D>
|
template <uint32_t D>
|
||||||
using Vector = vwr::Vec<std::array<CoordinateScalarType, D>>;
|
using Vector = VectorT<CoordinateScalarType, D>;
|
||||||
} //namespace dk
|
} //namespace dk
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue