4 changed files with 87 additions and 33 deletions
@ -0,0 +1,52 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <container/stl_alias.hpp> |
||||
|
#include <iterator/counting_iterator.hpp> |
||||
|
|
||||
|
struct flat_index_group { |
||||
|
stl_vector_mp<uint32_t> index_group{}; /// a list of indices in the group
|
||||
|
stl_vector_mp<uint32_t> start_indices{}; /// a list of start indices for each group in the flat index group
|
||||
|
|
||||
|
inline size_t size() const { return start_indices.size() - 1; } |
||||
|
|
||||
|
struct group_index_looper { |
||||
|
auto begin() const { return counting_iterator<uint32_t>{0}; } |
||||
|
|
||||
|
auto end() const { return counting_iterator<uint32_t>{static_cast<uint32_t>(parent_group.size())}; } |
||||
|
|
||||
|
const flat_index_group& parent_group{}; |
||||
|
}; |
||||
|
|
||||
|
auto group_indices() const { return group_index_looper{*this}; } |
||||
|
|
||||
|
struct group_looper { |
||||
|
auto begin() const |
||||
|
{ |
||||
|
return std::next(parent_group.index_group.begin(), *(parent_group.start_indices.begin() + group_idx)); |
||||
|
} |
||||
|
|
||||
|
auto end() const |
||||
|
{ |
||||
|
return std::next(parent_group.index_group.begin(), *(parent_group.start_indices.begin() + group_idx + 1)); |
||||
|
} |
||||
|
|
||||
|
const flat_index_group& parent_group{}; |
||||
|
const uint32_t group_idx{}; |
||||
|
}; |
||||
|
|
||||
|
auto group(uint32_t group_idx) const { return group_looper{*this, group_idx}; } |
||||
|
|
||||
|
inline auto group_index_iter_begin() const { return counting_iterator<uint32_t>{0}; } |
||||
|
|
||||
|
inline auto group_index_iter_end() const { return counting_iterator<uint32_t>{static_cast<uint32_t>(size())}; } |
||||
|
|
||||
|
inline auto group_begin(uint32_t group_idx) const |
||||
|
{ |
||||
|
return std::next(index_group.begin(), *(start_indices.begin() + group_idx)); |
||||
|
} |
||||
|
|
||||
|
inline auto group_end(uint32_t group_idx) const |
||||
|
{ |
||||
|
return std::next(index_group.begin(), *(start_indices.begin() + group_idx + 1)); |
||||
|
} |
||||
|
}; |
@ -0,0 +1,7 @@ |
|||||
|
add_requires("gtest") |
||||
|
|
||||
|
internal_library("surface_integral", "SI", os.scriptdir()) |
||||
|
add_rules("config.indirect_predicates.flags") |
||||
|
add_deps("primitive_process", "shared_module") |
||||
|
|
||||
|
|
Loading…
Reference in new issue