GEOS
StencilWeightsUpdateKernel.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 TotalEnergies
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_STENCILWEIGHTSUPDATEKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_STENCILWEIGHTSUPDATEKERNEL_HPP
22 
23 #include "common/DataTypes.hpp"
24 #include "common/GEOS_RAJA_Interface.hpp"
26 
27 namespace geos
28 {
29 
30 namespace flowSolverBaseKernels
31 {
32 
33 template< typename VIEWTYPE >
34 using ElementViewConst = ElementRegionManager::ElementViewConst< VIEWTYPE >;
35 
41 template< typename STENCILWRAPPER >
43 {
50  inline static void prepareStencilWeights( STENCILWRAPPER & stencilWrapper,
51  ElementViewConst< arrayView1d< real64 const > > const hydraulicAperture )
52  {
53  forAll< parallelDevicePolicy<> >( stencilWrapper.size(), [=] GEOS_HOST_DEVICE ( localIndex const iconn )
54  {
55  stencilWrapper.removeHydraulicApertureContribution( iconn, hydraulicAperture );
56  } );
57  }
58 
65  inline static void updateStencilWeights( STENCILWRAPPER & stencilWrapper,
66  ElementViewConst< arrayView1d< real64 const > > const hydraulicAperture )
67  {
68  forAll< parallelDevicePolicy<> >( stencilWrapper.size(), [=] GEOS_HOST_DEVICE ( localIndex const iconn )
69  {
70  stencilWrapper.addHydraulicApertureContribution( iconn, hydraulicAperture );
71  } );
72  }
73 };
74 
75 } // namespace flowSolverBaseKernels
76 
77 } // namespace geos
78 
79 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_STENCILWEIGHTSUPDATEKERNEL_HPP
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
static void prepareStencilWeights(STENCILWRAPPER &stencilWrapper, ElementViewConst< arrayView1d< real64 const > > const hydraulicAperture)
static void updateStencilWeights(STENCILWRAPPER &stencilWrapper, ElementViewConst< arrayView1d< real64 const > > const hydraulicAperture)