Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Kokkos_LayoutContiguous.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_CONTIGUOUS_HPP
31
#define KOKKOS_LAYOUT_CONTIGUOUS_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
#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
42
#undef KOKKOS_IMPL_PUBLIC_INCLUDE
43
#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
44
#endif
45
46
namespace
Kokkos
{
47
48
// Contiguous layout for scalar types -- equivalent to the wrapped
49
// layout type
50
template
<
typename
Layout,
unsigned
Str
id
e = 1>
51
struct
LayoutContiguous
:
public
Layout {
52
53
enum
{
scalar_stride
= Stride };
54
56
typedef
LayoutContiguous
array_layout
;
57
58
// Pull in Layout's constructors
59
using
Layout::Layout;
60
61
KOKKOS_INLINE_FUNCTION
62
constexpr
LayoutContiguous
( Layout
const
& layout ) : Layout(layout) {}
63
KOKKOS_INLINE_FUNCTION
64
constexpr
LayoutContiguous
( Layout && layout ) : Layout(layout) {}
65
};
66
67
// Is Layout == LayoutContiguous<L> for some L
68
template
<
class
Layout>
69
struct
is_layout_contiguous
{
70
static
const
bool
value
=
false
;
71
};
72
73
template
<
class
Layout>
74
struct
is_layout_contiguous
<
LayoutContiguous
<Layout> > {
75
static
const
bool
value
=
true
;
76
};
77
78
// Extract inner layout from LayoutContiguous
79
template
<
class
Layout>
80
struct
inner_layout
{
81
typedef
Layout
type
;
82
};
83
84
template
<
class
Layout>
85
struct
inner_layout
<
LayoutContiguous
<Layout> > {
86
typedef
Layout
type
;
87
};
88
89
template
<
class
Layout,
unsigned
Str
id
e>
90
struct
inner_layout
<
LayoutContiguous
<Layout, Stride> > {
91
typedef
Layout
type
;
92
};
93
94
}
// namespace Kokkos
95
96
// Make LayoutContiguous<Layout> equivalent to Layout
97
namespace
std
{
98
99
template
<
class
Layout,
unsigned
Str
id
e>
100
struct
is_same<
Kokkos
::LayoutContiguous<Layout,Stride>, Layout> {
101
static
const
bool
value
=
true
;
102
};
103
104
template
<
class
Layout,
unsigned
Str
id
e>
105
struct
is_same< Layout,
Kokkos
::LayoutContiguous<Layout,Stride> > {
106
static
const
bool
value
=
true
;
107
};
108
109
}
110
111
#include "impl/Kokkos_ViewMapping.hpp"
112
113
namespace
Kokkos
{
114
namespace
Impl
{
115
116
// Implement ViewOffset for LayoutContiguous
117
template
<
class
Dimension ,
class
Layout ,
unsigned
Str
id
e >
118
struct
ViewOffset
<Dimension,
LayoutContiguous
<Layout,Stride>, void>
119
:
public
ViewOffset
<Dimension,Layout> {
120
public
:
121
122
// Would like to use inherited constructors, but gcc 4.7 doesn't support it
123
//using ViewOffset<Dimension,Layout>::ViewOffset;
124
125
typedef
ViewOffset<Dimension,Layout>
Base
;
126
127
ViewOffset
() = default ;
128
ViewOffset
(
const
ViewOffset
& ) = default ;
129
ViewOffset
& operator = (
const
ViewOffset
& ) = default ;
130
131
// All constructors take one or two arguments
132
133
template
<
typename
Arg1>
134
KOKKOS_INLINE_FUNCTION
135
constexpr
ViewOffset
(
const
Arg1& arg1) :
Base
(arg1) {}
136
137
template
<
typename
Arg1,
typename
Arg2>
138
KOKKOS_INLINE_FUNCTION
139
constexpr
ViewOffset
(
const
Arg1& arg1,
const
Arg2& arg2) :
Base
(arg1,arg2) {}
140
};
141
142
template
<
typename
Layout>
143
struct
LayoutScalarStride
{
144
static
const
unsigned
stride
= 1;
145
static
const
bool
is_unit_stride
=
true
;
146
};
147
148
template
<
typename
Layout,
unsigned
Str
id
e>
149
struct
LayoutScalarStride
<
LayoutContiguous
<Layout,Stride> > {
150
static
const
unsigned
stride
= Stride;
151
static
const
bool
is_unit_stride
= (Stride == 1);
152
};
153
154
}
// namespace Impl
155
}
// namespace Kokkos
156
157
#endif
// #ifndef KOKKOS_LAYOUT_CONTIGUOUS_HPP
Kokkos::Impl
Definition
Kokkos_LayoutContiguous.hpp:114
Kokkos
Definition
Kokkos_LayoutContiguous.hpp:46
std
Definition
Kokkos_LayoutContiguous.hpp:97
Kokkos::Impl::LayoutScalarStride< LayoutContiguous< Layout, Stride > >::is_unit_stride
static const bool is_unit_stride
Definition
Kokkos_LayoutContiguous.hpp:151
Kokkos::Impl::LayoutScalarStride< LayoutContiguous< Layout, Stride > >::stride
static const unsigned stride
Definition
Kokkos_LayoutContiguous.hpp:150
Kokkos::Impl::LayoutScalarStride
Definition
Kokkos_LayoutContiguous.hpp:143
Kokkos::Impl::LayoutScalarStride::stride
static const unsigned stride
Definition
Kokkos_LayoutContiguous.hpp:144
Kokkos::Impl::LayoutScalarStride::is_unit_stride
static const bool is_unit_stride
Definition
Kokkos_LayoutContiguous.hpp:145
Kokkos::Impl::ViewOffset< Dimension, LayoutContiguous< Layout, Stride >, void >::ViewOffset
KOKKOS_INLINE_FUNCTION constexpr ViewOffset(const Arg1 &arg1, const Arg2 &arg2)
Definition
Kokkos_LayoutContiguous.hpp:139
Kokkos::Impl::ViewOffset< Dimension, LayoutContiguous< Layout, Stride >, void >::ViewOffset
KOKKOS_INLINE_FUNCTION constexpr ViewOffset(const Arg1 &arg1)
Definition
Kokkos_LayoutContiguous.hpp:135
Kokkos::Impl::ViewOffset< Dimension, LayoutContiguous< Layout, Stride >, void >::ViewOffset
ViewOffset()=default
Kokkos::Impl::ViewOffset< Dimension, LayoutContiguous< Layout, Stride >, void >::ViewOffset
ViewOffset(const ViewOffset &)=default
Kokkos::Impl::ViewOffset< Dimension, LayoutContiguous< Layout, Stride >, void >::Base
ViewOffset< Dimension, Layout > Base
Definition
Kokkos_LayoutContiguous.hpp:125
Kokkos::LayoutContiguous
Definition
Kokkos_LayoutContiguous.hpp:51
Kokkos::LayoutContiguous::array_layout
LayoutContiguous array_layout
Tag this class as a kokkos array layout.
Definition
Kokkos_LayoutContiguous.hpp:56
Kokkos::LayoutContiguous::LayoutContiguous
KOKKOS_INLINE_FUNCTION constexpr LayoutContiguous(Layout const &layout)
Definition
Kokkos_LayoutContiguous.hpp:62
Kokkos::LayoutContiguous::LayoutContiguous
KOKKOS_INLINE_FUNCTION constexpr LayoutContiguous(Layout &&layout)
Definition
Kokkos_LayoutContiguous.hpp:64
Kokkos::LayoutContiguous< Kokkos::LayoutLeft >::scalar_stride
@ scalar_stride
Definition
Kokkos_LayoutContiguous.hpp:53
Kokkos::inner_layout< LayoutContiguous< Layout, Stride > >::type
Layout type
Definition
Kokkos_LayoutContiguous.hpp:91
Kokkos::inner_layout< LayoutContiguous< Layout > >::type
Layout type
Definition
Kokkos_LayoutContiguous.hpp:86
Kokkos::inner_layout
Definition
Kokkos_LayoutContiguous.hpp:80
Kokkos::inner_layout::type
Layout type
Definition
Kokkos_LayoutContiguous.hpp:81
Kokkos::is_layout_contiguous< LayoutContiguous< Layout > >::value
static const bool value
Definition
Kokkos_LayoutContiguous.hpp:75
Kokkos::is_layout_contiguous
Definition
Kokkos_LayoutContiguous.hpp:69
Kokkos::is_layout_contiguous::value
static const bool value
Definition
Kokkos_LayoutContiguous.hpp:70
std::is_same< Kokkos::LayoutContiguous< Layout, Stride >, Layout >::value
static const bool value
Definition
Kokkos_LayoutContiguous.hpp:101
std::is_same< Layout, Kokkos::LayoutContiguous< Layout, Stride > >::value
static const bool value
Definition
Kokkos_LayoutContiguous.hpp:106
Generated by
1.17.0