Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_KokkosUtils_VectorToView.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef __Panzer_KokkosThyraConversion_hpp__
12 #define __Panzer_KokkosThyraConversion_hpp__
13 
14 #include "Kokkos_Core.hpp"
15 
16 #include "Teuchos_RCP.hpp"
17 #include "Teuchos_Ptr.hpp"
18 
19 #include "Thyra_VectorBase.hpp"
20 #include "Thyra_DefaultSpmdVector.hpp"
21 
22 #include "Epetra_Vector.h"
23 
24 namespace panzer {
25 namespace kokkos_utils {
26 
30 template <typename V>
32 
33 template < >
35 public:
38 };
39 
40 template < >
42 public:
45 };
46 
47 template <typename VectorType>
48 inline
51 
52 template < >
53 inline
56 {
57  auto values = Teuchos::ptr_dynamic_cast<Thyra::DefaultSpmdVector<double> >(Teuchos::ptrFromRef(v))->getRCPtr();
58 
59  VectorToViewTraits<Epetra_Vector>::View view(values.get(),values.size());
60 
61  return view;
62 }
63 
64 template < >
65 inline
68 {
69  auto values = Teuchos::ptr_dynamic_cast<const Thyra::DefaultSpmdVector<double> >(Teuchos::ptrFromRef(v))->getRCPtr();
70 
71  VectorToViewTraits<const Epetra_Vector>::View view(values.get(),values.size());
72 
73  return view;
74 }
75 
76 }
77 }
78 
79 #endif
VectorToViewTraits< VectorType >::View getView(typename VectorToViewTraits< VectorType >::ThyraVector &v)
VectorToViewTraits< const Epetra_Vector >::View getView< const Epetra_Vector >(typename VectorToViewTraits< const Epetra_Vector >::ThyraVector &v)
VectorToViewTraits< Epetra_Vector >::View getView< Epetra_Vector >(typename VectorToViewTraits< Epetra_Vector >::ThyraVector &v)
Kokkos::View< double *, Kokkos::HostSpace,Kokkos::MemoryTraits< Kokkos::Unmanaged > > View
Kokkos::View< const double *, Kokkos::HostSpace,Kokkos::MemoryTraits< Kokkos::Unmanaged > > View
const std::vector< std::pair< int, LocalOrdinal > > &pid_and_lid const