MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_IndexManager_kokkos_decl.hpp
Go to the documentation of this file.
1
// @HEADER
2
//
3
// ***********************************************************************
4
//
5
// MueLu: A package for multigrid based preconditioning
6
// Copyright 2012 Sandia Corporation
7
//
8
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9
// the U.S. Government retains certain rights in this software.
10
//
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are
13
// met:
14
//
15
// 1. Redistributions of source code must retain the above copyright
16
// notice, this list of conditions and the following disclaimer.
17
//
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice, this list of conditions and the following disclaimer in the
20
// documentation and/or other materials provided with the distribution.
21
//
22
// 3. Neither the name of the Corporation nor the names of the
23
// contributors may be used to endorse or promote products derived from
24
// this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
//
38
// Questions? Contact
39
// Jonathan Hu (jhu@sandia.gov)
40
// Ray Tuminaro (rstumin@sandia.gov)
41
// Luc Berger-Vergiat (lberge@sandia.gov)
42
//
43
// ***********************************************************************
44
//
45
// @HEADER
46
#ifndef MUELU_INDEXMANAGER_KOKKOS_DECL_HPP
47
#define MUELU_INDEXMANAGER_KOKKOS_DECL_HPP
48
49
#include "
MueLu_ConfigDefs.hpp
"
50
#include "
MueLu_Types.hpp
"
51
52
#include <Tpetra_KokkosCompat_ClassicNodeAPI_Wrapper.hpp>
53
54
#include "Teuchos_OrdinalTraits.hpp"
55
56
57
#include "
MueLu_BaseClass.hpp
"
58
#include "
MueLu_IndexManager_kokkos_fwd.hpp
"
59
60
/*****************************************************************************
61
62
****************************************************************************/
63
64
namespace
MueLu
{
65
76
77
template
<
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
78
class
IndexManager_kokkos
:
public
BaseClass
{
79
#undef MUELU_INDEXMANAGER_KOKKOS_SHORT
80
#include "
MueLu_UseShortNamesOrdinal.hpp
"
81
82
public
:
83
using
execution_space
=
typename
Node::execution_space;
84
using
memory_space
=
typename
Node::memory_space;
85
using
device_type
= Kokkos::Device<execution_space, memory_space>;
86
using
intTupleView
=
typename
Kokkos::View<int[3], device_type>;
87
using
LOTupleView
=
typename
Kokkos::View<LO[3], device_type>;
88
89
private
:
90
91
const
int
meshLayout
=
UNCOUPLED
;
92
int
myRank
= -1;
93
int
numDimensions
;
94
int
interpolationOrder_
;
95
intTupleView
coarseRate
;
96
intTupleView
endRate
;
97
98
LO
lNumFineNodes
;
99
LO
lNumFineNodes10
;
100
LOTupleView
lFineNodesPerDir
;
101
102
LO
numCoarseNodes
;
103
LO
numCoarseNodes10
;
104
LOTupleView
coarseNodesPerDir
;
105
106
public
:
107
109
IndexManager_kokkos
() =
default
;
110
112
IndexManager_kokkos
(
const
int
NumDimensions,
113
const
int
interpolationOrder,
114
const
int
MyRank,
115
const
ArrayView<const LO> LFineNodesPerDir,
116
const
ArrayView<const int> CoarseRate);
117
118
virtual
~IndexManager_kokkos
() {}
119
121
void
setupIM
(
const
int
NumDimensions,
122
const
int
interpolationOrder,
123
const
ArrayView<const int>
coarseRate
,
124
const
ArrayView<const LO> LFineNodesPerDir);
125
128
void
computeMeshParameters
();
129
130
int
getNumDimensions
()
const
{
return
numDimensions
;}
131
132
int
getInterpolationOrder
()
const
{
return
interpolationOrder_
;}
133
134
LO
getNumLocalFineNodes
()
const
{
return
lNumFineNodes
;}
135
136
LO
getNumCoarseNodes
()
const
{
return
numCoarseNodes
;}
137
138
KOKKOS_INLINE_FUNCTION
139
intTupleView
getCoarseningRates
()
const
{
return
coarseRate
;}
140
141
KOKKOS_INLINE_FUNCTION
142
intTupleView
getCoarseningEndRates
()
const
{
return
endRate
;}
143
144
KOKKOS_INLINE_FUNCTION
145
LOTupleView
getLocalFineNodesPerDir
()
const
{
return
lFineNodesPerDir
;}
146
147
KOKKOS_INLINE_FUNCTION
148
LOTupleView
getCoarseNodesPerDir
()
const
{
return
coarseNodesPerDir
;}
149
150
Array<LO>
getCoarseNodesPerDirArray
()
const
;
151
152
KOKKOS_INLINE_FUNCTION
153
void
getFineLID2FineTuple
(
const
LO myLID, LO (&tuple)[3])
const
{
154
LO tmp;
155
tuple[2] = myLID / (
lFineNodesPerDir
(1)*
lFineNodesPerDir
(0));
156
tmp = myLID % (
lFineNodesPerDir
(1)*
lFineNodesPerDir
(0));
157
tuple[1] = tmp /
lFineNodesPerDir
(0);
158
tuple[0] = tmp %
lFineNodesPerDir
(0);
159
}
// getFineNodeLocalTuple
160
161
KOKKOS_INLINE_FUNCTION
162
void
getFineTuple2FineLID
(
const
LO tuple[3], LO& myLID)
const
{
163
myLID = tuple[2]*
lNumFineNodes10
+ tuple[1]*
lFineNodesPerDir
[0] + tuple[0];
164
}
// getFineNodeLID
165
166
KOKKOS_INLINE_FUNCTION
167
void
getCoarseLID2CoarseTuple
(
const
LO myLID, LO (&tuple)[3])
const
{
168
LO tmp;
169
tuple[2] = myLID /
numCoarseNodes10
;
170
tmp = myLID %
numCoarseNodes10
;
171
tuple[1] = tmp /
coarseNodesPerDir
[0];
172
tuple[0] = tmp %
coarseNodesPerDir
[0];
173
}
// getCoarseNodeLocalTuple
174
175
KOKKOS_INLINE_FUNCTION
176
void
getCoarseTuple2CoarseLID
(
const
LO i,
const
LO j,
const
LO k, LO& myLID)
const
{
177
myLID = k*
numCoarseNodes10
+ j*
coarseNodesPerDir
[0] + i;
178
}
// getCoarseNodeLID
179
180
};
181
182
}
//namespace MueLu
183
184
#define MUELU_INDEXMANAGER_KOKKOS_SHORT
185
#endif
// MUELU_INDEXMANAGER_KOKKOS_DECL_HPP
MueLu_BaseClass.hpp
MueLu_ConfigDefs.hpp
MueLu_IndexManager_kokkos_fwd.hpp
MueLu_Types.hpp
MueLu_UseShortNamesOrdinal.hpp
MueLu::BaseClass
Base class for MueLu classes.
Definition
MueLu_BaseClass.hpp:63
MueLu::IndexManager_kokkos::numCoarseNodes10
LO numCoarseNodes10
local number of nodes per 0-1 slice remaining after coarsening.
Definition
MueLu_IndexManager_kokkos_decl.hpp:103
MueLu::IndexManager_kokkos::computeMeshParameters
void computeMeshParameters()
Definition
MueLu_IndexManager_kokkos_def.hpp:134
MueLu::IndexManager_kokkos::~IndexManager_kokkos
virtual ~IndexManager_kokkos()
Definition
MueLu_IndexManager_kokkos_decl.hpp:118
MueLu::IndexManager_kokkos::getNumCoarseNodes
LO getNumCoarseNodes() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:136
MueLu::IndexManager_kokkos::coarseNodesPerDir
LOTupleView coarseNodesPerDir
local number of nodes per direction remaing after coarsening.
Definition
MueLu_IndexManager_kokkos_decl.hpp:104
MueLu::IndexManager_kokkos::getNumLocalFineNodes
LO getNumLocalFineNodes() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:134
MueLu::IndexManager_kokkos::getCoarseNodesPerDir
KOKKOS_INLINE_FUNCTION LOTupleView getCoarseNodesPerDir() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:148
MueLu::IndexManager_kokkos::endRate
intTupleView endRate
adapted coarsening rate at the edge of the mesh in each direction.
Definition
MueLu_IndexManager_kokkos_decl.hpp:96
MueLu::IndexManager_kokkos::lNumFineNodes
LO lNumFineNodes
local number of nodes.
Definition
MueLu_IndexManager_kokkos_decl.hpp:98
MueLu::IndexManager_kokkos::lNumFineNodes10
LO lNumFineNodes10
local number of nodes per 0-1 slice.
Definition
MueLu_IndexManager_kokkos_decl.hpp:99
MueLu::IndexManager_kokkos::device_type
Kokkos::Device< execution_space, memory_space > device_type
Definition
MueLu_IndexManager_kokkos_decl.hpp:85
MueLu::IndexManager_kokkos::getCoarseLID2CoarseTuple
KOKKOS_INLINE_FUNCTION void getCoarseLID2CoarseTuple(const LO myLID, LO(&tuple)[3]) const
Definition
MueLu_IndexManager_kokkos_decl.hpp:167
MueLu::IndexManager_kokkos::getCoarseTuple2CoarseLID
KOKKOS_INLINE_FUNCTION void getCoarseTuple2CoarseLID(const LO i, const LO j, const LO k, LO &myLID) const
Definition
MueLu_IndexManager_kokkos_decl.hpp:176
MueLu::IndexManager_kokkos::getLocalFineNodesPerDir
KOKKOS_INLINE_FUNCTION LOTupleView getLocalFineNodesPerDir() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:145
MueLu::IndexManager_kokkos::execution_space
typename Node::execution_space execution_space
Definition
MueLu_IndexManager_kokkos_decl.hpp:83
MueLu::IndexManager_kokkos::getFineLID2FineTuple
KOKKOS_INLINE_FUNCTION void getFineLID2FineTuple(const LO myLID, LO(&tuple)[3]) const
Definition
MueLu_IndexManager_kokkos_decl.hpp:153
MueLu::IndexManager_kokkos::lFineNodesPerDir
LOTupleView lFineNodesPerDir
local number of nodes per direction.
Definition
MueLu_IndexManager_kokkos_decl.hpp:100
MueLu::IndexManager_kokkos::meshLayout
const int meshLayout
Definition
MueLu_IndexManager_kokkos_decl.hpp:91
MueLu::IndexManager_kokkos::memory_space
typename Node::memory_space memory_space
Definition
MueLu_IndexManager_kokkos_decl.hpp:84
MueLu::IndexManager_kokkos::LOTupleView
typename Kokkos::View< LO[3], device_type > LOTupleView
Definition
MueLu_IndexManager_kokkos_decl.hpp:87
MueLu::IndexManager_kokkos::getNumDimensions
int getNumDimensions() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:130
MueLu::IndexManager_kokkos::numCoarseNodes
LO numCoarseNodes
local number of nodes remaining after coarsening.
Definition
MueLu_IndexManager_kokkos_decl.hpp:102
MueLu::IndexManager_kokkos::getCoarseningRates
KOKKOS_INLINE_FUNCTION intTupleView getCoarseningRates() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:139
MueLu::IndexManager_kokkos::getCoarseNodesPerDirArray
Array< LO > getCoarseNodesPerDirArray() const
Definition
MueLu_IndexManager_kokkos_def.hpp:218
MueLu::IndexManager_kokkos::getInterpolationOrder
int getInterpolationOrder() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:132
MueLu::IndexManager_kokkos::IndexManager_kokkos
IndexManager_kokkos()=default
Default constructor, return empty object.
MueLu::IndexManager_kokkos::coarseRate
intTupleView coarseRate
coarsening rate in each direction
Definition
MueLu_IndexManager_kokkos_decl.hpp:95
MueLu::IndexManager_kokkos::myRank
int myRank
Definition
MueLu_IndexManager_kokkos_decl.hpp:92
MueLu::IndexManager_kokkos::getCoarseningEndRates
KOKKOS_INLINE_FUNCTION intTupleView getCoarseningEndRates() const
Definition
MueLu_IndexManager_kokkos_decl.hpp:142
MueLu::IndexManager_kokkos::numDimensions
int numDimensions
Number of spacial dimensions in the problem.
Definition
MueLu_IndexManager_kokkos_decl.hpp:93
MueLu::IndexManager_kokkos::getFineTuple2FineLID
KOKKOS_INLINE_FUNCTION void getFineTuple2FineLID(const LO tuple[3], LO &myLID) const
Definition
MueLu_IndexManager_kokkos_decl.hpp:162
MueLu::IndexManager_kokkos::interpolationOrder_
int interpolationOrder_
Interpolation order used by grid transfer operators using these aggregates.
Definition
MueLu_IndexManager_kokkos_decl.hpp:94
MueLu::IndexManager_kokkos::setupIM
void setupIM(const int NumDimensions, const int interpolationOrder, const ArrayView< const int > coarseRate, const ArrayView< const LO > LFineNodesPerDir)
Common setup pattern used for all the different types of undelying mesh.
Definition
MueLu_IndexManager_kokkos_def.hpp:96
MueLu::IndexManager_kokkos::intTupleView
typename Kokkos::View< int[3], device_type > intTupleView
Definition
MueLu_IndexManager_kokkos_decl.hpp:86
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:78
MueLu::UNCOUPLED
@ UNCOUPLED
Definition
MueLu_Types.hpp:92
src
Graph
StructuredAggregation
MueLu_IndexManager_kokkos_decl.hpp
Generated by
1.17.0