11template <
typename ScalarType >
14 Kokkos::deep_copy( x, value );
17template <
typename ScalarType >
20 Kokkos::deep_copy( x, value );
23template <
typename ScalarType >
26 Kokkos::deep_copy( x, value );
29template <
typename ScalarType,
int VecDim >
32 for (
int d = 0; d < VecDim; ++d )
36template <
typename ScalarType >
39 Kokkos::deep_copy( x, value );
42template <
typename ScalarType >
46 "scale (Grid3DDataScalar)",
47 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
48 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) { x( local_subdomain, i, j, k ) *= value; } );
53template <
typename ScalarType, util::FlagLike FlagType >
56 const ScalarType& value,
58 const FlagType mask_value )
62 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { dst.extent( 0 ), dst.extent( 1 ), dst.extent( 2 ), dst.extent( 3 ) } ),
63 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
64 const ScalarType mask_val =
util::has_flag( mask_grid( local_subdomain, i, j, k ), mask_value ) ? 1.0 : 0.0;
65 dst( local_subdomain, i, j, k ) = mask_val * value + ( 1.0 - mask_val ) * dst( local_subdomain, i, j, k );
71template <
typename ScalarType, util::FlagLike FlagType >
76 const FlagType mask_value )
80 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { dst.extent( 0 ), dst.extent( 1 ), dst.extent( 2 ), dst.extent( 3 ) } ),
81 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
82 const ScalarType mask_val =
util::has_flag( mask_grid( local_subdomain, i, j, k ), mask_value ) ? 1.0 : 0.0;
83 dst( local_subdomain, i, j, k ) =
84 mask_val * src( local_subdomain, i, j, k ) + ( 1.0 - mask_val ) * dst( local_subdomain, i, j, k );
90template <
typename ScalarType,
int VecDim, util::FlagLike FlagType >
93 const ScalarType& value,
95 const FlagType mask_value )
97 for (
int d = 0; d < VecDim; ++d )
101template <
typename ScalarType,
int VecDim, util::FlagLike FlagType >
106 const FlagType mask_value )
108 for (
int d = 0; d < VecDim; ++d )
112template <
typename ScalarType,
int VecDim, util::FlagLike FlagType >
115 const ScalarType& value,
117 const FlagType mask_value,
118 const int vector_component )
120 Kokkos::parallel_for(
123 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
124 const ScalarType mask_val =
util::has_flag( mask_grid( local_subdomain, i, j, k ), mask_value ) ? 1.0 : 0.0;
125 dst( local_subdomain, i, j, k, vector_component ) =
126 mask_val * value + ( 1.0 - mask_val ) * dst( local_subdomain, i, j, k, vector_component );
132template <
typename ScalarType >
139 Kokkos::parallel_for(
140 "lincomb 1 arg (Grid4DDataScalar)",
141 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { y.extent( 0 ), y.extent( 1 ), y.extent( 2 ), y.extent( 3 ) } ),
142 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
143 y( local_subdomain, i, j, k ) = c_0 + c_1 * x_1( local_subdomain, i, j, k );
149template <
typename ScalarType >
158 Kokkos::parallel_for(
159 "lincomb 2 args (Grid4DDataScalar)",
160 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { y.extent( 0 ), y.extent( 1 ), y.extent( 2 ), y.extent( 3 ) } ),
161 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
162 y( local_subdomain, i, j, k ) =
163 c_0 + c_1 * x_1( local_subdomain, i, j, k ) + c_2 * x_2( local_subdomain, i, j, k );
169template <
typename ScalarType >
180 Kokkos::parallel_for(
181 "lincomb 3 args (Grid4DDataScalar)",
182 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { y.extent( 0 ), y.extent( 1 ), y.extent( 2 ), y.extent( 3 ) } ),
183 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
184 y( local_subdomain, i, j, k ) = c_0 + c_1 * x_1( local_subdomain, i, j, k ) +
185 c_2 * x_2( local_subdomain, i, j, k ) +
186 c_3 * x_3( local_subdomain, i, j, k );
192template <
typename ScalarType,
int VecDim >
199 for (
int d = 0; d < VecDim; ++d )
203template <
typename ScalarType,
int VecDim >
212 for (
int d = 0; d < VecDim; ++d )
216template <
typename ScalarType,
int VecDim >
227 for (
int d = 0; d < VecDim; ++d )
231template <
typename ScalarType >
234 Kokkos::parallel_for(
236 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { y.extent( 0 ), y.extent( 1 ), y.extent( 2 ), y.extent( 3 ) } ),
237 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
238 y( local_subdomain, i, j, k ) = 1.0 / y( local_subdomain, i, j, k );
244template <
typename ScalarType,
int VecDim >
247 for (
int d = 0; d < VecDim; ++d )
251template <
typename ScalarType >
256 Kokkos::parallel_for(
257 "mult_elementwise_inplace",
258 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { y.extent( 0 ), y.extent( 1 ), y.extent( 2 ), y.extent( 3 ) } ),
259 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
260 y( local_subdomain, i, j, k ) *= x( local_subdomain, i, j, k );
266template <
typename ScalarType,
int VecDim >
271 for (
int d = 0; d < VecDim; ++d )
275template <
typename ScalarType >
278 ScalarType min_val = 0.0;
279 Kokkos::parallel_reduce(
281 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
282 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_min ) {
283 ScalarType val = x( local_subdomain, i, j, k );
284 local_min = Kokkos::min( local_min, val );
286 Kokkos::Min< ScalarType >( min_val ) );
290 MPI_Allreduce( MPI_IN_PLACE, &min_val, 1, mpi::mpi_datatype< ScalarType >(), MPI_MIN, comm );
295template <
typename ScalarType >
298 ScalarType min_mag = 0.0;
299 Kokkos::parallel_reduce(
301 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
302 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_min ) {
303 ScalarType val = Kokkos::abs( x( local_subdomain, i, j, k ) );
304 local_min = Kokkos::min( local_min, val );
306 Kokkos::Min< ScalarType >( min_mag ) );
310 MPI_Allreduce( MPI_IN_PLACE, &min_mag, 1, mpi::mpi_datatype< ScalarType >(), MPI_MIN, comm );
315template <
typename ScalarType >
318 ScalarType max_mag = 0.0;
319 Kokkos::parallel_reduce(
321 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
322 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_max ) {
323 ScalarType val = Kokkos::abs( x( local_subdomain, i, j, k ) );
324 local_max = Kokkos::max( local_max, val );
326 Kokkos::Max< ScalarType >( max_mag ) );
330 MPI_Allreduce( MPI_IN_PLACE, &max_mag, 1, mpi::mpi_datatype< ScalarType >(), MPI_MAX, comm );
335template <
typename ScalarType,
int VecDim >
338 ScalarType max_mag = 0.0;
339 for (
int d = 0; d < VecDim; ++d )
344 max_mag = std::max( max_mag, comp_max );
349template <
typename ScalarType, util::FlagLike FlagType >
353 const FlagType& mask_value,
354 MPI_Comm comm = MPI_COMM_WORLD )
356 ScalarType max_mag = 0.0;
357 Kokkos::parallel_reduce(
359 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
360 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_max ) {
361 if (
util::has_flag( mask( local_subdomain, i, j, k ), mask_value ) )
363 ScalarType val = Kokkos::abs( x( local_subdomain, i, j, k ) );
364 local_max = Kokkos::max( local_max, val );
367 Kokkos::Max< ScalarType >( max_mag ) );
371 MPI_Allreduce( MPI_IN_PLACE, &max_mag, 1, mpi::mpi_datatype< ScalarType >(), MPI_MAX, comm );
376template <
typename ScalarType >
381 MPI_Comm comm = MPI_COMM_WORLD )
383 ScalarType max_mag = 0.0;
384 Kokkos::parallel_reduce(
386 Kokkos::MDRangePolicy(
387 { start( 0 ), start( 1 ), start( 2 ), start( 3 ) },
388 { end_excl( 0 ), end_excl( 1 ), end_excl( 2 ), end_excl( 3 ) } ),
389 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_max ) {
390 ScalarType val = Kokkos::abs( x( local_subdomain, i, j, k ) );
391 local_max = Kokkos::max( local_max, val );
393 Kokkos::Max< ScalarType >( max_mag ) );
397 MPI_Allreduce( MPI_IN_PLACE, &max_mag, 1, mpi::mpi_datatype< ScalarType >(), MPI_MAX, comm );
402template <
typename ScalarType,
int VecDim >
405 ScalarType max_mag = 0.0;
406 Kokkos::parallel_reduce(
407 "max_vector_magnitude",
409 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_max ) {
411 for (
int d = 0; d < VecDim; ++d )
413 val += x( local_subdomain, i, j, k, d ) * x( local_subdomain, i, j, k, d );
415 val = Kokkos::sqrt( val );
416 local_max = Kokkos::max( local_max, val );
418 Kokkos::Max< ScalarType >( max_mag ) );
422 MPI_Allreduce( MPI_IN_PLACE, &max_mag, 1, mpi::mpi_datatype< ScalarType >(), MPI_MAX, comm );
427template <
typename ScalarType,
int VecDim >
432 Kokkos::parallel_for(
434 Kokkos::MDRangePolicy(
436 { vectorial_data_in.
extent( 0 ),
437 vectorial_data_in.
extent( 1 ),
438 vectorial_data_in.
extent( 2 ),
439 vectorial_data_in.
extent( 3 ) } ),
440 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
442 for (
int d = 0; d < VecDim; ++d )
445 vectorial_data_in( local_subdomain, i, j, k, d ) * vectorial_data_in( local_subdomain, i, j, k, d );
447 magnitude_out( local_subdomain, i, j, k ) = Kokkos::sqrt( val );
453template <
typename ScalarType,
int VecDim >
457 const int component )
459 if ( component < 0 || component >= VecDim )
461 Kokkos::abort(
"Vector component invalid." );
464 Kokkos::parallel_for(
465 "extract_vector_component",
466 Kokkos::MDRangePolicy(
468 { vectorial_data_in.
extent( 0 ),
469 vectorial_data_in.
extent( 1 ),
470 vectorial_data_in.
extent( 2 ),
471 vectorial_data_in.
extent( 3 ) } ),
472 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
473 component_out( local_subdomain, i, j, k ) = vectorial_data_in( local_subdomain, i, j, k, component );
479template <
typename ScalarType,
int VecDim >
483 const ScalarType constant )
485 if ( component < 0 || component >= VecDim )
487 Kokkos::abort(
"Vector component invalid." );
490 Kokkos::parallel_for(
491 "set_vector_component",
492 Kokkos::MDRangePolicy(
494 { vectorial_data.
extent( 0 ),
495 vectorial_data.
extent( 1 ),
496 vectorial_data.
extent( 2 ),
497 vectorial_data.
extent( 3 ) } ),
498 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
499 vectorial_data( local_subdomain, i, j, k, component ) = constant;
505template <
typename ScalarType >
508 ScalarType sum_abs = 0.0;
509 Kokkos::parallel_reduce(
511 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
512 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_sum_abs ) {
513 ScalarType val = Kokkos::abs( x( local_subdomain, i, j, k ) );
514 local_sum_abs = local_sum_abs + val;
516 Kokkos::Sum< ScalarType >( sum_abs ) );
520 MPI_Allreduce( MPI_IN_PLACE, &sum_abs, 1, mpi::mpi_datatype< ScalarType >(), MPI_SUM, comm );
525template <
typename ScalarType, util::FlagLike FlagType >
527 const FlagType& mask_value,
528 MPI_Comm comm = MPI_COMM_WORLD )
530 auto count =
static_cast< ScalarType
>( 0 );
532 Kokkos::parallel_reduce(
534 Kokkos::MDRangePolicy(
535 { 0, 0, 0, 0 }, { mask.extent( 0 ), mask.extent( 1 ), mask.extent( 2 ), mask.extent( 3 ) } ),
536 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_sum ) {
537 const ScalarType mask_val =
util::has_flag( mask( local_subdomain, i, j, k ), mask_value ) ?
538 static_cast< ScalarType
>( 1 ) :
539 static_cast< ScalarType
>( 0 );
540 local_sum = local_sum + mask_val;
542 Kokkos::Sum< ScalarType >( count ) );
546 MPI_Allreduce( MPI_IN_PLACE, &count, 1, mpi::mpi_datatype< ScalarType >(), MPI_SUM, comm );
551template <
typename ScalarType, util::FlagLike FlagType >
555 const FlagType& mask_value,
556 MPI_Comm comm = MPI_COMM_WORLD )
558 ScalarType sum = 0.0;
560 Kokkos::parallel_reduce(
562 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
563 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_sum ) {
564 const ScalarType mask_val =
util::has_flag( mask( local_subdomain, i, j, k ), mask_value ) ? 1.0 : 0.0;
565 ScalarType val = x( local_subdomain, i, j, k ) * mask_val;
566 local_sum = local_sum + val;
568 Kokkos::Sum< ScalarType >( sum ) );
572 MPI_Allreduce( MPI_IN_PLACE, &sum, 1, mpi::mpi_datatype< ScalarType >(), MPI_SUM, comm );
577template <
typename ScalarType, util::FlagLike FlagType0, util::FlagLike FlagType1 >
582 const FlagType0& mask0_value,
583 const FlagType1& mask1_value,
584 MPI_Comm comm = MPI_COMM_WORLD )
586 ScalarType sum = 0.0;
588 Kokkos::parallel_reduce(
590 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
591 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_sum ) {
592 ScalarType mask_val = 1.0;
593 mask_val *=
util::has_flag( mask0( local_subdomain, i, j, k ), mask0_value ) ? 1.0 : 0.0;
594 mask_val *=
util::has_flag( mask1( local_subdomain, i, j, k ), mask1_value ) ? 1.0 : 0.0;
595 ScalarType val = x( local_subdomain, i, j, k ) * mask_val;
596 local_sum = local_sum + val;
598 Kokkos::Sum< ScalarType >( sum ) );
602 MPI_Allreduce( MPI_IN_PLACE, &sum, 1, mpi::mpi_datatype< ScalarType >(), MPI_SUM, comm );
607template <
typename ScalarType >
610 MPI_Comm comm = MPI_COMM_WORLD )
612 ScalarType dot_prod = 0.0;
614 Kokkos::parallel_reduce(
616 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
617 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_dot_prod ) {
618 ScalarType val = x( local_subdomain, i, j, k ) * y( local_subdomain, i, j, k );
619 local_dot_prod = local_dot_prod + val;
621 Kokkos::Sum< ScalarType >( dot_prod ) );
623 Kokkos::fence(
"dot_product" );
625 MPI_Allreduce( MPI_IN_PLACE, &dot_prod, 1, mpi::mpi_datatype< ScalarType >(), MPI_SUM, comm );
630template <
typename ScalarType, util::FlagLike FlagType >
635 const FlagType& mask_value,
636 MPI_Comm comm = MPI_COMM_WORLD )
638 ScalarType dot_prod = 0.0;
640 Kokkos::parallel_reduce(
641 "masked_dot_product",
642 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
643 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_dot_prod ) {
644 const ScalarType mask_val =
util::has_flag( mask( local_subdomain, i, j, k ), mask_value ) ? 1.0 : 0.0;
645 ScalarType val = x( local_subdomain, i, j, k ) * y( local_subdomain, i, j, k ) * mask_val;
646 local_dot_prod = local_dot_prod + val;
648 Kokkos::Sum< ScalarType >( dot_prod ) );
650 Kokkos::fence(
"masked_dot_product" );
652 MPI_Allreduce( MPI_IN_PLACE, &dot_prod, 1, mpi::mpi_datatype< ScalarType >(), MPI_SUM, comm );
657template <
typename ScalarType, util::FlagLike FlagType,
int VecDim >
662 const FlagType& mask_value,
663 MPI_Comm comm = MPI_COMM_WORLD )
665 ScalarType dot_prod = 0.0;
666 for (
int d = 0; d < VecDim; ++d )
675template <
typename ScalarType >
681 MPI_Comm comm = MPI_COMM_WORLD )
683 ScalarType dot_prod = 0.0;
685 Kokkos::parallel_reduce(
686 "masked_dot_product",
687 Kokkos::MDRangePolicy(
688 { start( 0 ), start( 1 ), start( 2 ), start( 3 ) },
689 { end_excl( 0 ), end_excl( 1 ), end_excl( 2 ), end_excl( 3 ) } ),
690 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k, ScalarType& local_dot_prod ) {
691 ScalarType val = x( local_subdomain, i, j, k ) * y( local_subdomain, i, j, k );
692 local_dot_prod = local_dot_prod + val;
694 Kokkos::Sum< ScalarType >( dot_prod ) );
696 Kokkos::fence(
"masked_dot_product" );
698 MPI_Allreduce( MPI_IN_PLACE, &dot_prod, 1, mpi::mpi_datatype< ScalarType >(), MPI_SUM, comm );
703template <
typename ScalarType >
708 Kokkos::parallel_reduce(
709 "masked_dot_product",
710 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { x.extent( 0 ), x.extent( 1 ), x.extent( 2 ), x.extent( 3 ) } ),
711 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k,
bool& local_has_nan_or_inf ) {
712 local_has_nan_or_inf = local_has_nan_or_inf || ( Kokkos::isnan( x( local_subdomain, i, j, k ) ) ||
713 Kokkos::isinf( x( local_subdomain, i, j, k ) ) );
724template <
typename ScalarType,
int VecDim >
727 for (
int d = 0; d < VecDim; ++d )
735template <
typename ScalarTypeDst,
typename ScalarTypeSrc >
738 Kokkos::parallel_for(
740 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { dst.extent( 0 ), dst.extent( 1 ), dst.extent( 2 ), dst.extent( 3 ) } ),
741 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
742 dst( local_subdomain, i, j, k ) =
static_cast< ScalarTypeDst
>( src( local_subdomain, i, j, k ) );
748template <
typename ScalarTypeDst >
752 std::is_same_v< ScalarTypeDst, double > || std::is_same_v< ScalarTypeDst, float >,
753 "Random integers not implemented. But can be done easily below." );
755 Kokkos::Random_XorShift64_Pool<> random_pool( 12345 );
756 Kokkos::parallel_for(
758 Kokkos::MDRangePolicy( { 0, 0, 0, 0 }, { dst.extent( 0 ), dst.extent( 1 ), dst.extent( 2 ), dst.extent( 3 ) } ),
759 KOKKOS_LAMBDA(
int local_subdomain,
int i,
int j,
int k ) {
760 auto generator = random_pool.get_state();
761 dst( local_subdomain, i, j, k ) =
static_cast< ScalarTypeDst
>( generator.drand() );
762 random_pool.free_state( generator );
768template <
typename ScalarTypeDst,
int VecDim >
771 for (
int d = 0; d < VecDim; ++d )
Kokkos::View< ScalarType *****, Layout > Grid5DDataScalar
Definition grid_types.hpp:30
Kokkos::View< ScalarType ***, Layout > Grid3DDataScalar
Definition grid_types.hpp:24
Kokkos::View< ScalarType ****, Layout > Grid4DDataScalar
Definition grid_types.hpp:27
Kokkos::View< ScalarType **, Layout > Grid2DDataScalar
Definition grid_types.hpp:21
Definition grid_operations.hpp:9
ScalarType count_masked(const grid::Grid4DDataScalar< FlagType > &mask, const FlagType &mask_value, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:526
void extract_vector_component(grid::Grid4DDataScalar< ScalarType > &component_out, const grid::Grid4DDataVec< ScalarType, VecDim > &vectorial_data_in, const int component)
Definition grid_operations.hpp:454
void invert_inplace(const grid::Grid4DDataScalar< ScalarType > &y)
Definition grid_operations.hpp:232
ScalarType max_abs_entry(const grid::Grid4DDataScalar< ScalarType > &x, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:316
bool has_nan_or_inf(const grid::Grid4DDataScalar< ScalarType > &x, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:704
ScalarType dot_product(const grid::Grid4DDataScalar< ScalarType > &x, const grid::Grid4DDataScalar< ScalarType > &y, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:608
ScalarType masked_dot_product(const grid::Grid4DDataScalar< ScalarType > &x, const grid::Grid4DDataScalar< ScalarType > &y, const grid::Grid4DDataScalar< FlagType > &mask, const FlagType &mask_value, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:631
ScalarType max_abs_entry_subset(const grid::Grid4DDataScalar< ScalarType > &x, dense::Vec< int, 4 > start, dense::Vec< int, 4 > end_excl, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:377
void cast(const grid::Grid4DDataScalar< ScalarTypeDst > &dst, const grid::Grid4DDataScalar< ScalarTypeSrc > &src)
Definition grid_operations.hpp:736
ScalarType min_abs_entry(const grid::Grid4DDataScalar< ScalarType > &x, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:296
void scale(const grid::Grid4DDataScalar< ScalarType > &x, ScalarType value)
Definition grid_operations.hpp:43
void vector_magnitude(grid::Grid4DDataScalar< ScalarType > &magnitude_out, const grid::Grid4DDataVec< ScalarType, VecDim > &vectorial_data_in)
Definition grid_operations.hpp:428
ScalarType min_entry(const grid::Grid4DDataScalar< ScalarType > &x, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:276
void set_constant(const grid::Grid2DDataScalar< ScalarType > &x, ScalarType value)
Definition grid_operations.hpp:12
void mult_elementwise_inplace(const grid::Grid4DDataScalar< ScalarType > &y, const grid::Grid4DDataScalar< ScalarType > &x)
Definition grid_operations.hpp:252
ScalarType max_vector_magnitude(const grid::Grid4DDataVec< ScalarType, VecDim > &x, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:403
ScalarType sum_of_absolutes(const grid::Grid4DDataScalar< ScalarType > &x, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:506
void assign_masked_else_keep_old(const grid::Grid4DDataScalar< ScalarType > &dst, const ScalarType &value, const grid::Grid4DDataScalar< FlagType > &mask_grid, const FlagType mask_value)
Definition grid_operations.hpp:54
void set_vector_component(grid::Grid4DDataVec< ScalarType, VecDim > &vectorial_data, const int component, const ScalarType constant)
Definition grid_operations.hpp:480
void rand(const grid::Grid4DDataScalar< ScalarTypeDst > &dst)
Definition grid_operations.hpp:749
ScalarType masked_sum(const grid::Grid4DDataScalar< ScalarType > &x, const grid::Grid4DDataScalar< FlagType > &mask, const FlagType &mask_value, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:552
void lincomb(const grid::Grid4DDataScalar< ScalarType > &y, ScalarType c_0, ScalarType c_1, const grid::Grid4DDataScalar< ScalarType > &x_1)
Definition grid_operations.hpp:133
ScalarType dot_product_subset(const grid::Grid4DDataScalar< ScalarType > &x, const grid::Grid4DDataScalar< ScalarType > &y, dense::Vec< int, 4 > start, dense::Vec< int, 4 > end_excl, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:676
MPI_Datatype mpi_datatype< bool >()
Definition mpi.hpp:231
constexpr bool has_flag(E mask_value, E flag) noexcept
Checks if a bitmask value contains a specific flag.
Definition bit_masking.hpp:43
SoA (Structure-of-Arrays) 4D vector grid data.
Definition grid_types.hpp:51
Grid4DDataScalar< ScalarType > comp_[VecDim]
Definition grid_types.hpp:57
auto extent(int i) const
Definition grid_types.hpp:75