@@ -34,23 +34,11 @@ inline std::vector<std::string> addKindSuffix(
3434// ======================================================================
3535// ItemMomentBnd
3636
37- template <centering::Centering C>
38- class DomainBoundary
37+ template <typename FE >
38+ void add_ghosts_boundary (const Grid_t& grid, FE & mres_gt, const Int3& ib, int p,
39+ int mb, int me, centering::Centering c)
3940{
40- public:
41- template <typename FE >
42- static void add_ghosts_boundary (const Grid_t& grid, FE & mres_gt,
43- const Int3& ib, int p, int mb, int me);
44- };
45-
46- template <>
47- class DomainBoundary <centering::CC >
48- {
49- public:
50- template <typename FE >
51- static void add_ghosts_boundary (const Grid_t& grid, FE & mres_gt,
52- const Int3& ib, int p, int mb, int me)
53- {
41+ if (c == centering::CC ) {
5442 // lo
5543 for (int d = 0 ; d < 3 ; d++) {
5644 // FIXME why reflect for open BCs?
@@ -67,17 +55,7 @@ public:
6755 add_ghosts_reflecting_hi_cc (grid.ldims , mres_gt, ib, p, d, mb, me);
6856 }
6957 }
70- }
71- };
72-
73- template <>
74- class DomainBoundary <centering::NC >
75- {
76- public:
77- template <typename FE >
78- static void add_ghosts_boundary (const Grid_t& grid, FE & mres_gt,
79- const Int3& ib, int p, int mb, int me)
80- {
58+ } else if (c == centering::NC ) {
8159 // lo
8260 for (int d = 0 ; d < 3 ; d++) {
8361 // FIXME why reflect for open BCs?
@@ -95,7 +73,7 @@ public:
9573 }
9674 }
9775 }
98- };
76+ }
9977
10078// ======================================================================
10179// ItemMomentBnd
@@ -111,8 +89,7 @@ public:
11189 void add_ghosts (const Grid_t& grid, storage_type& mres_gt, const Int3& ib)
11290 {
11391 for (int p = 0 ; p < mres_gt.shape (4 ); p++) {
114- DomainBoundary<C>::add_ghosts_boundary (grid, mres_gt, ib, p, 0 ,
115- mres_gt.shape (3 ));
92+ add_ghosts_boundary (grid, mres_gt, ib, p, 0 , mres_gt.shape (3 ), C);
11693 }
11794
11895 bnd_.add_ghosts (grid, mres_gt, ib, 0 , mres_gt.shape (3 ));
@@ -152,8 +129,8 @@ public:
152129 {
153130 Int3 ib = -mprts.grid ().ibn ;
154131 // FIXME, gt::gtensor and psc::gtensor are slightly different, and ideally
155- // zeros() shouldn't actually allocate, but probably it does, so this wastes
156- // memory and a copy
132+ // zeros() shouldn't actually allocate, but probably it does, so this
133+ // wastes memory and a copy
157134 storage_type mres =
158135 psc::mflds::zeros<value_type, space_type>(mprts.grid (), n_comps (), ib);
159136 moment_type{}(mres, ib, mprts);
0 commit comments