Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::SkipHeapAddressing< blocking > Struct Template Reference

#include <src/libslic3r/MutablePriorityQueue.hpp>

Static Public Member Functions

static std::size_t child_of (std::size_t node_no) noexcept
 
static std::size_t parent_of (std::size_t node_no) noexcept
 
static bool is_block_leaf (std::size_t node_no) noexcept
 
static bool is_padding (std::size_t node_no) noexcept
 
static bool is_block_root (std::size_t node_no) noexcept
 
static std::size_t block_offset (std::size_t node_no) noexcept
 
static std::size_t block_base (std::size_t node_no) noexcept
 
static std::size_t child_no (std::size_t node_no) noexcept
 

Static Public Attributes

static const constexpr std::size_t block_size = blocking
 
static const constexpr std::size_t block_mask = block_size - 1
 

Detailed Description

template<std::size_t blocking>
struct Slic3r::SkipHeapAddressing< blocking >

Member Function Documentation

◆ block_base()

template<std::size_t blocking>
static std::size_t Slic3r::SkipHeapAddressing< blocking >::block_base ( std::size_t  node_no)
inlinestaticnoexcept
253{ return node_no & ~block_mask; }

Referenced by Slic3r::SkipHeapAddressing< blocking >::child_of(), and Slic3r::SkipHeapAddressing< blocking >::parent_of().

+ Here is the caller graph for this function:

◆ block_offset()

template<std::size_t blocking>
static std::size_t Slic3r::SkipHeapAddressing< blocking >::block_offset ( std::size_t  node_no)
inlinestaticnoexcept
251{ return node_no & block_mask; }
static const constexpr std::size_t block_mask
Definition MutablePriorityQueue.hpp:212

References Slic3r::SkipHeapAddressing< blocking >::block_mask.

Referenced by Slic3r::SkipHeapAddressing< blocking >::child_of(), Slic3r::SkipHeapAddressing< blocking >::is_block_root(), Slic3r::SkipHeapAddressing< blocking >::is_padding(), and Slic3r::SkipHeapAddressing< blocking >::parent_of().

+ Here is the caller graph for this function:

◆ child_no()

template<std::size_t blocking>
static std::size_t Slic3r::SkipHeapAddressing< blocking >::child_no ( std::size_t  node_no)
inlinestaticnoexcept
255{ assert(is_block_leaf(node_no)); return node_no & (block_mask >> 1); }
static bool is_block_leaf(std::size_t node_no) noexcept
Definition MutablePriorityQueue.hpp:243

References Slic3r::SkipHeapAddressing< blocking >::block_mask, and Slic3r::SkipHeapAddressing< blocking >::is_block_leaf().

Referenced by Slic3r::SkipHeapAddressing< blocking >::child_of().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ child_of()

template<std::size_t blocking>
static std::size_t Slic3r::SkipHeapAddressing< blocking >::child_of ( std::size_t  node_no)
inlinestaticnoexcept
215 {
216 if (! is_block_leaf(node_no))
217 // If not a leaf, then it is sufficient to just traverse down inside a miniheap.
218 // The following line is equivalent to, but quicker than
219 // return block_base(node_no) + 2 * block_offset(node_no);
220 return node_no + block_offset(node_no);
221 // Otherwise skip to a root of a child miniheap.
222 return (block_base(node_no) + 1 + child_no(node_no) * 2) * block_size + 1;
223 }
static std::size_t block_base(std::size_t node_no) noexcept
Definition MutablePriorityQueue.hpp:253
static const constexpr std::size_t block_size
Definition MutablePriorityQueue.hpp:211
static std::size_t block_offset(std::size_t node_no) noexcept
Definition MutablePriorityQueue.hpp:251
static std::size_t child_no(std::size_t node_no) noexcept
Definition MutablePriorityQueue.hpp:255

References Slic3r::SkipHeapAddressing< blocking >::block_base(), Slic3r::SkipHeapAddressing< blocking >::block_offset(), Slic3r::SkipHeapAddressing< blocking >::block_size, Slic3r::SkipHeapAddressing< blocking >::child_no(), and Slic3r::SkipHeapAddressing< blocking >::is_block_leaf().

+ Here is the call graph for this function:

◆ is_block_leaf()

template<std::size_t blocking>
static bool Slic3r::SkipHeapAddressing< blocking >::is_block_leaf ( std::size_t  node_no)
inlinestaticnoexcept
243{ return (node_no & (block_size >> 1)) != 0U; }

References Slic3r::SkipHeapAddressing< blocking >::block_size.

Referenced by Slic3r::SkipHeapAddressing< blocking >::child_no(), and Slic3r::SkipHeapAddressing< blocking >::child_of().

+ Here is the caller graph for this function:

◆ is_block_root()

template<std::size_t blocking>
static bool Slic3r::SkipHeapAddressing< blocking >::is_block_root ( std::size_t  node_no)
inlinestaticnoexcept
249{ return block_offset(node_no) == 1U; }

References Slic3r::SkipHeapAddressing< blocking >::block_offset().

Referenced by Slic3r::SkipHeapAddressing< blocking >::parent_of().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_padding()

template<std::size_t blocking>
static bool Slic3r::SkipHeapAddressing< blocking >::is_padding ( std::size_t  node_no)
inlinestaticnoexcept
245{ return block_offset(node_no) == 0U; }

References Slic3r::SkipHeapAddressing< blocking >::block_offset().

Referenced by Slic3r::MutableSkipHeapPriorityQueue< T, IndexSetter, LessPredicate, blocking, ResetIndexWhenRemoved >::operator[](), Slic3r::MutableSkipHeapPriorityQueue< T, IndexSetter, LessPredicate, blocking, ResetIndexWhenRemoved >::operator[](), Slic3r::MutableSkipHeapPriorityQueue< T, IndexSetter, LessPredicate, blocking, ResetIndexWhenRemoved >::pop_back(), and Slic3r::MutableSkipHeapPriorityQueue< T, IndexSetter, LessPredicate, blocking, ResetIndexWhenRemoved >::update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parent_of()

template<std::size_t blocking>
static std::size_t Slic3r::SkipHeapAddressing< blocking >::parent_of ( std::size_t  node_no)
inlinestaticnoexcept
225 {
226 auto const node_root = block_base(node_no); // 16
227 if (! is_block_root(node_no))
228 // If not a block (miniheap) root, then it is sufficient to just traverse up inside a miniheap.
229 return node_root + block_offset(node_no) / 2;
230 // Otherwise skipping from a root of one miniheap into leaf of another miniheap.
231 // Address of a parent miniheap block. One miniheap branches at (block_size / 2) leaves to (block_size) miniheaps.
232 auto const parent_base = block_base(node_root / block_size - 1); // 0
233 // Index of a leaf of a parent miniheap, which is a parent of node_no.
234 auto const child = ((node_no - block_size) / block_size - parent_base) / 2;
235 return
236 // Address of a parent miniheap
237 parent_base +
238 // Address of a leaf of a parent miniheap
239 block_size / 2 + child; // 30
240 }
static bool is_block_root(std::size_t node_no) noexcept
Definition MutablePriorityQueue.hpp:249

References Slic3r::SkipHeapAddressing< blocking >::block_base(), Slic3r::SkipHeapAddressing< blocking >::block_offset(), Slic3r::SkipHeapAddressing< blocking >::block_size, and Slic3r::SkipHeapAddressing< blocking >::is_block_root().

+ Here is the call graph for this function:

Member Data Documentation

◆ block_mask

template<std::size_t blocking>
const constexpr std::size_t Slic3r::SkipHeapAddressing< blocking >::block_mask = block_size - 1
staticconstexpr

◆ block_size


The documentation for this struct was generated from the following file: