42#ifndef UFO_MAP_INTEGRATION_MISSES_HPP
43#define UFO_MAP_INTEGRATION_MISSES_HPP
46#include <ufo/map/code.hpp>
47#include <ufo/map/integration/grid.hpp>
48#include <ufo/map/types.hpp>
49#include <ufo/util/bit_set.hpp>
65struct Miss :
public CodeOrIndex {
69 constexpr Miss(Code code, BitSet<8> sibling, freedom_t freedom = 0)
70 : CodeOrIndex(code), sibling(sibling), freedom(freedom)
75using Misses = std::vector<Miss>;
77template <std::
size_t UnknownInflate = 0>
78Misses getMisses(CodeMap<Grid>
const& free_grids, CodeMap<Grid>
const& hit_grids,
79 depth_t
const depth, std::size_t
const num_threads)
83 std::vector<Code> codes;
84 codes.reserve(free_grids.size());
85 for (
auto const& [code, _] : free_grids) {
86 codes.push_back(code);
89 auto isMaskSet = [](std::uint64_t
const x, std::uint64_t
const mask) {
90 return (x & mask) == mask;
93 code_t
const inc = code_t(64) << 3 * depth;
94#pragma omp parallel num_threads(num_threads)
98#pragma omp for schedule(static)
99 for (
auto const code : codes) {
100 auto thread_id = omp_get_thread_num();
102 auto const& free_grid = free_grids.find(code)->second;
105 code_t i = code.code();
106 for (
auto e : free_grid) {
112 std::array<std::uint64_t, 5> fg{};
114 std::array<std::uint64_t, 27> g{};
115 std::array<code_t, 27> c;
117 Key k_o = Code(i, depth + 2);
119 for (
int z{-1}, s = k_o.step(), i{}; 2 != z; ++z) {
120 for (
int y{-1}; 2 != y; ++y) {
121 for (
int x{-1}; 2 != x; ++x, ++i) {
127 if (c_k.toDepth(code.depth()) == code) {
128 g[i] = free_grid[c_k.toDepth(depth)];
129 }
else if (
auto it = grids.find(c_k.toDepth(code.depth()));
130 std::end(grids) != it) {
131 g[i] = it->second[c_k.toDepth(depth)];