Skip to content

Commit

Permalink
Fix ifdefs for kokkos
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrepebay committed Nov 8, 2024
1 parent e5d5e14 commit 4c0ad7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions include/pressio/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ template<class T, class Enable = void> struct Traits;
#ifdef PRESSIO_ENABLE_TPL_EIGEN
#include "type_traits/native_eigen_vector.hpp"
#endif
#ifdef PRESSIO_ENABLE_TPL_KOKKOS
#include "type_traits/native_kokkos_vector.hpp"
#endif
#ifdef PRESSIO_ENABLE_TPL_TRILINOS
#include "type_traits/native_teuchos_vector.hpp"
#include "type_traits/native_tpetra_block_vector.hpp"
Expand All @@ -75,9 +73,7 @@ template<class T, class Enable = void> struct Traits;
#endif // PRSSIO_ENABLE_TPL_TRILINOS

//*** matrix ****
#ifdef PRESSIO_ENABLE_TPL_KOKKOS
#include "type_traits/native_kokkos_dense_matrix.hpp"
#endif
#ifdef PRESSIO_ENABLE_TPL_TRILINOS
#include "type_traits/native_teuchos_dense_matrix.hpp"
#endif
Expand Down
6 changes: 6 additions & 0 deletions include/pressio/type_traits/native_kokkos_dense_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
#ifndef PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_DENSE_MATRIX_HPP_
#define PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_DENSE_MATRIX_HPP_

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
#include <KokkosSparse_CrsMatrix.hpp>
#endif

namespace pressio{

Expand All @@ -61,27 +63,31 @@ struct is_static_dense_matrix_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_static_dense_matrix_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==2 &&
view_type::traits::rank_dynamic==0;
};
#endif

// -------------------------------------------------
template <typename T>
struct is_dynamic_dense_matrix_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_dynamic_dense_matrix_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==2 &&
view_type::traits::rank_dynamic!=0;
};
#endif

// -------------------------------------------------
template <typename T, typename enable = void>
Expand Down
6 changes: 6 additions & 0 deletions include/pressio/type_traits/native_kokkos_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
#ifndef PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_VECTOR_HPP_
#define PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_VECTOR_HPP_

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
#include "Kokkos_Core.hpp"
#endif

namespace pressio{

Expand All @@ -64,13 +66,15 @@ struct is_static_vector_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_static_vector_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==1 &&
view_type::traits::rank_dynamic==0;
};
#endif

template <class T>
struct is_static_vector_kokkos<const T>: public is_static_vector_kokkos<T> {};
Expand All @@ -85,13 +89,15 @@ struct is_dynamic_vector_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_dynamic_vector_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==1 &&
view_type::traits::rank_dynamic!=0;
};
#endif

template <class T>
struct is_dynamic_vector_kokkos<const T>: public is_dynamic_vector_kokkos<T> {};
Expand Down

0 comments on commit 4c0ad7c

Please sign in to comment.