Mantid
Loading...
Searching...
No Matches
Types.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9// boost::multiprecision is not used here because the
10// with of the number is one WORD bigger, than actual
11// number size, see here
12// https://www.boost.org/doc/libs/1_61_0/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html
13#include "WideInt.h"
14#include <Eigen/Dense>
15#include <ostream>
16
17namespace morton_index {
18using std::operator"" _cppui128;
19using std::operator"" _cppui256;
23} // namespace morton_index
24
25namespace morton_index {
26
27template <size_t ND, typename IntT> using IntArray = Eigen::Array<IntT, static_cast<int>(ND), 1>;
28
29template <size_t ND> using MDCoordinate = Eigen::Array<float, static_cast<int>(ND), 1>;
30
31template <size_t ND> using MDSpaceBounds = Eigen::Array<float, static_cast<int>(ND), 2>;
32template <size_t ND> using MDSpaceDimensions = Eigen::Array<float, static_cast<int>(ND), 1>;
33template <size_t ND> using MDSpaceSteps = Eigen::Array<float, static_cast<int>(ND), 1>;
34
35template <typename CoordT, size_t ND> using AffineND = Eigen::Transform<CoordT, static_cast<int>(ND), Eigen::Affine>;
36
37template <size_t ND> using BinIndices = Eigen::Matrix<size_t, 1, static_cast<int>(ND)>;
38
44
51template <size_t SZ> struct MortonIndex { using type = uint256_t; };
52
53template <> struct MortonIndex<1> { using type = uint8_t; };
54
55template <> struct MortonIndex<2> { using type = uint16_t; };
56
57template <> struct MortonIndex<4> { using type = uint32_t; };
58
59template <> struct MortonIndex<8> { using type = uint64_t; };
60
61template <> struct MortonIndex<12> { using type = Morton96; };
62
63template <> struct MortonIndex<16> { using type = uint128_t; };
64
70template <typename FP> struct UnderlyingInt {};
71
72template <> struct UnderlyingInt<float> { using type = uint32_t; };
73
74template <> struct UnderlyingInt<double> { using type = uint64_t; };
75
83template <size_t ND, typename FP> struct IndexTypes {
84 using MortonType = typename MortonIndex<ND * sizeof(FP)>::type;
86};
87
88} // namespace morton_index
Eigen::Array< float, static_cast< int >(ND), 1 > MDSpaceDimensions
Definition: Types.h:32
Eigen::Matrix< size_t, 1, static_cast< int >(ND)> BinIndices
Definition: Types.h:37
uint96_t Morton96
This class implements the structure of size 96bit, that can be used as Morton index.
Definition: Types.h:43
std::wide_uint< 96 > uint96_t
Definition: Types.h:20
Eigen::Array< float, static_cast< int >(ND), 1 > MDCoordinate
Definition: Types.h:29
Eigen::Transform< CoordT, static_cast< int >(ND), Eigen::Affine > AffineND
Definition: Types.h:35
std::uint256_t uint256_t
Definition: Types.h:22
std::uint128_t uint128_t
Definition: Types.h:21
Eigen::Array< IntT, static_cast< int >(ND), 1 > IntArray
Definition: Types.h:27
Eigen::Array< float, static_cast< int >(ND), 1 > MDSpaceSteps
Definition: Types.h:33
Eigen::Array< float, static_cast< int >(ND), 2 > MDSpaceBounds
Definition: Types.h:31
This structure determines Morton index type and underlying unsigned integer type for the floating poi...
Definition: Types.h:83
typename UnderlyingInt< FP >::type IntType
Definition: Types.h:85
typename MortonIndex< ND *sizeof(FP)>::type MortonType
Definition: Types.h:84
This structure binds the size of accesible memory to store the Morton index to the Morton index type.
Definition: Types.h:51
This structure binds floating point types to the unsigned integer types of the same width.
Definition: Types.h:70