diff --git a/include/pressio/type_traits.hpp b/include/pressio/type_traits.hpp index fc446f9..4a4176f 100644 --- a/include/pressio/type_traits.hpp +++ b/include/pressio/type_traits.hpp @@ -69,7 +69,10 @@ template 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 @@ -87,7 +90,10 @@ template 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" diff --git a/include/pressio/type_traits/native_epetra_multi_vector.hpp b/include/pressio/type_traits/native_epetra_multi_vector.hpp new file mode 100644 index 0000000..5926a74 --- /dev/null +++ b/include/pressio/type_traits/native_epetra_multi_vector.hpp @@ -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 (fnrizzi@sandia.gov) +// +// ************************************************************************ +//@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 +struct is_multi_vector_epetra : std::false_type {}; + +template +struct is_multi_vector_epetra::value + >::type + > : std::true_type{}; + +}//end namespace +#endif // PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_MULTI_VECTOR_HPP_ diff --git a/include/pressio/type_traits/native_epetra_vector.hpp b/include/pressio/type_traits/native_epetra_vector.hpp new file mode 100644 index 0000000..78035bf --- /dev/null +++ b/include/pressio/type_traits/native_epetra_vector.hpp @@ -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 (fnrizzi@sandia.gov) +// +// ************************************************************************ +//@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 +struct is_vector_epetra : std::false_type {}; + +template +struct is_vector_epetra::value + >::type + > : std::true_type{}; + +}//end namespace +#endif // PRESSIOOPS_TYPE_TRAITS_NATIVE_EPETRA_VECTOR_HPP_ diff --git a/include/pressio/type_traits/traits_tpl.hpp b/include/pressio/type_traits/traits_tpl.hpp index 93d4ab8..bc102a5 100644 --- a/include/pressio/type_traits/traits_tpl.hpp +++ b/include/pressio/type_traits/traits_tpl.hpp @@ -89,6 +89,16 @@ struct Traits< T, #endif #ifdef PRESSIO_ENABLE_TPL_TRILINOS +#ifdef PRESSIO_ENABLE_EPETRA +template +struct Traits< T, + std::enable_if_t< is_vector_epetra::value > > +{ + static constexpr int rank = 1; + using scalar_type = double; +}; +#endif // PRESSIO_ENABLE_EPETRA + template struct Traits< T, std::enable_if_t< @@ -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 @@ -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 +struct Traits< + T, std::enable_if_t< + is_multi_vector_epetra::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