Skip to content

Commit

Permalink
Tidied headers and error message. (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
odlomax authored Oct 10, 2024
1 parent df6290e commit f1c0c17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
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

0 comments on commit f1c0c17

Please sign in to comment.