Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
FaceFlagger.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
19#include "shambackends/vec.hpp"
23
25
38 template<class Tvec, class TgridVec>
40 public:
41 using Tscal = shambase::VecComponent<Tvec>;
42 using Tgridscal = shambase::VecComponent<TgridVec>;
44
47
48 ShamrockCtx &context;
49 Config &solver_config;
50 Storage &storage;
51
52 FaceFlagger(ShamrockCtx &context, Config &solver_config, Storage &storage)
53 : context(context), solver_config(solver_config), storage(storage) {}
54
59 void flag_faces();
60
61 static constexpr u8 max_lookup = 5;
62
63 inline static Tvec lookup_to_normal(u8 lookup) {
64 return std::array<Tvec, 6>{
65 Tvec{-1, 0, 0},
66 Tvec{1, 0, 0},
67 Tvec{0, -1, 0},
68 Tvec{0, 1, 0},
69 Tvec{0, 0, -1},
70 Tvec{0, 0, 1},
71 }[lookup];
72 }
73
75 void split_face_list();
76
77 void compute_neigh_ids();
78
79 private:
80 shamrock::tree::ObjectCache isolate_lookups(
82 sycl::buffer<u8> &face_normals_lookup,
83 u8 lookup_value);
84
85 inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); }
86 };
87} // namespace shammodels::zeus::modules
std::uint8_t u8
8 bit unsigned integer
std::uint32_t u32
32 bit unsigned integer
The MPI scheduler.
flag faces with a lookup index for the orientation
void flag_faces()
flag faces with a lookup index performs at around 2G cell per seconds on a RTX A5000
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...
Definition memory.hpp:110
namespace for the zeus model modules
Definition AMRTree.hpp:23