/* * (C) Copyright 2013 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. * In applying this licence, ECMWF does not waive the privileges and immunities * granted to it by virtue of its status as an intergovernmental organisation * nor does it submit to any jurisdiction. */ #pragma once #include "atlas/array/ArrayView.h" namespace atlas { namespace array { #ifndef DOXYGEN_SHOULD_SKIP_THIS template constexpr typename std::enable_if<(cnt == RANK), idx_t>::type get_var_size_impl( array::ArrayView& field) { return 1; } template constexpr typename std::enable_if<(cnt != RANK), idx_t>::type get_var_size_impl( array::ArrayView& field) { return (cnt == DimSkip) ? get_var_size_impl(field) : get_var_size_impl(field) * field.template shape(); } template constexpr idx_t get_var_size(array::ArrayView& field) { return get_var_size_impl<0, DimSkip>(field); } template struct get_dim { static constexpr int value = -1; }; template struct get_dim> { static constexpr int value = cDim; }; template constexpr unsigned int get_parallel_dim(array::ArrayView& field) { static_assert(is_dim_policy::value, "DimPolicy required"); return std::is_same::value ? 0 : (std::is_same::value ? RANK - 1 : (get_dim::value)); } #endif } // namespace array } // namespace atlas