Commit 77b3c5de authored by Quentin Khan's avatar Quentin Khan
Browse files

Prepare FNode for the StarPU algorithm

Group some of the node symbolic data (depth, morton index) in a
symbolic_data_t object. This will allow easy manipulation.
parent 1689d3f8
......@@ -199,6 +199,15 @@ public:
/// Node data structure
using data_t = NodeData;
/** \brief Node structural data
* Keeps data about the node that may be read by kernels or algorithms.
*/
struct symbolic_data_t {
/// Node depth in its tree
std::size_t depth;
/// Node index in parent child array
std::size_t m_idx;
};
private:
......@@ -215,10 +224,6 @@ private:
FNode* _parent = nullptr;
/// Node spatial bounding box
box_t _box;
/// Node depth in its tree
std::size_t _depth = 0;
/// Node index in parent child array
std::size_t _m_idx = 0;
/// Particle container
particle_container_t _p_container;
/// Node data
......@@ -230,6 +235,11 @@ private:
/// Indicates whether node is a leaf
bool _is_leaf = true;
/// Node data that may be of use to algorithms and kernels
struct symbolic_data_t _symbolic_data;
public:
/// Near-field leaves interaction list
interaction_list_t U;
......@@ -248,9 +258,8 @@ public:
FNode(FNode& parent, const std::size_t& child_index) :
_parent(&parent),
_box (parent.getBox().center(), parent.getBox().corner(child_index) ),
_depth (parent.getDepth()+1),
_m_idx((parent.getIndex() << Dim) + child_index),
_tree (parent._tree )
_tree (parent._tree ),
_symbolic_data{parent.getDepth()+1, (parent.getIndex() << Dim) + child_index}
{
if (child_index >= child_count) {
throw std::invalid_argument(std::string("Wrong child index in node contructor: got ")
......@@ -266,10 +275,11 @@ public:
/** Root constructor called from tree */
FNode(tree_t* tree) :
_box(tree->box()),
_tree(tree)
_tree(tree),
_symbolic_data{}
{
tree->leaves().insert(this);
// This belongs to its own U list, not done in the other constructors
// `this` belongs to its own U list, not done in the other constructors
// because managed by split or fuse
this->U.insert(this);
this->common_init();
......@@ -305,6 +315,16 @@ public:
return &_data;
}
/// Symbolic data accessor
symbolic_data_t& getSymbolicData() noexcept {
return this->_symbolic_data;
}
/// Symbolic data const accessor
const symbolic_data_t& getSymbolicData() const noexcept {
return this->_symbolic_data;
}
/// Children container accessor
child_node_array_t& getChildren() noexcept {
return _children;
......@@ -340,12 +360,12 @@ public:
/// Depth accessor
const std::size_t& getDepth() const noexcept {
return _depth;
return _symbolic_data.depth;
}
/// Morton index accessor
const std::size_t& getIndex() const noexcept {
return _m_idx;
return _symbolic_data.m_idx;
}
/// Tree accessor
......
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