From 9af0f7a9cb09b06c3bc824a08bafdee4c02a3fc0 Mon Sep 17 00:00:00 2001 From: Benoit Bovy Date: Thu, 23 Aug 2018 14:59:35 +0200 Subject: [PATCH] Fix old apple-clang versions (Python bindings) (#33) * allow old xcode (apple-clang) versions to fail on travis * fix xbuilder with initializer_list * test python bindings for xcode6.4 * fix xt::tranpose with initializer_list --- .travis.yml | 12 +++++++++--- include/fastscapelib/hillslope.hpp | 12 ++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4f448c26..88a4d1fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,15 +73,16 @@ matrix: - clang-6.0 - libstdc++-6-dev env: COMPILER=clang CLANG=6.0 - - os: osx - osx_image: xcode6.4 - compiler: clang - os: osx osx_image: xcode8 compiler: clang - os: osx osx_image: xcode9 compiler: clang + - os: osx + osx_image: xcode6.4 + compiler: clang + env: PYTEST=3.6 - os: linux addons: apt: @@ -103,6 +104,11 @@ matrix: - python: 3.5 language: python env: DOCS=yes + allow_failures: + - os: osx + osx_image: xcode6.4 + compiler: clang + env: PYTEST=3.6 env: global: diff --git a/include/fastscapelib/hillslope.hpp b/include/fastscapelib/hillslope.hpp index 0301035d..e284f3f9 100644 --- a/include/fastscapelib/hillslope.hpp +++ b/include/fastscapelib/hillslope.hpp @@ -82,8 +82,10 @@ auto get_adi_factors(T k_coef, sshape_t ncols, typename std::enable_if_t::value>* = 0) { - auto fr = xt::empty({ncols}); - auto fc = xt::empty({ncols}); + std::array shape_cols {static_cast(ncols)}; + + auto fr = xt::empty(shape_cols); + auto fc = xt::empty(shape_cols); fr.fill(k_coef * 0.5 * dt / (dy * dy)); fc.fill(k_coef * 0.5 * dt / (dx * dx)); @@ -225,10 +227,12 @@ void erode_linear_diffusion_impl(Er&& erosion, nrows, ncols); // solve for cols (i.e., transpose) + auto tranposed_dims = std::array {0, 2, 1}; + auto elevation_next = solve_diffusion_adi_row( xt::transpose(elevation_tmp), - xt::transpose(factors.second, {0, 2, 1}), - xt::transpose(factors.first, {0, 2, 1}), + xt::transpose(factors.second, tranposed_dims), + xt::transpose(factors.first, tranposed_dims), ncols, nrows); auto erosion_v = xt::view(erosion, xt::all(), xt::all());