GEOS
DataLayouts.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_COMMON_DATALAYOUTS_HPP_
21 #define GEOS_COMMON_DATALAYOUTS_HPP_
22 
23 #include "common/GeosxConfig.hpp"
24 
25 #include "LvArray/src/Array.hpp"
26 #include "RAJA/RAJA.hpp"
27 
28 namespace geos
29 {
30 
36 template< int NDIM >
37 using defaultLayout = camp::make_idx_seq_t< NDIM >;
38 
44 template< typename PERM >
45 static constexpr int getUSD = LvArray::typeManipulation::getStrideOneDimension( PERM {} );
46 
47 namespace nodes
48 {
49 
50 #if defined( GEOS_USE_DEVICE )
51 
53 using REFERENCE_POSITION_PERM = RAJA::PERM_JI;
54 
56 using TOTAL_DISPLACEMENT_PERM = RAJA::PERM_JI;
57 
59 using INCR_DISPLACEMENT_PERM = RAJA::PERM_JI;
60 
62 using VELOCITY_PERM = RAJA::PERM_JI;
63 
65 using ACCELERATION_PERM = RAJA::PERM_JI;
66 
67 #else
68 
70 using REFERENCE_POSITION_PERM = RAJA::PERM_IJ;
71 
73 using TOTAL_DISPLACEMENT_PERM = RAJA::PERM_IJ;
74 
76 using INCR_DISPLACEMENT_PERM = RAJA::PERM_IJ;
77 
79 using VELOCITY_PERM = RAJA::PERM_IJ;
80 
82 using ACCELERATION_PERM = RAJA::PERM_IJ;
83 
84 #endif
85 
87 static constexpr int REFERENCE_POSITION_USD = LvArray::typeManipulation::getStrideOneDimension( REFERENCE_POSITION_PERM {} );
88 
90 static constexpr int TOTAL_DISPLACEMENT_USD = LvArray::typeManipulation::getStrideOneDimension( TOTAL_DISPLACEMENT_PERM {} );
91 
93 static constexpr int INCR_DISPLACEMENT_USD = LvArray::typeManipulation::getStrideOneDimension( INCR_DISPLACEMENT_PERM {} );
94 
96 static constexpr int VELOCITY_USD = LvArray::typeManipulation::getStrideOneDimension( VELOCITY_PERM {} );
97 
99 static constexpr int ACCELERATION_USD = LvArray::typeManipulation::getStrideOneDimension( ACCELERATION_PERM {} );
100 
101 } // namespace nodes
102 
103 namespace particles
104 {
105 
106 #if defined( GEOS_USE_CUDA )
107 
109 using REFERENCE_POSITION_PERM = RAJA::PERM_JI;
110 
112 using TOTAL_DISPLACEMENT_PERM = RAJA::PERM_JI;
113 
115 using VELOCITY_PERM = RAJA::PERM_JI;
116 
118 using ACCELERATION_PERM = RAJA::PERM_JI;
119 
120 #else
121 
123 using REFERENCE_POSITION_PERM = RAJA::PERM_IJ;
124 
126 using TOTAL_DISPLACEMENT_PERM = RAJA::PERM_IJ;
127 
129 using VELOCITY_PERM = RAJA::PERM_IJ;
130 
132 using ACCELERATION_PERM = RAJA::PERM_IJ;
133 
134 #endif
135 
137 static constexpr int REFERENCE_POSITION_USD = LvArray::typeManipulation::getStrideOneDimension( REFERENCE_POSITION_PERM {} );
138 
140 static constexpr int TOTAL_DISPLACEMENT_USD = LvArray::typeManipulation::getStrideOneDimension( TOTAL_DISPLACEMENT_PERM {} );
141 
143 static constexpr int VELOCITY_USD = LvArray::typeManipulation::getStrideOneDimension( VELOCITY_PERM {} );
144 
146 static constexpr int ACCELERATION_USD = LvArray::typeManipulation::getStrideOneDimension( ACCELERATION_PERM {} );
147 
148 } // namespace particles
149 
150 namespace cells
151 {
152 
153 #if defined( GEOS_USE_DEVICE )
154 
156 using NODE_MAP_PERMUTATION = RAJA::PERM_JI;
157 
159 using STRAIN_PERM = RAJA::PERM_JI;
160 
161 #else
162 
164 using NODE_MAP_PERMUTATION = RAJA::PERM_IJ;
165 
167 using STRAIN_PERM = RAJA::PERM_IJ;
168 
169 #endif
170 
172 static constexpr int NODE_MAP_USD = LvArray::typeManipulation::getStrideOneDimension( NODE_MAP_PERMUTATION {} );
173 
175 static constexpr int STRAIN_USD = LvArray::typeManipulation::getStrideOneDimension( STRAIN_PERM {} );
176 
177 } // namespace cells
178 
179 namespace solid
180 {
181 
182 #if defined( GEOS_USE_DEVICE )
183 
185 using STRESS_PERMUTATION = RAJA::PERM_KJI;
186 
188 using STIFFNESS_PERMUTATION = RAJA::PERM_KJI;
189 
190 #else
191 
193 using STRESS_PERMUTATION = RAJA::PERM_IJK;
194 
196 using STIFFNESS_PERMUTATION = RAJA::PERM_IJK;
197 
198 #endif
199 
201 static constexpr int STRESS_USD = LvArray::typeManipulation::getStrideOneDimension( STRESS_PERMUTATION {} );
202 
204 static constexpr int STIFFNESS_USD = LvArray::typeManipulation::getStrideOneDimension( STIFFNESS_PERMUTATION {} );
205 
206 } // namespace solid
207 
208 namespace compflow
209 {
210 
211 #if defined( GEOS_USE_DEVICE )
212 
214 using LAYOUT_COMP = RAJA::PERM_JI;
215 
217 using LAYOUT_COMP_DC = RAJA::PERM_JKI;
218 
220 using LAYOUT_PHASE = RAJA::PERM_JI;
221 
223 using LAYOUT_PHASE_DC = RAJA::PERM_JKI;
224 
226 using LAYOUT_PHASE_COMP = RAJA::PERM_JKI;
227 
229 using LAYOUT_FLUID_DC = RAJA::PERM_JI;
230 
232 using LAYOUT_OBL_OPERATOR_VALUES = RAJA::PERM_JI;
233 
235 using LAYOUT_OBL_OPERATOR_DERIVATIVES = RAJA::PERM_JKI;
236 
237 #else
238 
240 using LAYOUT_COMP = RAJA::PERM_IJ;
241 
243 using LAYOUT_COMP_DC = RAJA::PERM_IJK;
244 
246 using LAYOUT_PHASE = RAJA::PERM_IJ;
247 
249 using LAYOUT_PHASE_DC = RAJA::PERM_IJK;
250 
252 using LAYOUT_PHASE_COMP = RAJA::PERM_IJK;
253 
255 using LAYOUT_FLUID_DC = RAJA::PERM_IJ;
256 
258 using LAYOUT_OBL_OPERATOR_VALUES = RAJA::PERM_IJ;
259 
261 using LAYOUT_OBL_OPERATOR_DERIVATIVES = RAJA::PERM_IJK;
262 
263 #endif
264 
266 static constexpr int USD_COMP = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_COMP{} );
267 
269 static constexpr int USD_COMP_DC = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_COMP_DC{} );
270 
272 static constexpr int USD_PHASE = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_PHASE{} );
273 
275 static constexpr int USD_PHASE_DC = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_PHASE_DC{} );
276 
278 static constexpr int USD_PHASE_COMP = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_PHASE_COMP{} );
279 
281 static constexpr int USD_FLUID_DC = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_FLUID_DC{} );
282 
284 static constexpr int USD_OBL_VAL = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_OBL_OPERATOR_VALUES{} );
285 
287 static constexpr int USD_OBL_DER = LvArray::typeManipulation::getStrideOneDimension( LAYOUT_OBL_OPERATOR_DERIVATIVES{} );
288 
289 } // namespace compflow
290 
291 } // namespace geos
292 
293 #endif // GEOS_COMMON_DATALAYOUTS_HPP_
RAJA::PERM_IJ REFERENCE_POSITION_PERM
Particle reference position permutation when not using cuda.
RAJA::PERM_IJK STIFFNESS_PERMUTATION
Constitutive model stiffness permutation when not using cuda.
RAJA::PERM_IJ REFERENCE_POSITION_PERM
Node reference position permutation when not using cuda.
Definition: DataLayouts.hpp:70
RAJA::PERM_IJ LAYOUT_COMP
Component global density/fraction array layout.
static constexpr int STRAIN_USD
Cell strain unit stride dimension.
RAJA::PERM_IJ LAYOUT_OBL_OPERATOR_VALUES
OBL operator values array layout.
RAJA::PERM_IJ TOTAL_DISPLACEMENT_PERM
Particle total displacement permutation when not using cuda.
static constexpr int USD_OBL_VAL
OBL operator values unit stride dimension.
RAJA::PERM_IJ ACCELERATION_PERM
Particle acceleration permutation when not using cuda.
RAJA::PERM_IJ STRAIN_PERM
Cell strain permutation when not using cuda.
static constexpr int NODE_MAP_USD
Cell node map unit stride dimension.
RAJA::PERM_IJK LAYOUT_COMP_DC
Component global fraction compositional derivative array layout.
static constexpr int TOTAL_DISPLACEMENT_USD
Node total displacement unit stride dimension.
Definition: DataLayouts.hpp:90
static constexpr int REFERENCE_POSITION_USD
Node reference position unit stride dimension.
Definition: DataLayouts.hpp:87
static constexpr int ACCELERATION_USD
Node acceleration unit stride dimension.
Definition: DataLayouts.hpp:99
static constexpr int USD_OBL_DER
OBL operator derivatives unit stride dimension.
RAJA::PERM_IJ INCR_DISPLACEMENT_PERM
Node incremental displacement permutation when not using cuda.
Definition: DataLayouts.hpp:76
RAJA::PERM_IJ VELOCITY_PERM
Node velocity permutation when not using cuda.
Definition: DataLayouts.hpp:79
static constexpr int INCR_DISPLACEMENT_USD
Node incremental displacement unit stride dimension.
Definition: DataLayouts.hpp:93
static constexpr int USD_COMP_DC
Component global fraction compositional derivative unit stride dimension.
RAJA::PERM_IJ TOTAL_DISPLACEMENT_PERM
Node total displacement permutation when not using cuda.
Definition: DataLayouts.hpp:73
static constexpr int VELOCITY_USD
Node velocity unit stride dimension.
Definition: DataLayouts.hpp:96
RAJA::PERM_IJ VELOCITY_PERM
Particle velocity permutation when not using cuda.
static constexpr int USD_FLUID_DC
Fluid property compositional derivative unit stride dimension.
RAJA::PERM_IJK STRESS_PERMUTATION
Constitutive model stress permutation when not using cuda.
static constexpr int USD_COMP
Component global density/fraction unit stride dimension.
static constexpr int USD_PHASE_COMP
Phase property unit stride dimension.
RAJA::PERM_IJ LAYOUT_FLUID_DC
Fluid property compositional derivative array layout.
static constexpr int USD_PHASE_DC
Phase property compositional derivative unit stride dimension.
RAJA::PERM_IJK LAYOUT_OBL_OPERATOR_DERIVATIVES
OBL operator derivatives derivative array layout.
RAJA::PERM_IJ LAYOUT_PHASE
Phase property array layout.
static constexpr int STRESS_USD
Constitutive model stress unit stride dimension.
RAJA::PERM_IJK LAYOUT_PHASE_COMP
Phase composition array layout.
static constexpr int STIFFNESS_USD
Constitutive model stiffness unit stride dimension.
RAJA::PERM_IJK LAYOUT_PHASE_DC
Phase property array layout.
RAJA::PERM_IJ ACCELERATION_PERM
Node acceleration permutation when not using cuda.
Definition: DataLayouts.hpp:82
static constexpr int USD_PHASE
Phase property unit stride dimension.
RAJA::PERM_IJ NODE_MAP_PERMUTATION
Cell node map permutation when not using cuda.
static constexpr int getUSD
Just a handy shortcut for LvArray::typeManipulation::getStrideOneDimension.
Definition: DataLayouts.hpp:45
camp::make_idx_seq_t< NDIM > defaultLayout
Defaul permutation type for NDIM-dimensional array.
Definition: DataLayouts.hpp:37