60 Kokkos::initialize(
argc, argv);
65 const std::size_t n = (std::size_t)ext.x * ext.y * ext.z;
67 std::uniform_real_distribution<double>
uf(-1.0, 1.0);
68 std::vector<double> base(n);
72 auto up = [&](std::vector<double>& h) {
74 auto m = Kokkos::create_mirror_view(v);
75 for (std::size_t i = 0; i < n; ++i)
77 Kokkos::deep_copy(v, m);
81 std::vector<double> o(n);
82 auto m = Kokkos::create_mirror_view(v);
83 Kokkos::deep_copy(m, v);
84 for (std::size_t i = 0; i < n; ++i)
88 auto close = [](
double x,
double y) {
89 return std::fabs(x - y) <= 1e-12 * (1.0 + std::fabs(y));
92 int bad = 0, cases = 0;
94 for (
int a = 0; a < 3; ++a)
95 for (
int s = 0; s < 2; ++s)
96 for (
int comp = 0; comp < 3; ++comp)
97 for (
int fold = 0; fold < 2; ++fold) {
98 std::vector<double> h = base;
100 const double wall = 0.37;
102 hostVel(h, ext, g, a, s, comp, wall, fold);
104 for (std::size_t i = 0; i < n; ++i)
110 for (
int a = 0; a < 3; ++a)
111 for (
int s = 0; s < 2; ++s) {
112 std::vector<double> h = base;
117 for (std::size_t i = 0; i < n; ++i)
124 std::fprintf(
stderr,
"FAIL: %d mismatches across %d BC cases\n",
bad, cases);
128 "[mac_bc] PASS: %d BC cases (velocity normal/tangential/fold + wall openness) match host "
130 cases, BExec::name());
void bcVelocityComp(BField f, B3 ext, int g, int a, int s, int comp, double wall, int fold, BField prof=BField(), int prof_nc=0)
static void hostVel(std::vector< double > &f, B3 ext, int g, int a, int s, int comp, double wall, int fold)