BioDynaMo  v1.05.119-a4ff3934
morton_order.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_ENVIRONMENT_MORTON_ORDER_H_
16 #define CORE_ENVIRONMENT_MORTON_ORDER_H_
17 
18 #include <array>
19 #include <vector>
22 #include "core/functor.h"
23 #include "core/util/iterator.h"
24 
25 namespace bdm {
26 
27 class MortonOrder {
28  public:
29  void Update(const std::array<uint64_t, 3>& num_boxes_axis);
31  uint64_t GetMortonCode(uint64_t box_index) const;
32  void CallMortonIteratorConsumer(uint64_t start_index, uint64_t end_index,
33  Functor<void, Iterator<uint64_t>*>& f) const;
34 
35  private:
36  uint64_t num_boxes_;
37  std::vector<std::pair<uint64_t, uint64_t>> offset_index_;
38 };
39 
40 } // namespace bdm
41 
42 #endif // CORE_ENVIRONMENT_MORTON_ORDER_H_
bdm::MortonOrder::num_boxes_
uint64_t num_boxes_
Definition: morton_order.h:36
fixed_size_vector.h
bdm
Definition: agent.cc:39
bdm::Iterator< uint64_t >
bdm::MortonOrder::offset_index_
std::vector< std::pair< uint64_t, uint64_t > > offset_index_
Definition: morton_order.h:37
bdm::MortonOrder::GetMortonCode
uint64_t GetMortonCode(uint64_t box_index) const
Runtime O(log(num_boxes))
Definition: morton_order.cc:154
bdm::MortonOrder
Definition: morton_order.h:27
bdm::Functor
Definition: functor.h:24
bdm::MortonOrder::Update
void Update(const std::array< uint64_t, 3 > &num_boxes_axis)
Definition: morton_order.cc:55
iterator.h
math_array.h
bdm::MortonOrder::CallMortonIteratorConsumer
void CallMortonIteratorConsumer(uint64_t start_index, uint64_t end_index, Functor< void, Iterator< uint64_t > * > &f) const
Definition: morton_order.cc:200
functor.h