Commit 50e3ee34 authored by ESTERIE Pierre's avatar ESTERIE Pierre

Some components on there way, not working yet, just backup.

parent 1347a28c
......@@ -100,6 +100,7 @@ struct params {
}
};
using namespace scalfmm;
CPP_template(class Iter, class Sent, class Fun)(
......
......@@ -27,10 +27,17 @@
*
* ```
* using FReal = double;
<<<<<<< HEAD
* static constexpr std::size_t dimension = 3;
*
* particle<FReal, dimension, int, float, float, float, float>;
* particle<FReal, dimension, int, scalfmm::pack<4, float> >;
=======
* static constexpr std::size_t Dim = 3;
*
* particle<FReal, Dim, int, float, float, float, float>;
* particle<FReal, Dim, int, scalfmm::pack<4, float> >;
>>>>>>> Some components on there way, not working yet, just backup.
* ```
*
* The base of these two classes is
......@@ -53,7 +60,11 @@
*
*
* \tparam FReal Floating point type
<<<<<<< HEAD
* \tparam dimension Space dimension count
=======
* \tparam Dim Space dimension count
>>>>>>> Some components on there way, not working yet, just backup.
* \tparam Types Attributes type list
*
*/
......@@ -199,7 +210,7 @@ namespace scalfmm::container
~particle() = default;
private:
/**
/**
* \brief Contructor implementation
*
* Builds the particle, zero constructing missing arguuments.
......@@ -257,3 +268,4 @@ namespace scalfmm::container
} // namespace scalfmm::container
#endif // SCALFMM_CONTAINER_PARTICLE_HPP
......@@ -43,3 +43,4 @@ namespace scalfmm::container
} // namespace scalfmm::container
#endif // SCALFMM_CONTAINER_PARTICLE_CONTAINER_HPP
......@@ -81,7 +81,6 @@ namespace scalfmm::component
tree(tree&& other) = default;
tree& operator=(tree&& other) = default;
~tree() = default;
};
} // end namespace scalfmm::coomponents
......
#ifndef SCALFMM_SPACE_CURVE_HPP_
#define SCALFMM_SPACE_CURVE_HPP_
// See LICENCE file at project root
//
#ifndef SCALFMM_CONTAINER_MORTON_CURVE_HPP
#define SCALFMM_CONTAINER_MORTON_CURVE_HPP
#include "Utils/FPoint.hpp"
#include <scalfmm/container/point.hpp>
#include <scalfmm/meta/const_functions.hpp>
/** Provides the corner traversal order of an N dimension hypercube
*
......@@ -22,77 +25,85 @@
*
* \tparam Dim The hypercube dimension.
*/
template<std::size_t _Dim>
class FZCurve {
public:
/// Space dimension count
constexpr static const std::size_t Dim = _Dim;
/// Position type used
using position_t = FPoint<bool, Dim>;
/// Position count in the grid
constexpr static std::size_t pos_count = Fpow(2,Dim);
namespace scalfmm::container
{
private:
/// Array of positions type
using position_array_t = std::array<position_t, pos_count>;
/// Array to cache the positions corresponding to indexes
static const position_array_t _positions;
template<std::size_t _Dim>
class z_curve
{
public:
/// Space dimension count
static const std::size_t Dim = _Dim;
/// Position type used
using position_t = point<bool, Dim>;
/// Position count in the grid
static const std::size_t pos_count = pow(2,Dim);
/** Creates an array of positions to initialize #_positions */
static position_array_t create_array() noexcept {
private:
/// Array of positions type
using position_array_t = std::array<position_t, pos_count>;
/// Array to cache the positions corresponding to indexes
static const position_array_t _positions;
/** Creates an array of positions to initialize #_positions */
static position_array_t create_array() noexcept {
position_array_t positions;
for(std::size_t i = 0; i < pos_count; ++i) {
for(std::size_t j = Dim-1, k = i; k != 0; --j, k >>=1) {
positions[i][j] = k % 2;
}
for(std::size_t j = Dim-1, k = i; k != 0; --j, k >>=1) {
positions[i][j] = k % 2;
}
}
return positions;
}
}
public:
/** The position corresponding to an index
*
* \param idx The index of the point in the space filling curve
* \return The position corresponding to the space filling curve index
*/
static position_t position(std::size_t idx) noexcept {
public:
/** The position corresponding to an index
*
* \param idx The index of the point in the space filling curve
* \return The position corresponding to the space filling curve index
*/
static position_t position(std::size_t idx) noexcept
{
return _positions[idx];
}
}
/** Index in the space filling curve of a boolean position
*
* \param p The position
* \return The space filling curve index corresponding to the position
*/
static std::size_t index(const position_t& p) noexcept {
/** Index in the space filling curve of a boolean position
*
* \param p The position
* \return The space filling curve index corresponding to the position
*/
static std::size_t index(const position_t& p) noexcept
{
std::size_t idx = 0;
for(auto i : p) {
idx <<= 1;
idx += i;
idx <<= 1;
idx += i;
}
return idx;
}
}
/** Index in the space filling curve of a real position relative to the center of the hypercube
*
* \param p The position
* \param center The center of the hypercube
* \return The space filling curve index corresponding to the position
*/
template<typename FReal>
static std::size_t index(const FPoint<FReal, Dim>& p, const FPoint<FReal, Dim>& center) noexcept {
std::size_t idx = 0;
for(std::size_t i = 0; i < Dim; ++i) {
/** Index in the space filling curve of a real position relative to the center of the hypercube
*
* \param p The position
* \param center The center of the hypercube
* \return The space filling curve index corresponding to the position
*/
template<typename T>
static std::size_t index(const point<T, Dim>& p, const point<T, Dim>& center) noexcept
{
std::size_t idx = 0;
for(std::size_t i = 0; i < Dim; ++i) {
idx <<= 1;
idx += p[i] > center[i];
}
return idx;
}
return idx;
}
};
};
// Initialization of static variable
template<std::size_t _Dim>
const typename FZCurve<_Dim>::position_array_t FZCurve<_Dim>::_positions(FZCurve<_Dim>::create_array());
// Initialization of static variable
template<std::size_t _Dim>
const typename z_curve<_Dim>::position_array_t z_curve<_Dim>::_positions(z_curve<_Dim>::create_array());
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment