26 template<
class Tvec,
class Tgr
idVec,
class Tmorton>
27 class FindBlockNeigh<Tvec, TgridVec, Tmorton>::AMRBlockFinder {
31 sycl::accessor<TgridVec, 1, sycl::access::mode::read, sycl::target::device> acc_block_min;
32 sycl::accessor<TgridVec, 1, sycl::access::mode::read, sycl::target::device> acc_block_max;
39 sycl::buffer<TgridVec> &buf_block_min,
40 sycl::buffer<TgridVec> &buf_block_max,
42 : block_looper(tree, cgh), acc_block_min{buf_block_min, cgh, sycl::read_only},
43 acc_block_max{buf_block_max, cgh, sycl::read_only},
44 dir_offset(std::move(dir_offset)) {}
46 template<
class IndexFunctor>
47 void for_each_other_index(
u32 id_a, IndexFunctor &&fct)
const {
54 block_aabb.
lower + dir_offset, block_aabb.
upper + dir_offset};
56 block_looper.rtree_for(
57 [&](
u32 node_id, TgridVec bmin, TgridVec bmax) ->
bool {
76 template<
class Tvec,
class Tgr
idVec,
class Tmorton>
78 auto edges = get_edges();
80 edges.spans_block_min.check_sizes(edges.sizes.indexes);
81 edges.spans_block_max.check_sizes(edges.sizes.indexes);
85 edges.trees.trees.
for_each([&](
u64 id,
const RTree &tree) {
86 u32 leaf_count = tree.tree_reduced_morton_codes.tree_leaf_count;
87 u32 internal_cell_count = tree.tree_struct.internal_cell_count;
88 u32 tot_count = leaf_count + internal_cell_count;
90 OrientedAMRGraph result;
94 sycl::buffer<TgridVec> &tree_bmin
96 sycl::buffer<TgridVec> &tree_bmax
102 sycl::buffer<TgridVec> buf_block_min_sycl = block_min.get_buf().copy_to_sycl_buffer();
103 sycl::buffer<TgridVec> buf_block_max_sycl = block_max.get_buf().copy_to_sycl_buffer();
105 for (
u32 dir = 0; dir < 6; dir++) {
107 TgridVec dir_offset = result.offset_check[dir];
110 shamsys::instance::get_compute_scheduler_ptr(),
111 edges.sizes.indexes.get(
id),
118 "AMR Block Graph",
"Patch",
id,
"direction", dir,
"link cnt", rslt.link_count);
120 std::unique_ptr<AMRGraph> tmp_graph = std::make_unique<AMRGraph>(std::move(rslt));
122 result.graph_links[dir] = std::move(tmp_graph);
125 graph.
add_obj(
id, std::move(result));
128 edges.block_neigh_graph.graph = std::move(graph);
143 template<
class Tvec,
class Tgr
idVec,
class Tmorton>
152 std::string tex = R
"tex(
153 Find neighbour blocks
156 {block_neigh_graph} = \text{FindBlockNeigh}({sizes}, {block_min}, {block_max}, {trees})
Field variant object to instanciate a variant on the patch types.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
A SYCL queue associated with a device and a context.
Represents a collection of objects distributed across patches identified by a u64 id.
iterator add_obj(u64 id, T &&obj)
Adds a new object to the collection.
void for_each(std::function< void(u64, T &)> &&f)
Applies a function to each object in the collection.
void _impl_evaluate_internal()
evaluate the node
virtual std::string _impl_get_tex() const
get the tex of the node
IEdge & get_rw_edge_base(int slot)
Get a reference to a read write edge and cast it to the type IEdge.
const IEdge & get_ro_edge_base(int slot)
Get a reference to a read only edge.
shammodels::basegodunov::modules::NeighGraph compute_neigh_graph_deprecated(const sham::DeviceScheduler_ptr &dev_sched, u32 graph_nodes, Args &&...args)
Create a neighbour graph using a class that will list the ids of the found neighbourgh NeighFindKerne...
void replace_all(std::string &inout, std::string_view what, std::string_view with)
replace all occurence of a search string with another
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...
namespace for the basegodunov model modules
Axis-Aligned bounding box.
bool is_volume_not_null() const noexcept
Checks if the AABB has a non-zero volume.
T lower
Lower bound of the AABB.
T upper
Upper bound of the AABB.
AABB get_intersect(AABB other) const noexcept
Compute the intersection of two AABB.