Skip to content

Commit

Permalink
restore epetra to type_traits
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Oct 1, 2024
1 parent d61eca2 commit ea495c9
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 4 deletions.
10 changes: 8 additions & 2 deletions include/pressio/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ template<class T, class Enable = void> struct Traits;
#include "type_traits/native_teuchos_vector.hpp"
#include "type_traits/native_tpetra_block_vector.hpp"
#include "type_traits/native_tpetra_vector.hpp"
#endif
#ifdef PRESSIO_ENABLE_EPETRA
#include "type_traits/native_epetra_vector.hpp"
#endif // PRESSIO_ENABLE_EPETRA
#endif // PRSSIO_ENABLE_TPL_TRILINOS

//*** matrix ****
#ifdef PRESSIO_ENABLE_TPL_KOKKOS
Expand All @@ -87,7 +90,10 @@ template<class T, class Enable = void> struct Traits;
#ifdef PRESSIO_ENABLE_TPL_TRILINOS
#include "type_traits/native_tpetra_block_multi_vector.hpp"
#include "type_traits/native_tpetra_multi_vector.hpp"
#endif
#ifdef PRESSIO_ENABLE_EPETRA
#include "type_traits/native_epetra_multi_vector.hpp"
#endif // PRESSIO_ENABLE_EPETRA
#endif // PRSSIO_ENABLE_TPL_TRILINOS

#include "type_traits/traits_tpl.hpp"

Expand Down
68 changes: 68 additions & 0 deletions include/pressio/type_traits/native_epetra_multi_vector.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
//@HEADER
// ************************************************************************
//
// native_epetra_multi_vector.hpp
// Pressio
// Copyright 2019
// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
//
// Under the terms of Contract DE-NA0003525 with NTESS, the
// U.S. Government retains certain rights in this software.
//
// Pressio is licensed under BSD-3-Clause terms of use:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Francesco Rizzi ([email protected])
//
// ************************************************************************
//@HEADER
*/

#ifndef PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_MULTI_VECTOR_HPP_
#define PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_MULTI_VECTOR_HPP_

#include "Epetra_MultiVector.h"

namespace pressio{

template <typename T, typename enable = void>
struct is_multi_vector_epetra : std::false_type {};

template <typename T>
struct is_multi_vector_epetra<T,
typename
std::enable_if<
std::is_same<T,Epetra_MultiVector>::value
>::type
> : std::true_type{};

}//end namespace
#endif // PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_MULTI_VECTOR_HPP_
69 changes: 69 additions & 0 deletions include/pressio/type_traits/native_epetra_vector.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
//@HEADER
// ************************************************************************
//
// native_epetra_vector.hpp
// Pressio
// Copyright 2019
// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
//
// Under the terms of Contract DE-NA0003525 with NTESS, the
// U.S. Government retains certain rights in this software.
//
// Pressio is licensed under BSD-3-Clause terms of use:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Francesco Rizzi ([email protected])
//
// ************************************************************************
//@HEADER
*/

#ifndef PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_VECTOR_HPP_
#define PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_VECTOR_HPP_

#include "Epetra_Vector.h"
#include "Epetra_MultiVector.h"

namespace pressio{

template <typename T, typename enable = void>
struct is_vector_epetra : std::false_type {};

template <typename T>
struct is_vector_epetra<T,
typename
std::enable_if<
std::is_same<T,Epetra_Vector>::value
>::type
> : std::true_type{};

}//end namespace
#endif // PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_VECTOR_HPP_
26 changes: 24 additions & 2 deletions include/pressio/type_traits/traits_tpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ struct Traits< T,
#endif

#ifdef PRESSIO_ENABLE_TPL_TRILINOS
#ifdef PRESSIO_ENABLE_EPETRA
template<typename T>
struct Traits< T,
std::enable_if_t< is_vector_epetra<T>::value > >
{
static constexpr int rank = 1;
using scalar_type = double;
};
#endif // PRESSIO_ENABLE_EPETRA

template<typename T>
struct Traits< T,
std::enable_if_t<
Expand All @@ -97,7 +107,7 @@ struct Traits< T,
static constexpr int rank = 1;
using scalar_type = typename T::impl_scalar_type;
};
#endif
#endif // PRESSIO_ENABLE_TPL_TRILINOS

#ifdef PRESSIO_ENABLE_TPL_TRILINOS
template<typename T>
Expand Down Expand Up @@ -158,7 +168,19 @@ struct Traits<
static constexpr int rank = 2;
using scalar_type = typename T::impl_scalar_type;
};
#endif

#ifdef PRESSIO_ENABLE_EPETRA
template<typename T>
struct Traits<
T, std::enable_if_t<
is_multi_vector_epetra<T>::value >
>
{
static constexpr int rank = 2;
using scalar_type = double;
};
#endif // PRESSIO_ENABLE_EPETRA
#endif // PRESSIO_ENABLE_TPL_TRILINOS

#ifdef PRESSIO_ENABLE_TPL_EIGEN
template <typename T>
Expand Down

0 comments on commit ea495c9

Please sign in to comment.