/
polar_common.hpp
48 lines (39 loc) · 1.06 KB
/
polar_common.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// common code for polar boundary conditions for libmpdata++
//
// licensing: GPU GPL v3
// copyright: University of Warsaw
#pragma once
#include <libmpdata++/blitz.hpp>
#include <libmpdata++/bcond/detail/bcond_common.hpp>
#include <libmpdata++/formulae/arakawa_c.hpp>
namespace libmpdataxx
{
namespace bcond
{
namespace detail
{
using namespace arakawa_c;
template <typename real_t, int halo, int n_dims>
class polar_common : public bcond_common<real_t, halo, n_dims>
{
using parent_t = bcond_common<real_t, halo, n_dims>;
protected:
// member fields
const int pole;
int polar_neighbours(const int j)
{
return (j + pole) % (2 * pole);
}
public:
// ctor
polar_common(
const rng_t &i,
const std::array<int, n_dims> &distmem_grid_size
) :
parent_t(i, distmem_grid_size),
pole((distmem_grid_size[0] - 1) / 2)
{}
};
} // namespace detail
} // namespace bcond
} // namespace libmpdataxx