Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_SparseLocalGrid_impl.hpp
1/****************************************************************************
2 * Copyright (c) 2018-2023 by the Cabana authors *
3 * All rights reserved. *
4 * *
5 * This file is part of the Cabana library. Cabana is distributed under a *
6 * BSD 3-clause license. For the licensing terms see the LICENSE file in *
7 * the top-level directory. *
8 * *
9 * SPDX-License-Identifier: BSD-3-Clause *
10 ****************************************************************************/
11
12#ifndef CABANA_GRID_LOCALGRID_SPARSE_IMPL_HPP
13#define CABANA_GRID_LOCALGRID_SPARSE_IMPL_HPP
14
15#include <type_traits>
16namespace Cabana
17{
18namespace Grid
19{
20namespace Experimental
21{
22//---------------------------------------------------------------------------//
23// Constructor
24template <class Scalar, std::size_t NumSpaceDim>
26 const std::shared_ptr<GlobalGrid<mesh_type>>& global_grid,
27 const int halo_cell_width, const long cell_num_per_tile_dim )
28 : _global_grid( global_grid )
29 , _cell_num_per_tile_dim( cell_num_per_tile_dim )
30{
31 static_assert( 3 == num_space_dim, "SparseMesh supports only 3D" );
32 // ensure integer number of halo tiles
33 _halo_cell_width =
34 static_cast<int>( ( halo_cell_width + cell_num_per_tile_dim - 1 ) /
35 cell_num_per_tile_dim ) *
36 cell_num_per_tile_dim;
37}
38
39//---------------------------------------------------------------------------//
40// Get the global grid that owns the local grid.
41template <class Scalar, std::size_t NumSpaceDim>
44{
45 return *_global_grid;
46}
47
48//---------------------------------------------------------------------------//
49// Get a mutable version of the global grid that own the local grid.
50template <class Scalar, std::size_t NumSpaceDim>
56
57//---------------------------------------------------------------------------//
58// Get the halo size. (unit in cell)
59template <class Scalar, std::size_t NumSpaceDim>
61{
62 return _halo_cell_width;
63}
64
65//---------------------------------------------------------------------------//
66// Get the halo size. (unit in tile)
67template <class Scalar, std::size_t NumSpaceDim>
69{
70 return _halo_cell_width / _cell_num_per_tile_dim;
71}
72
73//---------------------------------------------------------------------------//
74// Get the total number of local cells in a given dimension (owned + halo).
75template <class Scalar, std::size_t NumSpaceDim>
77 const int d ) const
78{
79 return _global_grid->ownedNumCell( d ) + 2 * _halo_cell_width;
80}
81
82//---------------------------------------------------------------------------//
83// Get the total number of local cells in current rank (owned + halo).
84template <class Scalar, std::size_t NumSpaceDim>
86{
87 int total_num_cell = 1;
88 for ( std::size_t d = 0; d < num_space_dim; ++d )
89 total_num_cell *= totalNumCell( static_cast<int>( d ) );
90
91 return total_num_cell;
92}
93
94//---------------------------------------------------------------------------//
95// Given the relative offsets of a neighbor rank relative to this local grid's
96// indices get the of the neighbor.
97template <class Scalar, std::size_t NumSpaceDim>
99 const std::array<int, num_space_dim>& off_ijk ) const
100{
101 std::array<int, num_space_dim> nijk;
102 for ( std::size_t d = 0; d < num_space_dim; ++d )
103 nijk[d] = _global_grid->dimBlockId( d ) + off_ijk[d];
104 return _global_grid->blockRank( nijk );
105}
106
107template <class Scalar, std::size_t NumSpaceDim>
109 const int off_i, const int off_j, const int off_k ) const
110{
111 std::array<int, num_space_dim> off_ijk = { off_i, off_j, off_k };
112 return neighborRank( off_ijk );
113}
114
116//---------------------------------------------------------------------------//
117// Get the index space for a given combination of decomposition, entity, and
118// index types.
119template <class Scalar, std::size_t NumSpaceDim>
120template <class DecompositionTag, class EntityType, class IndexType>
122 DecompositionTag t1, EntityType t2, IndexType t3 ) const
124{
125 return indexSpaceImpl( t1, t2, t3 );
126}
127
128//---------------------------------------------------------------------------//
129// Given the relative offsets of a neighbor rank relative to this local
130// grid's indices get the set of local entity indices shared with that
131// neighbor in the given decomposition. Optionally provide a halo width
132// for the shared space. This halo width must be less than or equal to the
133// halo width of the local grid. The default behavior is to use the halo
134// width of the local grid.
135template <class Scalar, std::size_t NumSpaceDim>
136template <unsigned long long cellBitsPerTileDim, class DecompositionTag,
137 class EntityType>
138auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpace(
139 DecompositionTag t1, EntityType t2,
140 const std::array<int, num_space_dim>& off_ijk, const int halo_width ) const
142{
143 static constexpr unsigned long long cell_num_per_tile_dim =
144 1 << cellBitsPerTileDim;
145
146 int hw = ( -1 == halo_width ) ? _halo_cell_width : halo_width;
147 hw = static_cast<int>( ( hw + cell_num_per_tile_dim - 1 ) /
148 cell_num_per_tile_dim ) *
149 cell_num_per_tile_dim;
150
151 // Check that the offsets are valid.
152 for ( std::size_t d = 0; d < num_space_dim; ++d )
153 if ( off_ijk[d] < -1 || 1 < off_ijk[d] )
154 throw std::logic_error(
155 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
156 "(SparseMesh): Neighbor indices out of bounds" );
157
158 // Check that the requested halo width is valid.
159 if ( hw > _halo_cell_width )
160 throw std::logic_error(
161 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
162 "(SparseMesh):Requested halo width larger than local grid halo" );
163
164 // Check to see if this is a valid neighbor. If not, return a shared space
165 // of size 0.
166 if ( neighborRank( off_ijk ) < 0 )
167 {
168 std::array<long, num_space_dim> zero_size;
169 for ( std::size_t d = 0; d < num_space_dim; ++d )
170 zero_size[d] = 0;
172 zero_size );
173 }
174
175 // Call the underlying implementation.
176 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, t2, off_ijk, hw );
177}
178
179//---------------------------------------------------------------------------//
180// Get the global shared tile index space according to input tags
181template <class Scalar, std::size_t NumSpaceDim>
182template <unsigned long long cellBitsPerTileDim, class DecompositionTag,
183 class EntityType, std::size_t NSD>
184std::enable_if_t<3 == NSD, TileIndexSpace<3, cellBitsPerTileDim>>
185LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpace(
186 DecompositionTag t1, EntityType t2, const int off_i, const int off_j,
187 const int off_k, const int halo_width ) const
188{
189 std::array<int, 3> off_ijk = { off_i, off_j, off_k };
190 return sharedTileIndexSpace<cellBitsPerTileDim>( t1, t2, off_ijk,
191 halo_width );
192}
193
194//---------------------------------------------------------------------------//
195//----------------------------- Node/Cell -----------------------------------//
196//---------------------------------------------------------------------------//
197// Get the local index space of the owned nodes or cell centers (unit in cell)
198template <class Scalar, std::size_t NumSpaceDim>
199auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::indexSpaceImpl( Own,
200 Local ) const
201 -> IndexSpace<num_space_dim>
202{
203 // Compute the lower bound.
204 std::array<long, num_space_dim> min;
205 for ( std::size_t d = 0; d < num_space_dim; ++d )
206 min[d] = _halo_cell_width;
207
208 // Compute the upper bound.
209 std::array<long, num_space_dim> max;
210 for ( std::size_t d = 0; d < num_space_dim; ++d )
211 max[d] = min[d] + _global_grid->ownedNumCell( d );
212
213 return IndexSpace<num_space_dim>( min, max );
214}
215
216//---------------------------------------------------------------------------//
217// Get the local index space of the owned and ghosted nodes or cell centers
218// (unit in cell)
219template <class Scalar, std::size_t NumSpaceDim>
220auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::indexSpaceImpl( Ghost,
221 Local ) const
222 -> IndexSpace<num_space_dim>
223{
224 // Compute the size.
225 std::array<long, num_space_dim> size;
226 for ( std::size_t d = 0; d < num_space_dim; ++d )
227 {
228 size[d] = totalNumCell( d );
229 }
230
231 return IndexSpace<num_space_dim>( size );
232}
233
234//---------------------------------------------------------------------------//
235// Get the local index space of the owned nodes or cell centers (unit in cell)
236template <class Scalar, std::size_t NumSpaceDim>
237auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::indexSpaceImpl( Own,
238 Global ) const
239 -> IndexSpace<num_space_dim>
240{
241 // Compute the lower bound.
242 std::array<long, num_space_dim> min;
243 for ( std::size_t d = 0; d < num_space_dim; ++d )
244 min[d] = _global_grid->globalOffset( d );
245
246 // Compute the upper bound.
247 std::array<long, num_space_dim> max;
248 for ( std::size_t d = 0; d < num_space_dim; ++d )
249 max[d] = min[d] + _global_grid->ownedNumCell( d );
250
251 return IndexSpace<num_space_dim>( min, max );
252}
253
254//---------------------------------------------------------------------------//
255// Given a relative set of indices of a neighbor, get the set of global
256// tile indices we own that we share with that neighbor to use as ghosts.
257template <class Scalar, std::size_t NumSpaceDim>
258template <unsigned long long cellBitsPerTileDim>
259auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
260 Own, const std::array<int, num_space_dim>& off_ijk,
261 const int halo_width ) const
262 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
263{
264 auto owned_cell_space = indexSpaceImpl( Own(), Node(), Global() );
265 // Compute the lower bound.
266 std::array<long, num_space_dim> min;
267 for ( std::size_t d = 0; d < num_space_dim; ++d )
268 {
269 // Lower neighbor.
270 if ( -1 == off_ijk[d] )
271 min[d] = owned_cell_space.min( d ) >> cellBitsPerTileDim;
272
273 // Middle neighbor.
274 else if ( 0 == off_ijk[d] )
275 min[d] = owned_cell_space.min( d ) >> cellBitsPerTileDim;
276
277 // Upper neighbor.
278 else if ( 1 == off_ijk[d] )
279 min[d] = ( owned_cell_space.max( d ) - halo_width ) >>
280 cellBitsPerTileDim;
281 else
282 throw std::runtime_error(
283 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
284 "(SparseMesh): Neighbor offset must be 1, 0, or -1" );
285 }
286
287 // Compute the upper bound.
288 std::array<long, num_space_dim> max;
289 for ( std::size_t d = 0; d < num_space_dim; ++d )
290 {
291 // Lower neighbor.
292 if ( -1 == off_ijk[d] )
293 max[d] = ( owned_cell_space.min( d ) + halo_width ) >>
294 cellBitsPerTileDim;
295
296 // Middle neighbor.
297 else if ( 0 == off_ijk[d] )
298 max[d] = owned_cell_space.max( d ) >> cellBitsPerTileDim;
299
300 // Upper neighbor.
301 else if ( 1 == off_ijk[d] )
302 max[d] = owned_cell_space.max( d ) >> cellBitsPerTileDim;
303 else
304 throw std::runtime_error(
305 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
306 "(SparseMesh): Neighbor offset must be 1, 0, or -1" );
307 }
308
309 return TileIndexSpace<num_space_dim, cellBitsPerTileDim>( min, max );
310}
311
312//---------------------------------------------------------------------------//
313// Given a relative set of indices of a neighbor, get set of global tile
314// indices owned by that neighbor that are shared with us to use as ghosts.
315template <class Scalar, std::size_t NumSpaceDim>
316template <unsigned long long cellBitsPerTileDim>
317auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
318 Ghost, const std::array<int, num_space_dim>& off_ijk,
319 const int halo_width ) const
320 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
321{
322 // Get the owned local index space.
323 auto owned_cell_space = indexSpaceImpl( Own(), Node(), Global() );
324
325 // Compute the lower bound.
326 std::array<long, num_space_dim> min;
327 for ( std::size_t d = 0; d < num_space_dim; ++d )
328 {
329 // Lower neighbor.
330 if ( -1 == off_ijk[d] )
331 min[d] = ( owned_cell_space.min( d ) - halo_width ) >>
332 cellBitsPerTileDim;
333
334 // Middle neighbor
335 else if ( 0 == off_ijk[d] )
336 min[d] = owned_cell_space.min( d ) >> cellBitsPerTileDim;
337
338 // Upper neighbor.
339 else if ( 1 == off_ijk[d] )
340 min[d] = owned_cell_space.max( d ) >> cellBitsPerTileDim;
341 else
342 throw std::runtime_error(
343 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
344 "(SparseMesh): Neighbor offset must be 1, 0, or -1" );
345 }
346
347 // Compute the upper bound.
348 std::array<long, num_space_dim> max;
349 for ( std::size_t d = 0; d < num_space_dim; ++d )
350 {
351 // Lower neighbor.
352 if ( -1 == off_ijk[d] )
353 max[d] = owned_cell_space.min( d ) >> cellBitsPerTileDim;
354
355 // Middle neighbor
356 else if ( 0 == off_ijk[d] )
357 max[d] = owned_cell_space.max( d ) >> cellBitsPerTileDim;
358
359 // Upper neighbor.
360 else if ( 1 == off_ijk[d] )
361 max[d] = ( owned_cell_space.max( d ) + halo_width ) >>
362 cellBitsPerTileDim;
363 else
364 throw std::runtime_error(
365 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
366 "(SparseMesh): Neighbor offset must be 1, 0, or -1" );
367 }
368
369 return TileIndexSpace<num_space_dim, cellBitsPerTileDim>( min, max );
370}
371
372//---------------------------------------------------------------------------//
373//-------------------------------- Node -------------------------------------//
374//---------------------------------------------------------------------------//
375// Implementations for node indices
376template <class Scalar, std::size_t NumSpaceDim>
377template <class DecompositionTag, class IndexType>
379 DecompositionTag t1, Node, IndexType t3 ) const -> IndexSpace<num_space_dim>
380{
381 return indexSpaceImpl( t1, t3 );
382}
383
384// Implementation for node-related shared index space
385template <class Scalar, std::size_t NumSpaceDim>
386template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
387auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
388 DecompositionTag t1, Node, const std::array<int, num_space_dim>& off_ijk,
389 const int halo_width ) const
390 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
391{
392 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
393 halo_width );
394}
395
396//---------------------------------------------------------------------------//
397//-------------------------------- Cell -------------------------------------//
398//---------------------------------------------------------------------------//
399// Implementations for cell indices
400template <class Scalar, std::size_t NumSpaceDim>
401template <class DecompositionTag, class IndexType>
403 DecompositionTag t1, Cell, IndexType t3 ) const -> IndexSpace<num_space_dim>
404{
405 return indexSpaceImpl( t1, t3 );
406}
407
408// Implementation for cell-related shared index space
409template <class Scalar, std::size_t NumSpaceDim>
410template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
411auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
412 DecompositionTag t1, Cell, const std::array<int, num_space_dim>& off_ijk,
413 const int halo_width ) const
414 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
415{
416 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
417 halo_width );
418}
419
420//---------------------------------------------------------------------------//
421//-------------------------------- Face -------------------------------------//
422//---------------------------------------------------------------------------//
423// Implementations for Face<Dim::I> indices
424template <class Scalar, std::size_t NumSpaceDim>
425template <class DecompositionTag, class IndexType>
427 DecompositionTag t1, Face<Dim::I>, IndexType t3 ) const
428 -> IndexSpace<num_space_dim>
429{
430 std::runtime_error(
431 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
432 "(SparseMesh): Implementation doesn't support Face entities." );
433 return indexSpaceImpl( t1, t3 );
434}
435
436// Implementations for Face<Dim::J> indices
437template <class Scalar, std::size_t NumSpaceDim>
438template <class DecompositionTag, class IndexType>
440 DecompositionTag t1, Face<Dim::J>, IndexType t3 ) const
441 -> IndexSpace<num_space_dim>
442{
443 std::runtime_error(
444 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
445 "(SparseMesh): Implementation doesn't support Face entities." );
446 return indexSpaceImpl( t1, t3 );
447}
448
449// Implementations for Face<Dim::K> indices
450template <class Scalar, std::size_t NumSpaceDim>
451template <class DecompositionTag, class IndexType>
453 DecompositionTag t1, Face<Dim::K>, IndexType t3 ) const
454 -> IndexSpace<num_space_dim>
455{
456 std::runtime_error( "Cabana::Grid::Experimental::LocalGrid::indexSpace "
457 "(SparseMesh): Sparse grid implementation doesn't "
458 "support Face entities." );
459 return indexSpaceImpl( t1, t3 );
460}
461
462// Implementation for face<Dim::I>-related shared index space
463template <class Scalar, std::size_t NumSpaceDim>
464template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
465auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
466 DecompositionTag t1, Face<Dim::I>,
467 const std::array<int, num_space_dim>& off_ijk, const int halo_width ) const
468 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
469{
470 std::runtime_error(
471 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
472 "(SparseMesh): Implementation doesn't support Face entities." );
473 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
474 halo_width );
475}
476
477// Implementation for face<Dim::J>-related shared index space
478template <class Scalar, std::size_t NumSpaceDim>
479template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
480auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
481 DecompositionTag t1, Face<Dim::J>,
482 const std::array<int, num_space_dim>& off_ijk, const int halo_width ) const
483 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
484{
485 std::runtime_error(
486 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
487 "(SparseMesh): Implementation doesn't support Face entities." );
488 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
489 halo_width );
490}
491// Implementation for face<Dim::K>-related shared index space
492template <class Scalar, std::size_t NumSpaceDim>
493template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
494auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
495 DecompositionTag t1, Face<Dim::K>,
496 const std::array<int, num_space_dim>& off_ijk, const int halo_width ) const
497 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
498{
499 std::runtime_error(
500 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
501 "(SparseMesh): Implementation doesn't support Face entities." );
502 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
503 halo_width );
504}
505
506//---------------------------------------------------------------------------//
507//-------------------------------- Edge -------------------------------------//
508//---------------------------------------------------------------------------//
509// Implementations for edge<Dim::I> indices
510template <class Scalar, std::size_t NumSpaceDim>
511template <class DecompositionTag, class IndexType>
513 DecompositionTag t1, Edge<Dim::I>, IndexType t3 ) const
514 -> IndexSpace<num_space_dim>
515{
516 std::runtime_error(
517 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
518 "(SparseMesh): Implementation doesn't support Edge entities." );
519 return indexSpaceImpl( t1, t3 );
520}
521
522// Implementations for edge<Dim::J> indices
523template <class Scalar, std::size_t NumSpaceDim>
524template <class DecompositionTag, class IndexType>
526 DecompositionTag t1, Edge<Dim::J>, IndexType t3 ) const
527 -> IndexSpace<num_space_dim>
528{
529 std::runtime_error(
530 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
531 "(SparseMesh): Implementation doesn't support Edge entities." );
532 return indexSpaceImpl( t1, t3 );
533}
534
535// Implementations for edge<Dim::K> indices
536template <class Scalar, std::size_t NumSpaceDim>
537template <class DecompositionTag, class IndexType>
539 DecompositionTag t1, Edge<Dim::K>, IndexType t3 ) const
540 -> IndexSpace<num_space_dim>
541{
542 std::runtime_error(
543 "Cabana::Grid::Experimental::LocalGrid::indexSpace "
544 "(SparseMesh): Implementation doesn't support Edge entities." );
545 return indexSpaceImpl( t1, t3 );
546}
547
548// Implementation for Edge<Dim::I>-related shared index space
549template <class Scalar, std::size_t NumSpaceDim>
550template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
551auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
552 DecompositionTag t1, Edge<Dim::I>,
553 const std::array<int, num_space_dim>& off_ijk, const int halo_width ) const
554 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
555{
556 std::runtime_error(
557 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
558 "(SparseMesh): Implementation doesn't support Edge entities." );
559 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
560 halo_width );
561}
562
563// Implementation for Edge<Dim::I>-related shared index space
564template <class Scalar, std::size_t NumSpaceDim>
565template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
566auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
567 DecompositionTag t1, Edge<Dim::J>,
568 const std::array<int, num_space_dim>& off_ijk, const int halo_width ) const
569 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
570{
571 std::runtime_error(
572 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
573 "(SparseMesh): Implementation doesn't support Edge entities." );
574 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
575 halo_width );
576}
577
578// Implementation for Edge<Dim::I>-related shared index space
579template <class Scalar, std::size_t NumSpaceDim>
580template <unsigned long long cellBitsPerTileDim, class DecompositionTag>
581auto LocalGrid<SparseMesh<Scalar, NumSpaceDim>>::sharedTileIndexSpaceImpl(
582 DecompositionTag t1, Edge<Dim::K>,
583 const std::array<int, num_space_dim>& off_ijk, const int halo_width ) const
584 -> TileIndexSpace<num_space_dim, cellBitsPerTileDim>
585{
586 std::runtime_error(
587 "Cabana::Grid::Experimental::LocalGrid::sharedTileIndexSpace "
588 "(SparseMesh): Implementation doesn't support Edge entities." );
589 return sharedTileIndexSpaceImpl<cellBitsPerTileDim>( t1, off_ijk,
590 halo_width );
591}
593
594//---------------------------------------------------------------------------//
595} // namespace Experimental
596} // namespace Grid
597} // namespace Cabana
598
599#endif // end CABANA_GRID_LOCALGRID_SPARSE_IMPL_HPP
LocalGrid(const std::shared_ptr< GlobalGrid< mesh_type > > &global_grid, const int halo_cell_width, const long cell_num_per_tile_dim)
Constructor.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:25
int neighborRank(const std::array< int, num_space_dim > &off_ijk) const
Get the global index of a neighbor given neighbor rank offsets relative to this local grid.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:98
const GlobalGrid< mesh_type > & globalGrid() const
Get the global grid that owns the local grid.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:43
int totalNumCell(const int d) const
Get the total number of local cells per dimension (owned + halo).
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:76
int haloCellWidth() const
Get the number of cells in the halo.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:60
int haloTileWidth() const
Get the number of tiles in the halo.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:68
static constexpr std::size_t num_space_dim
Spatial dimension.
Definition Cabana_Grid_SparseLocalGrid.hpp:51
Definition Cabana_Grid_SparseLocalGrid.hpp:35
Global logical grid.
Definition Cabana_Grid_GlobalGrid.hpp:39
Structured index space.
Definition Cabana_Grid_IndexSpace.hpp:37
Local logical grid.
Definition Cabana_Grid_LocalGrid.hpp:39
Index space with tile as unit; _min and _max forms the tile range. Note this is for sparse grid only,...
Definition Cabana_Grid_SparseIndexSpace.hpp:1137
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
auto size(SliceType slice, typename std::enable_if< is_slice< SliceType >::value, int >::type *=0)
Check slice size (differs from Kokkos View).
Definition Cabana_Slice.hpp:1012