Panzer Version of the Day
Loading...
Searching...
No Matches
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
24namespace panzer {
25namespace kokkos_utils {
26
30template <typename V>
32
33template < >
35public:
36 typedef Kokkos::View<double*,Kokkos::HostSpace ,Kokkos::MemoryTraits<Kokkos::Unmanaged > > View;
38};
39
40template < >
42public:
43 typedef Kokkos::View<const double*,Kokkos::HostSpace ,Kokkos::MemoryTraits<Kokkos::Unmanaged > > View;
45};
46
47template <typename VectorType>
48inline
51
52template < >
53inline
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
64template < >
65inline
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
Kokkos::View< double *, Kokkos::HostSpace,Kokkos::MemoryTraits< Kokkos::Unmanaged > > View
Kokkos::View< const double *, Kokkos::HostSpace,Kokkos::MemoryTraits< Kokkos::Unmanaged > > View
VectorToViewTraits< constEpetra_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)
VectorToViewTraits< VectorType >::View getView(typename VectorToViewTraits< VectorType >::ThyraVector &v)