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

Tidied up headers in ArrayViewVariant.h and ArrayViewVariant.cc #231

Merged
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
9 changes: 5 additions & 4 deletions src/atlas/array/ArrayViewVariant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <string>
#include <type_traits>

#include "atlas/array/Array.h"
#include "atlas/array/MakeView.h"
#include "atlas/runtime/Exception.h"

namespace atlas {
Expand Down Expand Up @@ -49,10 +51,9 @@ VariantType<ArrayType> executeMakeView(ArrayType& array,
if constexpr (TypeIndex < std::variant_size_v<VariantType<ArrayType>> - 1) {
return executeMakeView<TypeIndex + 1>(array, makeView);
} else {
throw_Exception("ArrayView<" + array.datatype().str() + ", " +
std::to_string(array.rank()) +
"> is not an alternative in ArrayViewVariant.",
Here());
ATLAS_THROW_EXCEPTION("Array with rank = " + std::to_string(array.rank()) +
" and datatype = " + array.datatype().str() +
" is not supported.");
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/atlas/array/ArrayViewVariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@

#pragma once

#include <type_traits>
#include <variant>

#include "atlas/array.h"
#include "atlas/array/ArrayView.h"

namespace atlas {
namespace array {

namespace detail {

using namespace array;

// Container struct for a list of types.
template <typename... Ts>
struct Types {
Expand Down Expand Up @@ -54,6 +53,8 @@ using VariantRanks = detail::Ints<1, 2, 3, 4, 5, 6, 7, 8, 9>;

} // namespace detail

class Array;

/// @brief Variant containing all supported non-const ArrayView alternatives.
using ArrayViewVariant =
detail::Variant<detail::VariantValueTypes, detail::VariantRanks>;
Expand Down
1 change: 1 addition & 0 deletions src/atlas/runtime/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#pragma once

#include <string>
#include <sstream>

#include "eckit/log/CodeLocation.h"

Expand Down
Loading