GEOS
PropertyKernelBase.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_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PROPERTYKERNELBASE_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PROPERTYKERNELBASE_HPP
22 
23 #include "common/DataTypes.hpp"
24 #include "common/GEOS_RAJA_Interface.hpp"
25 
26 namespace geos
27 {
28 
29 namespace isothermalCompositionalMultiphaseBaseKernels
30 {
31 
32 /******************************** PropertyKernelBase ********************************/
33 
39 template< integer NUM_COMP >
41 {
42 public:
43 
45  static constexpr integer numComp = NUM_COMP;
46 
54  template< typename POLICY, typename KERNEL_TYPE >
55  static void
56  launch( localIndex const numElems,
57  KERNEL_TYPE const & kernelComponent )
58  {
59  forAll< POLICY >( numElems, [=] GEOS_HOST_DEVICE ( localIndex const ei )
60  {
61  kernelComponent.compute( ei );
62  } );
63  }
64 
72  template< typename POLICY, typename KERNEL_TYPE >
73  static void
75  KERNEL_TYPE const & kernelComponent )
76  {
77  forAll< POLICY >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const i )
78  {
79  localIndex const ei = targetSet[ i ];
80  kernelComponent.compute( ei );
81  } );
82  }
83 
84 };
85 
86 } // namespace isothermalCompositionalMultiphaseBaseKernels
87 
88 } // namespace geos
89 
90 
91 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PROPERTYKERNELBASE_HPP
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
Define the base interface for the property update kernels.
static void launch(localIndex const numElems, KERNEL_TYPE const &kernelComponent)
Performs the kernel launch.
static constexpr integer numComp
Compile time value for the number of components.
static void launch(SortedArrayView< localIndex const > const &targetSet, KERNEL_TYPE const &kernelComponent)
Performs the kernel launch on a sorted array.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
LvArray::SortedArrayView< T, localIndex, LvArray::ChaiBuffer > SortedArrayView
A sorted array view of local indices.
Definition: DataTypes.hpp:271