59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
|
#ifndef id134A9223C9F7403B9BC600DCAC4875BC
|
||
|
#define id134A9223C9F7403B9BC600DCAC4875BC
|
||
|
|
||
|
#include "doorkeeper/implem/configuration.h"
|
||
|
#include "vectorwrapper/vectorwrapper.hpp"
|
||
|
#include <cstdint>
|
||
|
#include <cstddef>
|
||
|
#include <array>
|
||
|
#if defined(WITH_VECTOR_IOSTREAM)
|
||
|
# include <iostream>
|
||
|
#endif
|
||
|
|
||
|
namespace vwr {
|
||
|
template <std::size_t D>
|
||
|
struct VectorWrapperInfo<std::array<dk::CoordinateScalarType, 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;
|
||
|
|
||
|
static scalar_type& get_at (std::size_t parIndex, vector_type& parVector) {
|
||
|
return parVector[parIndex];
|
||
|
}
|
||
|
};
|
||
|
template <>
|
||
|
struct VectorWrapperInfo<std::array<dk::CoordinateScalarType, 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;
|
||
|
|
||
|
static scalar_type& get_at (std::size_t, vector_type& parVector) {
|
||
|
return parVector[0];
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#if defined(WITH_VECTOR_IOSTREAM)
|
||
|
template <typename V>
|
||
|
std::ostream& operator<< (std::ostream& parStream, const vwr::Vec<V>& parVec) {
|
||
|
const int dim = vwr::Vec<V>::dimensions;
|
||
|
parStream << '<';
|
||
|
for (int z = 0; z < dim - 1; ++z) {
|
||
|
parStream << parVec[z] << ", ";
|
||
|
}
|
||
|
parStream << parVec[dim - 1] << '>';
|
||
|
return parStream;
|
||
|
}
|
||
|
#endif
|
||
|
} //namespace vwr
|
||
|
|
||
|
#endif
|