Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_LocalMesh.hpp
Go to the documentation of this file.
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
16#ifndef CABANA_GRID_LOCALMESH_HPP
17#define CABANA_GRID_LOCALMESH_HPP
18
20#include <Cabana_Grid_Types.hpp>
21
22#include <Cabana_Utils.hpp> // FIXME: remove after next release.
23
24#include <Kokkos_Core.hpp>
25
26namespace Cabana
27{
28namespace Grid
29{
30//---------------------------------------------------------------------------//
31// Forward declaration of local mesh.
32template <class MemorySpace, class MeshType>
34
35//---------------------------------------------------------------------------//
37template <class Scalar, class MemorySpace, std::size_t NumSpaceDim>
38class LocalMesh<MemorySpace, UniformMesh<Scalar, NumSpaceDim>>
39{
40 public:
43
45 using scalar_type = Scalar;
46
48 static constexpr std::size_t num_space_dim = NumSpaceDim;
49
51 using memory_space = MemorySpace;
52 static_assert( Kokkos::is_memory_space<MemorySpace>() );
53
55 using execution_space = typename memory_space::execution_space;
56
58 LocalMesh() = default;
59
62 {
63 const auto& global_grid = local_grid.globalGrid();
64 const auto& global_mesh = global_grid.globalMesh();
65
66 // Get the cell size.
67 for ( std::size_t d = 0; d < num_space_dim; ++d )
68 _cell_size[d] = global_mesh.cellSize( d );
69
70 // Compute face area.
71 if ( 3 == num_space_dim )
72 {
73 _face_area[Dim::I] = _cell_size[Dim::J] * _cell_size[Dim::K];
74 _face_area[Dim::J] = _cell_size[Dim::I] * _cell_size[Dim::K];
75 _face_area[Dim::K] = _cell_size[Dim::I] * _cell_size[Dim::J];
76 }
77 else if ( 2 == num_space_dim )
78 {
79 _face_area[Dim::I] = _cell_size[Dim::J];
80 _face_area[Dim::J] = _cell_size[Dim::I];
81 }
82
83 // Compute cell volume.
84 _cell_volume = 1.0;
85 for ( std::size_t d = 0; d < num_space_dim; ++d )
86 _cell_volume *= _cell_size[d];
87
88 // Compute the owned low corner
89 for ( std::size_t d = 0; d < num_space_dim; ++d )
90 _own_low_corner[d] = global_mesh.lowCorner( d ) +
91 _cell_size[d] * global_grid.globalOffset( d );
92
93 // Compute the owned high corner
94 for ( std::size_t d = 0; d < num_space_dim; ++d )
95 _own_high_corner[d] =
96 global_mesh.lowCorner( d ) +
97 _cell_size[d] * ( global_grid.globalOffset( d ) +
98 global_grid.ownedNumCell( d ) );
99
100 // Compute the ghosted low corner
101 for ( std::size_t d = 0; d < num_space_dim; ++d )
102 _ghost_low_corner[d] = lowCorner( Own(), d ) -
103 local_grid.haloCellWidth() * _cell_size[d];
104
105 // Compute the ghosted high corner
106 for ( std::size_t d = 0; d < num_space_dim; ++d )
107 _ghost_high_corner[d] = highCorner( Own(), d ) +
108 local_grid.haloCellWidth() * _cell_size[d];
109
110 // Periodicity
111 for ( std::size_t d = 0; d < num_space_dim; ++d )
112 _periodic[d] = global_grid.isPeriodic( d );
113
114 // Determine if a block is on the low or high boundaries.
115 for ( std::size_t d = 0; d < num_space_dim; ++d )
116 {
117 _boundary_lo[d] = global_grid.onLowBoundary( d );
118 _boundary_hi[d] = global_grid.onHighBoundary( d );
119 }
120 }
121
123 KOKKOS_INLINE_FUNCTION
124 bool isPeriodic( const int dim ) const { return _periodic[dim]; }
125
127 KOKKOS_INLINE_FUNCTION
128 bool onLowBoundary( const int dim ) const { return _boundary_lo[dim]; }
129
131 KOKKOS_INLINE_FUNCTION
132 bool onHighBoundary( const int dim ) const { return _boundary_hi[dim]; }
133
136 KOKKOS_INLINE_FUNCTION
137 Scalar lowCorner( Own, const int dim ) const
138 {
139 return _own_low_corner[dim];
140 }
141
145 KOKKOS_INLINE_FUNCTION
146 Scalar lowCorner( Ghost, const int dim ) const
147 {
148 return _ghost_low_corner[dim];
149 }
150
153 KOKKOS_INLINE_FUNCTION
154 Scalar highCorner( Own, const int dim ) const
155 {
156 return _own_high_corner[dim];
157 }
158
162 KOKKOS_INLINE_FUNCTION
163 Scalar highCorner( Ghost, const int dim ) const
164 {
165 return _ghost_high_corner[dim];
166 }
167
169 template <typename Decomposition>
170 KOKKOS_FUNCTION Scalar extent( Decomposition d, const int dim ) const
171 {
172 return highCorner( d, dim ) - lowCorner( d, dim );
173 }
174
179 template <class Integer>
180 KOKKOS_INLINE_FUNCTION void coordinates( Cell,
181 const Integer index[num_space_dim],
182 Scalar x[num_space_dim] ) const
183 {
184 for ( std::size_t d = 0; d < num_space_dim; ++d )
185 x[d] = _ghost_low_corner[d] +
186 ( Scalar( index[d] ) + Scalar( 0.5 ) ) * _cell_size[d];
187 }
188
193 template <class Integer>
194 KOKKOS_INLINE_FUNCTION void coordinates( Node,
195 const Integer index[num_space_dim],
196 Scalar x[num_space_dim] ) const
197 {
198 for ( std::size_t d = 0; d < num_space_dim; ++d )
199 x[d] = _ghost_low_corner[d] + Scalar( index[d] ) * _cell_size[d];
200 }
201
206 template <int Dir, class Integer>
207 KOKKOS_INLINE_FUNCTION void coordinates( Face<Dir>,
208 const Integer index[num_space_dim],
209 Scalar x[num_space_dim] ) const
210 {
211 static_assert( Dir < num_space_dim, "Face dimension out of bounds" );
212 for ( std::size_t d = 0; d < num_space_dim; ++d )
213 if ( Dir == d )
214 x[d] =
215 _ghost_low_corner[d] + Scalar( index[d] ) * _cell_size[d];
216 else
217 x[d] = _ghost_low_corner[d] +
218 ( Scalar( index[d] ) + Scalar( 0.5 ) ) * _cell_size[d];
219 }
220
225 template <int Dir, class Integer, std::size_t NSD = num_space_dim>
226 KOKKOS_INLINE_FUNCTION std::enable_if_t<3 == NSD, void>
227 coordinates( Edge<Dir>, const Integer index[3], Scalar x[3] ) const
228 {
229 for ( std::size_t d = 0; d < 3; ++d )
230 if ( Dir == d )
231 x[d] = _ghost_low_corner[d] +
232 ( Scalar( index[d] ) + Scalar( 0.5 ) ) * _cell_size[d];
233 else
234 x[d] =
235 _ghost_low_corner[d] + Scalar( index[d] ) * _cell_size[d];
236 }
237
242 template <class Integer>
243 KOKKOS_INLINE_FUNCTION Scalar measure( Node,
244 const Integer[num_space_dim] ) const
245 {
246 return 0.0;
247 }
248
253 template <int Dir, class Integer, std::size_t NSD = num_space_dim>
254 KOKKOS_INLINE_FUNCTION std::enable_if_t<3 == NSD, Scalar>
255 measure( Edge<Dir>, const Integer[3] ) const
256 {
257 return _cell_size[Dir];
258 }
259
264 template <int Dir, class Integer>
265 KOKKOS_INLINE_FUNCTION Scalar measure( Face<Dir>,
266 const Integer[num_space_dim] ) const
267 {
268 static_assert( Dir < num_space_dim, "Face dimension out of bounds" );
269 return _face_area[Dir];
270 }
271
276 template <class Integer>
277 KOKKOS_INLINE_FUNCTION Scalar measure( Cell,
278 const Integer[num_space_dim] ) const
279 {
280 return _cell_volume;
281 }
282
283 private:
284 Kokkos::Array<Scalar, num_space_dim> _cell_size;
285 Kokkos::Array<Scalar, num_space_dim> _face_area;
286 Scalar _cell_volume;
287 Kokkos::Array<Scalar, num_space_dim> _own_low_corner;
288 Kokkos::Array<Scalar, num_space_dim> _own_high_corner;
289 Kokkos::Array<Scalar, num_space_dim> _ghost_low_corner;
290 Kokkos::Array<Scalar, num_space_dim> _ghost_high_corner;
291 Kokkos::Array<bool, num_space_dim> _periodic;
292 Kokkos::Array<bool, num_space_dim> _boundary_lo;
293 Kokkos::Array<bool, num_space_dim> _boundary_hi;
294};
295
296//---------------------------------------------------------------------------//
298template <class Scalar, class MemorySpace, std::size_t NumSpaceDim>
299class LocalMesh<MemorySpace, NonUniformMesh<Scalar, NumSpaceDim>>
300{
301 public:
304
306 using scalar_type = Scalar;
307
309 static constexpr std::size_t num_space_dim = NumSpaceDim;
310
312 using memory_space = MemorySpace;
313 static_assert( Kokkos::is_memory_space<MemorySpace>() );
314
316 using execution_space = typename memory_space::execution_space;
317
321 {
322 const auto& global_grid = local_grid.globalGrid();
323 const auto& global_mesh = global_grid.globalMesh();
324
325 // Compute the owned low corner.
326 for ( std::size_t d = 0; d < num_space_dim; ++d )
327 _own_low_corner[d] =
328 global_mesh.nonUniformEdge( d )[global_grid.globalOffset( d )];
329
330 // Compute the owned high corner
331 for ( std::size_t d = 0; d < num_space_dim; ++d )
332 _own_high_corner[d] =
333 global_mesh.nonUniformEdge( d )[global_grid.globalOffset( d ) +
334 global_grid.ownedNumCell( d )];
335
336 // Compute the ghosted low corner
337 for ( std::size_t d = 0; d < num_space_dim; ++d )
338 {
339 // Interior domain case.
340 if ( !global_grid.onLowBoundary( d ) )
341 {
342 _ghost_low_corner[d] = global_mesh.nonUniformEdge(
343 d )[global_grid.globalOffset( d ) -
344 local_grid.haloCellWidth()];
345 }
346
347 // Periodic boundary. Use cells on other side of boundary to
348 // generate geometry.
349 else if ( global_grid.isPeriodic( d ) )
350 {
351 int nedge = global_mesh.nonUniformEdge( d ).size();
352 _ghost_low_corner[d] =
353 global_mesh.nonUniformEdge( d ).front() -
354 ( global_mesh.nonUniformEdge( d ).back() -
355 global_mesh.nonUniformEdge(
356 d )[nedge - local_grid.haloCellWidth() - 1] );
357 }
358
359 // In the non-periodic boundary case we extrapolate halo cells to
360 // have the same width as the boundary cell.
361 else
362 {
363 Scalar dx = global_mesh.nonUniformEdge( d )[1] -
364 global_mesh.nonUniformEdge( d )[0];
365 _ghost_low_corner[d] = global_mesh.nonUniformEdge( d ).front() -
366 dx * local_grid.haloCellWidth();
367 }
368 }
369
370 // Compute the ghosted high corner
371 for ( std::size_t d = 0; d < num_space_dim; ++d )
372 {
373 // Interior domain case.
374 if ( !global_grid.onHighBoundary( d ) )
375 {
376 _ghost_high_corner[d] = global_mesh.nonUniformEdge(
377 d )[global_grid.globalOffset( d ) +
378 global_grid.ownedNumCell( d ) +
379 local_grid.haloCellWidth()];
380 }
381
382 // Periodic boundary. Use cells on other side of boundary to
383 // generate geometry.
384 else if ( global_grid.isPeriodic( d ) )
385 {
386 _ghost_high_corner[d] =
387 global_mesh.nonUniformEdge( d ).back() +
388 ( global_mesh.nonUniformEdge(
389 d )[local_grid.haloCellWidth()] -
390 global_mesh.nonUniformEdge( d ).front() );
391 }
392
393 // In the non-periodic boundary case we extrapolate halo cells to
394 // have the same width as the boundary cell.
395 else
396 {
397 int nedge = global_mesh.nonUniformEdge( d ).size();
398 Scalar dx = global_mesh.nonUniformEdge( d )[nedge - 1] -
399 global_mesh.nonUniformEdge( d )[nedge - 2];
400 _ghost_high_corner[d] = global_mesh.nonUniformEdge( d ).back() +
401 dx * local_grid.haloCellWidth();
402 }
403 }
404
405 // Get the node index spaces.
406 auto owned_nodes_local =
407 local_grid.indexSpace( Own(), Node(), Local() );
408 auto ghosted_nodes_local =
409 local_grid.indexSpace( Ghost(), Node(), Local() );
410 auto owned_nodes_global =
411 local_grid.indexSpace( Own(), Node(), Global() );
412 for ( std::size_t d = 0; d < num_space_dim; ++d )
413 {
414 // Allocate edges on the device for this dimension.
415 const auto& global_edge = global_mesh.nonUniformEdge( d );
416 int nedge = ghosted_nodes_local.extent( d );
417 int nedge_global = global_edge.size();
418 _local_edges[d] = Kokkos::View<Scalar*, MemorySpace>(
419 Kokkos::ViewAllocateWithoutInitializing( "local_edges" ),
420 nedge );
421
422 // Compute edges on the host.
423 auto edge_mirror = Kokkos::create_mirror_view( Kokkos::HostSpace(),
424 _local_edges[d] );
425
426 // Compute the owned edges.
427 for ( int n = owned_nodes_local.min( d );
428 n < owned_nodes_local.max( d ); ++n )
429 {
430 edge_mirror( n ) = global_edge[owned_nodes_global.min( d ) + n -
431 owned_nodes_local.min( d )];
432 }
433
434 // Compute the lower boundary edges.
435 if ( !global_grid.onLowBoundary( d ) )
436 {
437 // Interior block gets edges from neighbors.
438 for ( int n = 0; n < owned_nodes_local.min( d ); ++n )
439 {
440 edge_mirror( n ) =
441 global_edge[owned_nodes_global.min( d ) + n -
442 owned_nodes_local.min( d )];
443 }
444 }
445 else if ( global_grid.isPeriodic( d ) )
446 {
447 // Periodic boundary block gets edges from neighbor on
448 // opposite side of boundary.
449 for ( int n = 0; n < owned_nodes_local.min( d ); ++n )
450 {
451 edge_mirror( n ) =
452 global_edge.front() - global_edge.back() +
453 global_edge[global_edge.size() - 1 -
454 local_grid.haloCellWidth() + n];
455 }
456 }
457 else
458 {
459 // Non-periodic boundary block extrapolates edges using
460 // boundary cell width.
461 for ( int n = 0; n < owned_nodes_local.min( d ); ++n )
462 {
463 Scalar dx = global_edge[1] - global_edge[0];
464 edge_mirror( n ) = global_edge.front() -
465 ( owned_nodes_local.min( d ) - n ) * dx;
466 }
467 }
468
469 // Compute the upper boundary edges.
470 if ( !global_grid.onHighBoundary( d ) )
471 {
472 // Interior block gets edges from neighbors.
473 for ( int n = owned_nodes_local.max( d );
474 n < ghosted_nodes_local.max( d ); ++n )
475 {
476 edge_mirror( n ) =
477 global_edge[owned_nodes_global.min( d ) + n -
478 owned_nodes_local.min( d )];
479 }
480 }
481 else if ( global_grid.isPeriodic( d ) )
482 {
483 // Periodic boundary block gets edges from neighbor on
484 // opposite side of boundary.
485 for ( int n = 0; n < ghosted_nodes_local.max( d ) -
486 owned_nodes_local.max( d );
487 ++n )
488 {
489 edge_mirror( owned_nodes_local.max( d ) + n ) =
490 global_edge.back() + global_edge[n] -
491 global_edge.front();
492 }
493 }
494 else
495 {
496 // Non-periodic boundary block extrapolates edges using
497 // boundary cell width.
498 for ( int n = owned_nodes_local.max( d );
499 n < ghosted_nodes_local.max( d ); ++n )
500 {
501 Scalar dx = global_edge[nedge_global - 1] -
502 global_edge[nedge_global - 2];
503 edge_mirror( n ) =
504 global_edge.back() +
505 ( n - owned_nodes_local.max( d ) + 1 ) * dx;
506 }
507 }
508
509 // Copy edges to the device.
510 Kokkos::deep_copy( _local_edges[d], edge_mirror );
511 }
512
513 // Periodicity
514 for ( std::size_t d = 0; d < num_space_dim; ++d )
515 _periodic[d] = global_grid.isPeriodic( d );
516
517 // Determine if a block is on the low or high boundaries.
518 for ( std::size_t d = 0; d < num_space_dim; ++d )
519 {
520 _boundary_lo[d] = global_grid.onLowBoundary( d );
521 _boundary_hi[d] = global_grid.onHighBoundary( d );
522 }
523 }
524
527 KOKKOS_INLINE_FUNCTION
528 bool isPeriodic( const int dim ) const { return _periodic[dim]; }
529
532 KOKKOS_INLINE_FUNCTION
533 bool onLowBoundary( const int dim ) const { return _boundary_lo[dim]; }
534
537 KOKKOS_INLINE_FUNCTION
538 bool onHighBoundary( const int dim ) const { return _boundary_hi[dim]; }
539
542 KOKKOS_INLINE_FUNCTION
543 Scalar lowCorner( Own, const int dim ) const
544 {
545 return _own_low_corner[dim];
546 }
547
551 KOKKOS_INLINE_FUNCTION
552 Scalar lowCorner( Ghost, const int dim ) const
553 {
554 return _ghost_low_corner[dim];
555 }
556
559 KOKKOS_INLINE_FUNCTION
560 Scalar highCorner( Own, const int dim ) const
561 {
562 return _own_high_corner[dim];
563 }
564
568 KOKKOS_INLINE_FUNCTION
569 Scalar highCorner( Ghost, const int dim ) const
570 {
571 return _ghost_high_corner[dim];
572 }
573
577 template <typename Decomposition>
578 KOKKOS_FUNCTION Scalar extent( Decomposition d, const int dim ) const
579 {
580 return highCorner( d, dim ) - lowCorner( d, dim );
581 }
582
590 template <class Integer>
591 KOKKOS_INLINE_FUNCTION void coordinates( Cell,
592 const Integer index[num_space_dim],
593 Scalar x[num_space_dim] ) const
594 {
595 for ( std::size_t d = 0; d < num_space_dim; ++d )
596 x[d] = ( _local_edges[d]( index[d] + 1 ) +
597 _local_edges[d]( index[d] ) ) /
598 Scalar( 2.0 );
599 }
600
607 template <class Integer>
608 KOKKOS_INLINE_FUNCTION void coordinates( Node,
609 const Integer index[num_space_dim],
610 Scalar x[num_space_dim] ) const
611 {
612 for ( std::size_t d = 0; d < num_space_dim; ++d )
613 x[d] = _local_edges[d]( index[d] );
614 }
615
622 template <int Dir, class Integer>
623 KOKKOS_INLINE_FUNCTION void coordinates( Face<Dir>,
624 const Integer index[num_space_dim],
625 Scalar x[num_space_dim] ) const
626 {
627 static_assert( Dir < num_space_dim, "Face dimension out of bounds" );
628
629 for ( std::size_t d = 0; d < num_space_dim; ++d )
630 if ( Dir == d )
631 x[d] = _local_edges[d]( index[d] );
632 else
633 x[d] = ( _local_edges[d]( index[d] + 1 ) +
634 _local_edges[d]( index[d] ) ) /
635 Scalar( 2.0 );
636 }
637
644 template <int Dir, class Integer, std::size_t NSD = num_space_dim>
645 KOKKOS_INLINE_FUNCTION std::enable_if_t<3 == NSD, void>
646 coordinates( Edge<Dir>, const Integer index[3], Scalar x[3] ) const
647 {
648 for ( std::size_t d = 0; d < 3; ++d )
649 if ( Dir == d )
650 x[d] = ( _local_edges[d]( index[d] + 1 ) +
651 _local_edges[d]( index[d] ) ) /
652 Scalar( 2.0 );
653 else
654 x[d] = _local_edges[d]( index[d] );
655 }
656
660 template <class Integer>
661 KOKKOS_INLINE_FUNCTION Scalar measure( Node,
662 const Integer[num_space_dim] ) const
663 {
664 return 0.0;
665 }
666
672 template <int Dir, class Integer, std::size_t NSD = num_space_dim>
673 KOKKOS_INLINE_FUNCTION std::enable_if_t<3 == NSD, Scalar>
674 measure( Edge<Dir>, const Integer index[3] ) const
675 {
676 return _local_edges[Dir][index[Dir] + 1] -
677 _local_edges[Dir][index[Dir]];
678 }
679
685 template <class Integer, std::size_t NSD = num_space_dim>
686 KOKKOS_INLINE_FUNCTION std::enable_if_t<3 == NSD, Scalar>
687 measure( Face<Dim::I>, const Integer index[3] ) const
688 {
689 return measure( Edge<Dim::J>(), index ) *
690 measure( Edge<Dim::K>(), index );
691 }
692
698 template <class Integer, std::size_t NSD = num_space_dim>
699 KOKKOS_INLINE_FUNCTION std::enable_if_t<3 == NSD, Scalar>
700 measure( Face<Dim::J>, const Integer index[3] ) const
701 {
702 return measure( Edge<Dim::I>(), index ) *
703 measure( Edge<Dim::K>(), index );
704 }
705
711 template <class Integer, std::size_t NSD = num_space_dim>
712 KOKKOS_INLINE_FUNCTION std::enable_if_t<3 == NSD, Scalar>
713 measure( Face<Dim::K>, const Integer index[3] ) const
714 {
715 return measure( Edge<Dim::I>(), index ) *
716 measure( Edge<Dim::J>(), index );
717 }
718
724 template <class Integer, std::size_t NSD = num_space_dim>
725 KOKKOS_INLINE_FUNCTION std::enable_if_t<2 == NSD, Scalar>
726 measure( Face<Dim::I>, const Integer index[2] ) const
727 {
728 return _local_edges[Dim::J][index[Dim::J] + 1] -
729 _local_edges[Dim::J][index[Dim::J]];
730 }
731
737 template <class Integer, std::size_t NSD = num_space_dim>
738 KOKKOS_INLINE_FUNCTION std::enable_if_t<2 == NSD, Scalar>
739 measure( Face<Dim::J>, const Integer index[2] ) const
740 {
741 return _local_edges[Dim::I][index[Dim::I] + 1] -
742 _local_edges[Dim::I][index[Dim::I]];
743 }
744
750 template <class Integer>
751 KOKKOS_INLINE_FUNCTION Scalar
752 measure( Cell, const Integer index[num_space_dim] ) const
753 {
754 Scalar m = 1.0;
755 for ( std::size_t d = 0; d < num_space_dim; ++d )
756 m *= _local_edges[d][index[d] + 1] - _local_edges[d][index[d]];
757 return m;
758 }
759
760 private:
761 Kokkos::Array<Scalar, num_space_dim> _own_low_corner;
762 Kokkos::Array<Scalar, num_space_dim> _own_high_corner;
763 Kokkos::Array<Scalar, num_space_dim> _ghost_low_corner;
764 Kokkos::Array<Scalar, num_space_dim> _ghost_high_corner;
765 Kokkos::Array<Kokkos::View<Scalar*, MemorySpace>, num_space_dim>
766 _local_edges;
767 Kokkos::Array<bool, num_space_dim> _periodic;
768 Kokkos::Array<bool, num_space_dim> _boundary_lo;
769 Kokkos::Array<bool, num_space_dim> _boundary_hi;
770};
771
772//---------------------------------------------------------------------------//
777template <class MemorySpace, class MeshType>
778LocalMesh<MemorySpace, MeshType>
780{
781 return LocalMesh<MemorySpace, MeshType>( local_grid );
782}
783
784//---------------------------------------------------------------------------//
785
786} // namespace Grid
787} // namespace Cabana
788
789#endif // end CABANA_GRID_LOCALMESH_HPP
LocalMesh< MemorySpace, MeshType > createLocalMesh(const LocalGrid< MeshType > &local_grid)
Creation function for local mesh.
Definition Cabana_Grid_LocalMesh.hpp:779
Grid type tags.
Cabana utilities.
Local logical grid.
Definition Cabana_Grid_LocalGrid.hpp:39
KOKKOS_INLINE_FUNCTION bool onHighBoundary(const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:538
typename memory_space::execution_space execution_space
Default execution space.
Definition Cabana_Grid_LocalMesh.hpp:316
MemorySpace memory_space
Kokkos memory space.
Definition Cabana_Grid_LocalMesh.hpp:312
KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==NSD, Scalar > measure(Edge< Dir >, const Integer index[3]) const
Definition Cabana_Grid_LocalMesh.hpp:674
Scalar scalar_type
Scalar type for geometric operations.
Definition Cabana_Grid_LocalMesh.hpp:306
KOKKOS_INLINE_FUNCTION void coordinates(Node, const Integer index[num_space_dim], Scalar x[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:608
KOKKOS_INLINE_FUNCTION Scalar lowCorner(Own, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:543
KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==NSD, Scalar > measure(Face< Dim::K >, const Integer index[3]) const
Definition Cabana_Grid_LocalMesh.hpp:713
LocalMesh(const LocalGrid< NonUniformMesh< Scalar, num_space_dim > > &local_grid)
Constructor.
Definition Cabana_Grid_LocalMesh.hpp:319
KOKKOS_INLINE_FUNCTION Scalar measure(Node, const Integer[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:661
KOKKOS_INLINE_FUNCTION std::enable_if_t< 2==NSD, Scalar > measure(Face< Dim::J >, const Integer index[2]) const
Definition Cabana_Grid_LocalMesh.hpp:739
KOKKOS_INLINE_FUNCTION void coordinates(Cell, const Integer index[num_space_dim], Scalar x[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:591
NonUniformMesh< Scalar, NumSpaceDim > mesh_type
Mesh type.
Definition Cabana_Grid_LocalMesh.hpp:303
KOKKOS_FUNCTION Scalar extent(Decomposition d, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:578
KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==NSD, void > coordinates(Edge< Dir >, const Integer index[3], Scalar x[3]) const
Definition Cabana_Grid_LocalMesh.hpp:646
static constexpr std::size_t num_space_dim
Spatial dimension.
Definition Cabana_Grid_LocalMesh.hpp:309
KOKKOS_INLINE_FUNCTION Scalar highCorner(Ghost, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:569
KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==NSD, Scalar > measure(Face< Dim::J >, const Integer index[3]) const
Definition Cabana_Grid_LocalMesh.hpp:700
KOKKOS_INLINE_FUNCTION Scalar measure(Cell, const Integer index[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:752
KOKKOS_INLINE_FUNCTION bool onLowBoundary(const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:533
KOKKOS_INLINE_FUNCTION void coordinates(Face< Dir >, const Integer index[num_space_dim], Scalar x[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:623
KOKKOS_INLINE_FUNCTION Scalar highCorner(Own, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:560
KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==NSD, Scalar > measure(Face< Dim::I >, const Integer index[3]) const
Definition Cabana_Grid_LocalMesh.hpp:687
KOKKOS_INLINE_FUNCTION std::enable_if_t< 2==NSD, Scalar > measure(Face< Dim::I >, const Integer index[2]) const
Definition Cabana_Grid_LocalMesh.hpp:726
KOKKOS_INLINE_FUNCTION Scalar lowCorner(Ghost, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:552
KOKKOS_INLINE_FUNCTION bool isPeriodic(const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:528
UniformMesh< Scalar, NumSpaceDim > mesh_type
Mesh type.
Definition Cabana_Grid_LocalMesh.hpp:42
Scalar scalar_type
Scalar type for geometric operations.
Definition Cabana_Grid_LocalMesh.hpp:45
KOKKOS_INLINE_FUNCTION Scalar measure(Cell, const Integer[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:277
MemorySpace memory_space
Kokkos memory space.
Definition Cabana_Grid_LocalMesh.hpp:51
KOKKOS_INLINE_FUNCTION Scalar measure(Face< Dir >, const Integer[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:265
KOKKOS_INLINE_FUNCTION Scalar measure(Node, const Integer[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:243
KOKKOS_INLINE_FUNCTION Scalar highCorner(Own, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:154
KOKKOS_INLINE_FUNCTION void coordinates(Node, const Integer index[num_space_dim], Scalar x[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:194
KOKKOS_INLINE_FUNCTION Scalar lowCorner(Ghost, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:146
KOKKOS_INLINE_FUNCTION bool onLowBoundary(const int dim) const
Determine if this block is on a low boundary in the given dimension.
Definition Cabana_Grid_LocalMesh.hpp:128
KOKKOS_INLINE_FUNCTION void coordinates(Cell, const Integer index[num_space_dim], Scalar x[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:180
KOKKOS_INLINE_FUNCTION Scalar lowCorner(Own, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:137
KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==NSD, Scalar > measure(Edge< Dir >, const Integer[3]) const
Definition Cabana_Grid_LocalMesh.hpp:255
KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==NSD, void > coordinates(Edge< Dir >, const Integer index[3], Scalar x[3]) const
Definition Cabana_Grid_LocalMesh.hpp:227
typename memory_space::execution_space execution_space
Default execution space.
Definition Cabana_Grid_LocalMesh.hpp:55
KOKKOS_FUNCTION Scalar extent(Decomposition d, const int dim) const
Get the extent of a given dimension.
Definition Cabana_Grid_LocalMesh.hpp:170
KOKKOS_INLINE_FUNCTION bool isPeriodic(const int dim) const
Determine if the mesh is periodic in the given dimension.
Definition Cabana_Grid_LocalMesh.hpp:124
static constexpr std::size_t num_space_dim
Spatial dimension.
Definition Cabana_Grid_LocalMesh.hpp:48
KOKKOS_INLINE_FUNCTION void coordinates(Face< Dir >, const Integer index[num_space_dim], Scalar x[num_space_dim]) const
Definition Cabana_Grid_LocalMesh.hpp:207
KOKKOS_INLINE_FUNCTION Scalar highCorner(Ghost, const int dim) const
Definition Cabana_Grid_LocalMesh.hpp:163
LocalMesh(const LocalGrid< UniformMesh< Scalar, num_space_dim > > &local_grid)
Constructor.
Definition Cabana_Grid_LocalMesh.hpp:61
KOKKOS_INLINE_FUNCTION bool onHighBoundary(const int dim) const
Determine if this block is on a high boundary in the given dimension.
Definition Cabana_Grid_LocalMesh.hpp:132
Definition Cabana_Grid_LocalMesh.hpp:33
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
Mesh cell tag.
Definition Cabana_Grid_Types.hpp:49
Mesh edge tag.
Definition Cabana_Grid_Types.hpp:95
Mesh face tag.
Definition Cabana_Grid_Types.hpp:64
Ghosted decomposition tag.
Definition Cabana_Grid_Types.hpp:197
Global index tag.
Definition Cabana_Grid_Types.hpp:215
Local index tag.
Definition Cabana_Grid_Types.hpp:208
Mesh node tag.
Definition Cabana_Grid_Types.hpp:56
Non-uniform mesh tag.
Definition Cabana_Grid_Types.hpp:240
Owned decomposition tag.
Definition Cabana_Grid_Types.hpp:190
Uniform mesh tag.
Definition Cabana_Grid_Types.hpp:227