Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Kokkos_LayoutNatural.hpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Sacado Package
5
// Copyright (2006) Sandia Corporation
6
//
7
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8
// the U.S. Government retains certain rights in this software.
9
//
10
// This library is free software; you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as
12
// published by the Free Software Foundation; either version 2.1 of the
13
// License, or (at your option) any later version.
14
//
15
// This library is distributed in the hope that it will be useful, but
16
// WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
// Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public
21
// License along with this library; if not, write to the Free Software
22
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23
// USA
24
// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25
// (etphipp@sandia.gov).
26
//
27
// ***********************************************************************
28
// @HEADER
29
30
#ifndef KOKKOS_LAYOUT_NATURAL_HPP
31
#define KOKKOS_LAYOUT_NATURAL_HPP
32
33
// We are hooking into Kokkos Core internals here
34
// Need to define this macro since we include non-public headers
35
#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
36
#define KOKKOS_IMPL_PUBLIC_INCLUDE
37
#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
38
#endif
39
#include "Kokkos_Core_fwd.hpp"
40
#include "Kokkos_Layout.hpp"
41
#include "
Kokkos_LayoutContiguous.hpp
"
// for inner_layout<>
42
#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
43
#undef KOKKOS_IMPL_PUBLIC_INCLUDE
44
#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
45
#endif
46
47
namespace
Kokkos
{
48
49
// Natural layout for scalar types -- equivalent to the wrapped
50
// layout type
51
template
<
typename
Layout>
52
struct
LayoutNatural
:
public
Layout {
53
55
typedef
LayoutNatural
array_layout
;
56
57
LayoutNatural
(
LayoutNatural
const
& ) = default ;
58
LayoutNatural
(
LayoutNatural
&& ) = default ;
59
LayoutNatural
&
operator =
(
LayoutNatural
const
& ) = default ;
60
LayoutNatural
&
operator =
(
LayoutNatural
&& ) = default ;
61
62
KOKKOS_INLINE_FUNCTION
63
constexpr
LayoutNatural
(
64
size_t
N0 = 0 ,
size_t
N1 = 0 ,
size_t
N2 = 0 ,
size_t
N3 = 0
65
,
size_t
N4 = 0 ,
size_t
N5 = 0 ,
size_t
N6 = 0 ,
size_t
N7 = 0 )
66
: Layout( N0 , N1 , N2 , N3 , N4 , N5 , N6 , N7 ) {}
67
};
68
69
// Is Layout == LayoutNatural<L> for some L
70
template
<
class
Layout>
71
struct
is_layout_natural
{
72
static
const
bool
value
=
false
;
73
};
74
75
template
<
class
Layout>
76
struct
is_layout_natural
<
LayoutNatural
<Layout> > {
77
static
const
bool
value
=
true
;
78
};
79
80
template
<
class
Layout>
81
struct
inner_layout
<
LayoutNatural
<Layout> > {
82
typedef
Layout
type
;
83
};
84
85
}
// namespace Kokkos
86
87
// Make LayoutNatural<Layout> equivalent to Layout
88
namespace
std
{
89
90
template
<
class
Layout>
91
struct
is_same<
Kokkos
::LayoutNatural<Layout>, Layout> {
92
static
const
bool
value
=
true
;
93
};
94
95
template
<
class
Layout>
96
struct
is_same< Layout,
Kokkos
::LayoutNatural<Layout> > {
97
static
const
bool
value
=
true
;
98
};
99
100
}
101
102
#include "impl/Kokkos_ViewMapping.hpp"
103
104
namespace
Kokkos
{
105
namespace
Impl {
106
107
// Implement ViewOffset for LayoutNatural
108
template
<
class
Dimension ,
class
Layout >
109
struct
ViewOffset
<Dimension,
LayoutNatural
<Layout>, void>
110
:
public
ViewOffset
<Dimension,Layout> {
111
public
:
112
113
// Would like to use inherited constructors, but gcc 4.7 doesn't support it
114
//using ViewOffset<Dimension,Layout>::ViewOffset;
115
116
typedef
ViewOffset<Dimension,Layout>
Base
;
117
118
ViewOffset
() = default ;
119
ViewOffset
(
const
ViewOffset
& ) = default ;
120
ViewOffset
& operator = (
const
ViewOffset
& ) = default ;
121
122
// All constructors take one or two arguments
123
124
template
<
typename
Arg1>
125
KOKKOS_INLINE_FUNCTION
126
constexpr
ViewOffset
(
const
Arg1& arg1) :
Base
(arg1) {}
127
128
template
<
typename
Arg1,
typename
Arg2>
129
KOKKOS_INLINE_FUNCTION
130
constexpr
ViewOffset
(
const
Arg1& arg1,
const
Arg2& arg2) :
Base
(arg1,arg2) {}
131
};
132
133
}
// namespace Impl
134
}
// namespace Kokkos
135
136
#endif
// #ifndef KOKKOS_LAYOUT_NATURAL_HPP
Kokkos_LayoutContiguous.hpp
Kokkos
Definition
Kokkos_LayoutContiguous.hpp:46
std
Definition
Kokkos_LayoutContiguous.hpp:97
Kokkos::Impl::ViewOffset< Dimension, LayoutNatural< Layout >, void >::Base
ViewOffset< Dimension, Layout > Base
Definition
Kokkos_LayoutNatural.hpp:116
Kokkos::Impl::ViewOffset< Dimension, LayoutNatural< Layout >, void >::ViewOffset
KOKKOS_INLINE_FUNCTION constexpr ViewOffset(const Arg1 &arg1, const Arg2 &arg2)
Definition
Kokkos_LayoutNatural.hpp:130
Kokkos::Impl::ViewOffset< Dimension, LayoutNatural< Layout >, void >::ViewOffset
ViewOffset()=default
Kokkos::Impl::ViewOffset< Dimension, LayoutNatural< Layout >, void >::ViewOffset
KOKKOS_INLINE_FUNCTION constexpr ViewOffset(const Arg1 &arg1)
Definition
Kokkos_LayoutNatural.hpp:126
Kokkos::Impl::ViewOffset< Dimension, LayoutNatural< Layout >, void >::ViewOffset
ViewOffset(const ViewOffset &)=default
Kokkos::LayoutNatural
Definition
Kokkos_LayoutNatural.hpp:52
Kokkos::LayoutNatural::LayoutNatural
KOKKOS_INLINE_FUNCTION constexpr LayoutNatural(size_t N0=0, size_t N1=0, size_t N2=0, size_t N3=0, size_t N4=0, size_t N5=0, size_t N6=0, size_t N7=0)
Definition
Kokkos_LayoutNatural.hpp:63
Kokkos::LayoutNatural::operator=
LayoutNatural & operator=(LayoutNatural const &)=default
Kokkos::LayoutNatural::LayoutNatural
LayoutNatural(LayoutNatural &&)=default
Kokkos::LayoutNatural::array_layout
LayoutNatural array_layout
Tag this class as a kokkos array layout.
Definition
Kokkos_LayoutNatural.hpp:55
Kokkos::LayoutNatural::LayoutNatural
LayoutNatural(LayoutNatural const &)=default
Kokkos::inner_layout< LayoutNatural< Layout > >::type
Layout type
Definition
Kokkos_LayoutNatural.hpp:82
Kokkos::inner_layout
Definition
Kokkos_LayoutContiguous.hpp:80
Kokkos::is_layout_natural< LayoutNatural< Layout > >::value
static const bool value
Definition
Kokkos_LayoutNatural.hpp:77
Kokkos::is_layout_natural
Definition
Kokkos_LayoutNatural.hpp:71
Kokkos::is_layout_natural::value
static const bool value
Definition
Kokkos_LayoutNatural.hpp:72
std::is_same< Kokkos::LayoutNatural< Layout >, Layout >::value
static const bool value
Definition
Kokkos_LayoutNatural.hpp:92
std::is_same< Layout, Kokkos::LayoutNatural< Layout > >::value
static const bool value
Definition
Kokkos_LayoutNatural.hpp:97
Generated by
1.17.0