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 49 50 51 52 53 54 55 56
|
namespace LatticeBoltzmann {
constexpr int NumDir = 9;
class Cell
{
public:
Cell() = default;
static std::array<signed char, NumDir> ex;
static std::array<signed char, NumDir> ey;
static std::array<double, NumDir> coeff;
std::array<double, NumDir> density;
enum class Direction
{
none = 0,
N,
NE,
E,
SE,
S,
SW,
W,
NW
};
void Init(){};
inline static std::pair<int, int> GetNextPosition(Direction direction, int x, int y)
{
return std::make_pair(x + ex[static_cast<size_t>(direction)], y - ey[static_cast<size_t>(direction)]);
}
};
}
and here is the main,
int main (int argc, char* argv[])
{
int myrank, num_procs;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
LatticeBoltzmann::NumDir;
LatticeBoltzmann::Cell Cell;
LatticeBoltzmann::Cell::ex = { 0 };
Cell.GetNextPosition(LatticeBoltzmann::Cell::Direction::NE, 1, 1);
//LBMSOLVER LBMSOLVER(D2Q9,Nx, Ny);
MPI_Finalize();
}
|