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)
|
||||
# define DK_COORD_DISTANCE_TYPE int64_t
|
||||
#endif
|
||||
#if !defined(DK_COORD_ACCUM_TYPE)
|
||||
# define DK_COORD_ACCUM_TYPE float
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# define MAKE_DK_NAME(a) a
|
||||
|
@ -42,6 +45,7 @@ namespace dk {
|
|||
|
||||
typedef DK_COORD_SCALAR_TYPE MAKE_DK_NAME(CoordinateScalarType);
|
||||
typedef DK_COORD_DISTANCE_TYPE MAKE_DK_NAME(CoordinateDistType);
|
||||
typedef DK_COORD_ACCUM_TYPE MAKE_DK_NAME(CoordinateAccumType);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} //namespace dk
|
||||
|
@ -49,6 +53,7 @@ typedef DK_COORD_DISTANCE_TYPE MAKE_DK_NAME(CoordinateDistType);
|
|||
|
||||
#undef DK_COORD_SCALAR_TYPE
|
||||
#undef DK_COORD_DISTANCE_TYPE
|
||||
#undef DK_COORD_ACCUM_TYPE
|
||||
#undef MAKE_DK_NAME
|
||||
|
||||
#if !defined(NDEBUG) && !defined(NO_DK_ASSERTIONS)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#ifndef id134A9223C9F7403B9BC600DCAC4875BC
|
||||
#define id134A9223C9F7403B9BC600DCAC4875BC
|
||||
|
||||
#include "doorkeeper/implem/configuration.h"
|
||||
#include "vectorwrapper/vectorwrapper.hpp"
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
@ -28,30 +27,30 @@
|
|||
#endif
|
||||
|
||||
namespace vwr {
|
||||
template <std::size_t D>
|
||||
struct VectorWrapperInfo<std::array<dk::CoordinateScalarType, D>> {
|
||||
template <typename T, std::size_t D>
|
||||
struct VectorWrapperInfo<std::array<T, D>> {
|
||||
enum {
|
||||
dimensions = D
|
||||
};
|
||||
|
||||
typedef dk::CoordinateScalarType scalar_type;
|
||||
typedef std::array<dk::CoordinateScalarType, D> vector_type;
|
||||
typedef std::array<dk::CoordinateScalarType, D+1> higher_vector_type;
|
||||
typedef std::array<dk::CoordinateScalarType, D-1> lower_vector_type;
|
||||
typedef T scalar_type;
|
||||
typedef std::array<T, D> vector_type;
|
||||
typedef std::array<T, D+1> higher_vector_type;
|
||||
typedef std::array<T, D-1> lower_vector_type;
|
||||
|
||||
static scalar_type& get_at (std::size_t parIndex, vector_type& parVector) {
|
||||
return parVector[parIndex];
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct VectorWrapperInfo<std::array<dk::CoordinateScalarType, 1>> {
|
||||
template <typename T>
|
||||
struct VectorWrapperInfo<std::array<T, 1>> {
|
||||
enum {
|
||||
dimensions = 1
|
||||
};
|
||||
|
||||
typedef dk::CoordinateScalarType scalar_type;
|
||||
typedef std::array<dk::CoordinateScalarType, 1> vector_type;
|
||||
typedef std::array<dk::CoordinateScalarType, 2> higher_vector_type;
|
||||
typedef T scalar_type;
|
||||
typedef std::array<T, 1> vector_type;
|
||||
typedef std::array<T, 2> higher_vector_type;
|
||||
|
||||
static scalar_type& get_at (std::size_t, vector_type& parVector) {
|
||||
return parVector[0];
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
#include <cstdint>
|
||||
|
||||
namespace dk {
|
||||
template <typename T, uint32_t D>
|
||||
using VectorT = vwr::Vec<std::array<T, D>>;
|
||||
|
||||
template <uint32_t D>
|
||||
using Vector = vwr::Vec<std::array<CoordinateScalarType, D>>;
|
||||
using Vector = VectorT<CoordinateScalarType, D>;
|
||||
} //namespace dk
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue