Skip to content

Commit

Permalink
Change the default layout name
Browse files Browse the repository at this point in the history
include mask in PointDesc
add decls for CCTK_REALVEC,
CCTK_BOOLVEC, and CCTK_VECSIZE.
  • Loading branch information
stevenrbrandt committed Jul 27, 2023
1 parent 2604a4b commit c9e155c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Arith/src/simd.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1361,4 +1361,9 @@ template <typename T> struct one<simdl<T> > {
};
} // namespace Arith

// Put these three things into the fake Cactus namespace
using CCTK_BOOLVEC = Arith::simdl<CCTK_REAL>;
using CCTK_REALVEC = Arith::simd<CCTK_REAL>;
constexpr std::size_t CCTK_VECSIZE = std::tuple_size_v<CCTK_REALVEC>;

#endif // #ifndef CARPETX_ARITH_SIMD_HXX
15 changes: 9 additions & 6 deletions Loop/src/loop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ struct PointDesc {
int i, j, k; // grid point
CCTK_REAL x, y, z; // grid point coordinates
CCTK_REAL dx, dy, dz; // grid spacing
CCTK_BOOLVEC mask; // mask for grid loop

PointDesc() = delete;
PointDesc(const PointDesc &) = default;
Expand All @@ -100,7 +101,9 @@ struct PointDesc {
: I(I), iter(iter), NI(NI), I0(I0), BI(BI), bnd_min(bnd_min),
bnd_max(bnd_max), loop_min(loop_min), loop_max(loop_max), X(X), DX(DX),
imin(loop_min[0]), imax(loop_max[0]), i(I[0]), j(I[1]), k(I[2]),
x(X[0]), y(X[1]), z(X[2]), dx(DX[0]), dy(DX[1]), dz(DX[2]) {}
x(X[0]), y(X[1]), z(X[2]), dx(DX[0]), dy(DX[1]), dz(DX[2]), mask() {
mask = Arith::mask_for_loop_tail<CCTK_BOOLVEC>(I[0], loop_max[0]);
}

friend std::ostream &operator<<(std::ostream &os, const PointDesc &p);
};
Expand Down Expand Up @@ -131,7 +134,7 @@ public:

GridDescBase(const cGH *cctkGH);

constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE CCTK_DEVICE CCTK_HOST PointDesc
CCTK_ATTRIBUTE_ALWAYS_INLINE CCTK_DEVICE CCTK_HOST PointDesc
point_desc(const vect<bool, dim> &CI, const vect<int, dim> &I, const int iter,
const vect<int, dim> &NI, const vect<int, dim> &I0,
const vect<int, dim> &BI, const vect<int, dim> &bnd_min,
Expand Down Expand Up @@ -1385,17 +1388,17 @@ public:

#define CCTK_CENTERING_LAYOUT(L, V) \
constexpr Arith::vect<int, Loop::dim> L##_centered V; \
const Loop::GF3D5layout L##gf_layout(cctkGH, L##_centered)
const Loop::GF3D5layout cctk_layout_##L(cctkGH, L##_centered)
#define CCTK_CENTERING_GF(C, L, N) \
const Loop::GF3D5<C CCTK_REAL> N(L##gf_layout, cctk_ptr_##N)
const Loop::GF3D5<C CCTK_REAL> N(cctk_layout_##L, cctk_ptr_##N)

#else

#define CCTK_CENTERING_LAYOUT(L, V) \
constexpr Arith::vect<int, Loop::dim> L##_centered V; \
const Loop::GF3D2layout L##gf_layout(cctkGH, L##_centered)
const Loop::GF3D2layout cctk_layout_##L(cctkGH, L##_centered)
#define CCTK_CENTERING_GF(C, L, N) \
const Loop::GF3D2<C CCTK_REAL> N(L##gf_layout, cctk_ptr_##N)
const Loop::GF3D2<C CCTK_REAL> N(cctk_layout_##L, cctk_ptr_##N)

#endif

Expand Down

0 comments on commit c9e155c

Please sign in to comment.