Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wspace cleanup #454

Merged
merged 2 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libmpdata++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ project(libmpdata++ CXX)
# using include() istead of find_package(libmpdata++) to use local CMake code
# and not the system-installed one
include(${CMAKE_SOURCE_DIR}/../libmpdata++-config.cmake)
if (NOT libmpdataxx_FOUND)
if (NOT libmpdataxx_FOUND)
message(FATAL_ERROR "local libmpdata++-config.cmake not found!")
endif()

# generate a header file with git revision id
if (EXISTS "${CMAKE_SOURCE_DIR}/../.git")
execute_process(COMMAND
bash -c "git log -1 --format=\"format:#define LIBMPDATAXX_GIT_REVISION \\\"%H\\\"%n\" HEAD > git_revision.hpp"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif()

install(
DIRECTORY
bcond concurr formulae output solvers
DESTINATION
DESTINATION
include/libmpdata++
)
install(
FILES
blitz.hpp git_revision.hpp kahan_reduction.hpp opts.hpp
DESTINATION
DESTINATION
include/libmpdata++
)
install(
Expand Down
18 changes: 9 additions & 9 deletions libmpdata++/bcond/cyclic_1d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ namespace libmpdataxx
{
namespace bcond
{
template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int dim>
template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int dim>
class bcond< real_t, halo, knd, dir, n_dims, dim,
typename std::enable_if<
knd == cyclic &&
dir == left &&
knd == cyclic &&
dir == left &&
n_dims == 1
>::type
> : public detail::bcond_common<real_t, halo, n_dims>
Expand All @@ -28,14 +28,14 @@ namespace libmpdataxx

void fill_halos_sclr(arr_t &a, const bool deriv = false)
{
a(this->left_halo_sclr) = a(this->rght_intr_sclr);
a(this->left_halo_sclr) = a(this->rght_intr_sclr);
}

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const bool ad = false)
{
av[0](this->left_halo_vctr) = av[0](this->rght_intr_vctr);
av[0](this->left_halo_vctr) = av[0](this->rght_intr_vctr);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const bool ad = false)
{
fill_halos_vctr_alng(av, ad);
Expand All @@ -59,14 +59,14 @@ namespace libmpdataxx

void fill_halos_sclr(arr_t &a, const bool deriv = false)
{
a(this->rght_halo_sclr) = a(this->left_intr_sclr);
a(this->rght_halo_sclr) = a(this->left_intr_sclr);
}

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const bool ad = false)
{
av[0](this->rght_halo_vctr) = av[0](this->left_intr_vctr);
av[0](this->rght_halo_vctr) = av[0](this->left_intr_vctr);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const bool ad = false)
{
fill_halos_vctr_alng(av, ad);
Expand Down
44 changes: 22 additions & 22 deletions libmpdata++/bcond/cyclic_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace libmpdataxx
namespace bcond
{
template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int d>
class bcond< real_t, halo, knd, dir, n_dims, d,
class bcond< real_t, halo, knd, dir, n_dims, d,
typename std::enable_if<
knd == cyclic &&
dir == left &&
n_dims == 2
>::type
> : public detail::bcond_common<real_t, halo, n_dims>
{
{
using parent_t = detail::bcond_common<real_t, halo, n_dims>;
using arr_t = blitz::Array<real_t, 2>;
using parent_t::parent_t; // inheriting ctor
Expand All @@ -28,37 +28,37 @@ namespace libmpdataxx

void fill_halos_sclr(arr_t &a, const rng_t &j, const bool deriv = false)
{
using namespace idxperm;
a(pi<d>(this->left_halo_sclr, j)) = a(pi<d>(this->rght_intr_sclr, j));
using namespace idxperm;
a(pi<d>(this->left_halo_sclr, j)) = a(pi<d>(this->rght_intr_sclr, j));
}

void fill_halos_pres(arr_t &a, const rng_t &j)
{
fill_halos_sclr(a, j);
}

void save_edge_vel(const arr_t &, const rng_t &) {}

void set_edge_pres(arr_t &, const rng_t &, int) {}

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
using namespace idxperm;
using namespace idxperm;
av[d](pi<d>(this->left_halo_vctr, j)) = av[d](pi<d>(this->rght_intr_vctr, j));
}

void fill_halos_sgs_div(arr_t &a, const rng_t &j)
{
fill_halos_sclr(a, j);
}

void fill_halos_sgs_vctr(arrvec_t<arr_t> &av, const arr_t &, const rng_t &j, const int offset = 0)
{
using namespace idxperm;
using namespace idxperm;
// the same logic as fill_halos_vctr_alng but have to consider offset ... TODO: find a way to reuse !
av[d + offset](pi<d>(this->left_halo_vctr, j)) = av[d + offset](pi<d>(this->rght_intr_vctr, j));
}

void fill_halos_sgs_tnsr(arrvec_t<arr_t> &av, const arr_t &, const arr_t &, const rng_t &j, const real_t)
{
fill_halos_vctr_alng(av, j);
Expand All @@ -68,7 +68,7 @@ namespace libmpdataxx
{
fill_halos_sclr(a, j);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
fill_halos_vctr_alng(av, j, ad);
Expand All @@ -81,14 +81,14 @@ namespace libmpdataxx
};

template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int d>
class bcond< real_t, halo, knd, dir, n_dims, d,
class bcond< real_t, halo, knd, dir, n_dims, d,
typename std::enable_if<
knd == cyclic &&
dir == rght &&
n_dims == 2
>::type
> : public detail::bcond_common<real_t, halo, n_dims>
{
{
using parent_t = detail::bcond_common<real_t, halo, n_dims>;
using arr_t = blitz::Array<real_t, 2>;
using parent_t::parent_t; // inheriting ctor
Expand All @@ -97,47 +97,47 @@ namespace libmpdataxx

void fill_halos_sclr(arr_t &a, const rng_t &j, const bool deriv = false)
{
using namespace idxperm;
a(pi<d>(this->rght_halo_sclr, j)) = a(pi<d>(this->left_intr_sclr, j));
using namespace idxperm;
a(pi<d>(this->rght_halo_sclr, j)) = a(pi<d>(this->left_intr_sclr, j));
}

void fill_halos_pres(arr_t &a, const rng_t &j)
{
fill_halos_sclr(a, j);
}

void save_edge_vel(const arr_t &, const rng_t &) {}

void set_edge_pres(arr_t &, const rng_t &, int) {}

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
using namespace idxperm;
using namespace idxperm;
av[d](pi<d>(this->rght_halo_vctr, j)) = av[d](pi<d>(this->left_intr_vctr, j));
}

void fill_halos_sgs_div(arr_t &a, const rng_t &j)
{
fill_halos_sclr(a, j);
}

void fill_halos_sgs_vctr(arrvec_t<arr_t> &av, const arr_t &, const rng_t &j, const int offset = 0)
{
using namespace idxperm;
using namespace idxperm;
// the same logic as fill_halos_vctr_alng but have to consider offset ... TODO: find a way to reuse !
av[d + offset](pi<d>(this->rght_halo_vctr, j)) = av[d + offset](pi<d>(this->left_intr_vctr, j));
}

void fill_halos_sgs_tnsr(arrvec_t<arr_t> &av, const arr_t &, const arr_t &, const rng_t &j, const real_t)
{
fill_halos_vctr_alng(av, j);
}

void fill_halos_vctr_nrml(arr_t &a, const rng_t &j)
{
fill_halos_sclr(a, j);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
fill_halos_vctr_alng(av, j, ad);
Expand Down
48 changes: 24 additions & 24 deletions libmpdata++/bcond/cyclic_3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace libmpdataxx
namespace bcond
{
template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int d>
class bcond< real_t, halo, knd, dir, n_dims, d,
class bcond< real_t, halo, knd, dir, n_dims, d,
typename std::enable_if<
knd == cyclic &&
dir == left &&
n_dims == 3
>::type
> : public detail::bcond_common<real_t, halo, n_dims>
{
{
using parent_t = detail::bcond_common<real_t, halo, n_dims>;
using arr_t = blitz::Array<real_t, 3>;
using parent_t::parent_t; // inheriting ctor
Expand All @@ -28,37 +28,37 @@ namespace libmpdataxx

void fill_halos_sclr(arr_t &a, const rng_t &j, const rng_t &k, const bool deriv = false)
{
using namespace idxperm;
a(pi<d>(this->left_halo_sclr, j, k)) = a(pi<d>(this->rght_intr_sclr, j, k));
using namespace idxperm;
a(pi<d>(this->left_halo_sclr, j, k)) = a(pi<d>(this->rght_intr_sclr, j, k));
}

void fill_halos_pres(arr_t &a, const rng_t &j, const rng_t &k)
{
fill_halos_sclr(a, j, k);
}

void save_edge_vel(const arr_t &, const rng_t &, const rng_t &) {}

void set_edge_pres(arr_t &, const rng_t &, const rng_t &, int) {}

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const rng_t &j, const rng_t &k, const bool ad = false)
{
using namespace idxperm;
using namespace idxperm;
av[d](pi<d>(this->left_halo_vctr, j, k)) = av[d](pi<d>(this->rght_intr_vctr, j, k));
}

void fill_halos_sgs_div(arr_t &a, const rng_t &j, const rng_t &k)
{
fill_halos_sclr(a, j, k);
}

void fill_halos_sgs_vctr(arrvec_t<arr_t> &av, const arr_t &, const rng_t &j, const rng_t &k, const int offset = 0)
{
using namespace idxperm;
using namespace idxperm;
// the same logic as fill_halos_vctr_alng but have to consider offset ... TODO: find a way to reuse !
av[d + offset](pi<d>(this->left_halo_vctr, j, k)) = av[d + offset](pi<d>(this->rght_intr_vctr, j, k));
}

void fill_halos_sgs_tnsr(arrvec_t<arr_t> &av, const arr_t &, const arr_t &, const rng_t &j, const rng_t &k, const real_t)
{
fill_halos_vctr_alng(av, j, k);
Expand All @@ -68,7 +68,7 @@ namespace libmpdataxx
{
fill_halos_sclr(a, j, k);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const rng_t &k, const bool ad = false)
{
fill_halos_vctr_alng(av, j, k, ad);
Expand All @@ -81,7 +81,7 @@ namespace libmpdataxx
};

template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int d>
class bcond< real_t, halo, knd, dir, n_dims, d,
class bcond< real_t, halo, knd, dir, n_dims, d,
typename std::enable_if<
knd == cyclic &&
dir == rght &&
Expand All @@ -97,37 +97,37 @@ namespace libmpdataxx

void fill_halos_sclr(arr_t &a, const rng_t &j, const rng_t &k, const bool deriv = false)
{
using namespace idxperm;
a(pi<d>(this->rght_halo_sclr, j, k)) = a(pi<d>(this->left_intr_sclr, j, k));
using namespace idxperm;
a(pi<d>(this->rght_halo_sclr, j, k)) = a(pi<d>(this->left_intr_sclr, j, k));
}

void fill_halos_pres(arr_t &a, const rng_t &j, const rng_t &k)
{
fill_halos_sclr(a, j, k);
}

void save_edge_vel(const arr_t &, const rng_t &, const rng_t &) {}

void set_edge_pres(arr_t &, const rng_t &, const rng_t &, int) {}

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const rng_t &j, const rng_t &k, const bool ad = false)
{
using namespace idxperm;
using namespace idxperm;
av[d](pi<d>(this->rght_halo_vctr, j, k)) = av[d](pi<d>(this->left_intr_vctr, j, k));
}

void fill_halos_sgs_div(arr_t &a, const rng_t &j, const rng_t &k)
{
fill_halos_sclr(a, j, k);
}

void fill_halos_sgs_vctr(arrvec_t<arr_t> &av, const arr_t &, const rng_t &j, const rng_t &k, const int offset = 0)
{
using namespace idxperm;
using namespace idxperm;
// the same logic as fill_halos_vctr_alng but have to consider offset ... TODO: find a way to reuse !
av[d + offset](pi<d>(this->rght_halo_vctr, j, k)) = av[d + offset](pi<d>(this->left_intr_vctr, j, k));
}

void fill_halos_sgs_tnsr(arrvec_t<arr_t> &av, const arr_t &, const arr_t &, const rng_t &j, const rng_t &k, const real_t)
{
fill_halos_vctr_alng(av, j, k);
Expand All @@ -137,7 +137,7 @@ namespace libmpdataxx
{
fill_halos_sclr(a, j, k);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const rng_t &k, const bool ad = false)
{
fill_halos_vctr_alng(av, j, k, ad);
Expand Down
Loading