From ece0a3cf7d0307d76ddb34acfb4b984cca5896c7 Mon Sep 17 00:00:00 2001 From: Christopher Mauney Date: Fri, 30 Aug 2024 13:49:37 -0600 Subject: [PATCH] comment cleanup and copyright --- ports-of-call/array.hpp | 13 +++++++ ports-of-call/utility/array_algo.hpp | 13 +++++++ ports-of-call/utility/index_algo.hpp | 54 +++++++--------------------- test/test_array.cpp | 13 +++++++ test/test_utilities.hpp | 17 +++++++-- 5 files changed, 67 insertions(+), 43 deletions(-) diff --git a/ports-of-call/array.hpp b/ports-of-call/array.hpp index 64569f0..a5556e4 100644 --- a/ports-of-call/array.hpp +++ b/ports-of-call/array.hpp @@ -1,3 +1,16 @@ +// © (or copyright) 2019-2024. Triad National Security, LLC. All rights +// reserved. This program was produced under U.S. Government contract +// 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is +// operated by Triad National Security, LLC for the U.S. Department of +// Energy/National Nuclear Security Administration. All rights in the +// program are reserved by Triad National Security, LLC, and the +// U.S. Department of Energy/National Nuclear Security +// Administration. The Government is granted for itself and others acting +// on its behalf a nonexclusive, paid-up, irrevocable worldwide license +// in this material to reproduce, prepare derivative works, distribute +// copies to the public, perform publicly and display publicly, and to +// permit others to do so. + #ifndef _PORTS_OF_CALL_ARRAY_HPP_ #define _PORTS_OF_CALL_ARRAY_HPP_ diff --git a/ports-of-call/utility/array_algo.hpp b/ports-of-call/utility/array_algo.hpp index f10d09c..bf15786 100644 --- a/ports-of-call/utility/array_algo.hpp +++ b/ports-of-call/utility/array_algo.hpp @@ -1,3 +1,16 @@ +// © (or copyright) 2019-2024. Triad National Security, LLC. All rights +// reserved. This program was produced under U.S. Government contract +// 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is +// operated by Triad National Security, LLC for the U.S. Department of +// Energy/National Nuclear Security Administration. All rights in the +// program are reserved by Triad National Security, LLC, and the +// U.S. Department of Energy/National Nuclear Security +// Administration. The Government is granted for itself and others acting +// on its behalf a nonexclusive, paid-up, irrevocable worldwide license +// in this material to reproduce, prepare derivative works, distribute +// copies to the public, perform publicly and display publicly, and to +// permit others to do so. + #ifndef _PORTSOFCALL_UTILITY_ARRAY_ALGO_HPP_ #define _PORTSOFCALL_UTILITY_ARRAY_ALGO_HPP_ diff --git a/ports-of-call/utility/index_algo.hpp b/ports-of-call/utility/index_algo.hpp index efc4b3b..3a50762 100644 --- a/ports-of-call/utility/index_algo.hpp +++ b/ports-of-call/utility/index_algo.hpp @@ -1,3 +1,16 @@ +// © (or copyright) 2019-2024. Triad National Security, LLC. All rights +// reserved. This program was produced under U.S. Government contract +// 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is +// operated by Triad National Security, LLC for the U.S. Department of +// Energy/National Nuclear Security Administration. All rights in the +// program are reserved by Triad National Security, LLC, and the +// U.S. Department of Energy/National Nuclear Security +// Administration. The Government is granted for itself and others acting +// on its behalf a nonexclusive, paid-up, irrevocable worldwide license +// in this material to reproduce, prepare derivative works, distribute +// copies to the public, perform publicly and display publicly, and to +// permit others to do so. + #ifndef _PORTSOFCALL_UTILITY_INDEX_ALGO_HPP_ #define _PORTSOFCALL_UTILITY_INDEX_ALGO_HPP_ @@ -9,47 +22,6 @@ namespace util { -/* - template -PORTABLE_FORCEINLINE_FUNCTION static constexpr auto -get_stride(std::array const &dim) { - static_assert(I < dim.size(), "Dim index is out of bounds"); - - // column major - return std::accumulate(std::begin(dim), std::begin(dim) + I, std::size_t{1}, - std::multiplies{}); -} - -namespace detail { -template -PORTABLE_FORCEINLINE_FUNCTION static constexpr auto -get_strides_impl(std::array const &dim, std::index_sequence) { - return std::array{get_stride(dim)...}; -} - -} // namespace detail - -template -PORTABLE_FORCEINLINE_FUNCTION static constexpr auto -get_strides(std::array const &dim) { - return detail::get_strides_impl(dim, std::make_index_sequence{}); -} - -template -PORTABLE_FORCEINLINE_FUNCTION static constexpr auto -fast_findex(std::array const &ijk, std::array const &dim, - std::array const &stride) { - // TODO: assert ijk in bounds - return std::inner_product(std::begin(ijk), std::end(ijk), std::begin(stride), - std::size_t{0}); -} - -template -PORTABLE_FORCEINLINE_FUNCTION static constexpr auto -findex(std::array const &ijk, std::array const &dim) { - return fast_findex(ijk, dim, get_strides(dim)); -} -*/ template PORTABLE_FORCEINLINE_FUNCTION static constexpr auto get_stride(A const &dim) { diff --git a/test/test_array.cpp b/test/test_array.cpp index 3a9423f..64f0e83 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -1,3 +1,16 @@ +// © (or copyright) 2019-2024. Triad National Security, LLC. All rights +// reserved. This program was produced under U.S. Government contract +// 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is +// operated by Triad National Security, LLC for the U.S. Department of +// Energy/National Nuclear Security Administration. All rights in the +// program are reserved by Triad National Security, LLC, and the +// U.S. Department of Energy/National Nuclear Security +// Administration. The Government is granted for itself and others acting +// on its behalf a nonexclusive, paid-up, irrevocable worldwide license +// in this material to reproduce, prepare derivative works, distribute +// copies to the public, perform publicly and display publicly, and to +// permit others to do so. + #include "ports-of-call/array.hpp" #include "ports-of-call/portability.hpp" diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index 0cb2de4..30ba209 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -1,5 +1,18 @@ -#ifndef _TEST_PORTOFCALL_HPP_ -#define _TEST_PORTOFCALL_HPP_ +// © (or copyright) 2019-2024. Triad National Security, LLC. All rights +// reserved. This program was produced under U.S. Government contract +// 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is +// operated by Triad National Security, LLC for the U.S. Department of +// Energy/National Nuclear Security Administration. All rights in the +// program are reserved by Triad National Security, LLC, and the +// U.S. Department of Energy/National Nuclear Security +// Administration. The Government is granted for itself and others acting +// on its behalf a nonexclusive, paid-up, irrevocable worldwide license +// in this material to reproduce, prepare derivative works, distribute +// copies to the public, perform publicly and display publicly, and to +// permit others to do so. + +#ifndef _TEST_TEST_UTILITIES_HPP_ +#define _TEST_TEST_UTILITIES_HPP_ #include #include