Skip to content

File Meanmax.h

FileList > src > Meanmax.h

Go to the source code of this file

  • #include "General.h"
  • #include "Param.h"
  • #include "Arrays.h"
  • #include "Forcing.h"
  • #include "MemManagement.h"
  • #include "FlowGPU.h"

Public Functions

Type Name
void Calcmeanmax (Param XParam, Loop< T > & XLoop, Model< T > XModel, Model< T > XModel_g)
Calculate mean and/or max of requested variables on GPU/CPU.
void Initmeanmax (Param XParam, Loop< T > XLoop, Model< T > XModel, Model< T > XModel_g)
Initialize mean and max statistics at the start of the simulation.
__global__ void addUandhU_GPU (Param XParam, BlockP< T > XBlock, T * h, T * u, T * v, T * U, T * hU)
CUDA kernel to compute velocity magnitude and hU product.
__global__ void addavg_varGPU (Param XParam, BlockP< T > XBlock, T * Varmean, T * Var)
CUDA kernel to accumulate mean values for a variable.
__global__ void addwettime_GPU (Param XParam, BlockP< T > XBlock, T * wett, T * h, T thresold, T time)
CUDA kernel to accumulate wet duration for each cell.
__global__ void divavg_varGPU (Param XParam, BlockP< T > XBlock, T ntdiv, T * Varmean)
CUDA kernel to divide mean values by the number of steps.
__global__ void max_Norm_GPU (Param XParam, BlockP< T > XBlock, T * Varmax, T * Var1, T * Var2)
CUDA kernel to compute max velocity magnitude.
__global__ void max_hU_GPU (Param XParam, BlockP< T > XBlock, T * Varmax, T * Var1, T * Var2, T * Var3)
CUDA kernel to compute max hU value.
__global__ void max_varGPU (Param XParam, BlockP< T > XBlock, T * Varmax, T * Var)
CUDA kernel to compute max value for a variable.
void resetmeanmax (Param XParam, Loop< T > & XLoop, Model< T > XModel, Model< T > XModel_g)
Reset mean and/or max statistics at output steps.
void resetvalGPU (Param XParam, BlockP< T > XBlock, T *& var, T val)
Reset a variable array to a specified value on the GPU.

Public Functions Documentation

function Calcmeanmax

Calculate mean and/or max of requested variables on GPU/CPU.

template<class T>
void Calcmeanmax (
    Param XParam,
    Loop < T > & XLoop,
    Model < T > XModel,
    Model < T > XModel_g
) 

Computes mean, max, and wet duration statistics for evolving variables, handling both CPU and GPU execution paths.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XLoop Loop control structure
  • XModel Model state (CPU)
  • XModel_g Model state (GPU)

function Initmeanmax

Initialize mean and max statistics at the start of the simulation.

template<class T>
void Initmeanmax (
    Param XParam,
    Loop < T > XLoop,
    Model < T > XModel,
    Model < T > XModel_g
) 

Sets up/reset statistics arrays for the initial simulation step.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XLoop Loop control structure
  • XModel Model state (CPU)
  • XModel_g Model state (GPU)

function addUandhU_GPU

CUDA kernel to compute velocity magnitude and hU product.

template<class T>
__global__ void addUandhU_GPU (
    Param XParam,
    BlockP < T > XBlock,
    T * h,
    T * u,
    T * v,
    T * U,
    T * hU
) 

Calculates the velocity magnitude and its product with water depth for each cell on the GPU.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • h Water depth array
  • u U-velocity array
  • v V-velocity array
  • U Output velocity magnitude array
  • hU Output hU product array

function addavg_varGPU

CUDA kernel to accumulate mean values for a variable.

template<class T>
__global__ void addavg_varGPU (
    Param XParam,
    BlockP < T > XBlock,
    T * Varmean,
    T * Var
) 

Adds the current value to the running mean for each cell on the GPU.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • Varmean Mean variable array
  • Var Source variable array

function addwettime_GPU

CUDA kernel to accumulate wet duration for each cell.

template<class T>
__global__ void addwettime_GPU (
    Param XParam,
    BlockP < T > XBlock,
    T * wett,
    T * h,
    T thresold,
    T time
) 

Adds time to the wet duration for cells where water depth exceeds a threshold on the GPU.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • wett Wet duration array
  • h Water depth array
  • thresold Wet threshold value
  • time Time increment

function divavg_varGPU

CUDA kernel to divide mean values by the number of steps.

template<class T>
__global__ void divavg_varGPU (
    Param XParam,
    BlockP < T > XBlock,
    T ntdiv,
    T * Varmean
) 

Finalizes the mean calculation by dividing accumulated values by the number of time steps on the GPU.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • ntdiv Number of time steps
  • Varmean Mean variable array

function max_Norm_GPU

CUDA kernel to compute max velocity magnitude.

template<class T>
__global__ void max_Norm_GPU (
    Param XParam,
    BlockP < T > XBlock,
    T * Varmax,
    T * Var1,
    T * Var2
) 

Updates the max velocity magnitude for each cell by comparing with the current value on the GPU.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • Varmax Max variable array
  • Var1 U-velocity array
  • Var2 V-velocity array

function max_hU_GPU

CUDA kernel to compute max hU value.

template<class T>
__global__ void max_hU_GPU (
    Param XParam,
    BlockP < T > XBlock,
    T * Varmax,
    T * Var1,
    T * Var2,
    T * Var3
) 

Updates the max hU value for each cell by comparing with the current value on the GPU.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • Varmax Max variable array
  • h Water depth array
  • u U-velocity array
  • v V-velocity array

function max_varGPU

CUDA kernel to compute max value for a variable.

template<class T>
__global__ void max_varGPU (
    Param XParam,
    BlockP < T > XBlock,
    T * Varmax,
    T * Var
) 

Updates the max value for each cell by comparing with the current value on the GPU.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • Varmax Max variable array
  • Var Source variable array

function resetmeanmax

Reset mean and/or max statistics at output steps.

template<class T>
void resetmeanmax (
    Param XParam,
    Loop < T > & XLoop,
    Model < T > XModel,
    Model < T > XModel_g
) 

Resets mean, max, and wet duration arrays after output is produced, handling both CPU and GPU paths.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XLoop Loop control structure
  • XModel Model state (CPU)
  • XModel_g Model state (GPU)

function resetvalGPU

Reset a variable array to a specified value on the GPU.

template<class T>
void resetvalGPU (
    Param XParam,
    BlockP < T > XBlock,
    T *& var,
    T val
) 

Sets all elements of the array to the given value using a CUDA kernel.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XBlock Block data
  • var Variable array to reset
  • val Value to set


The documentation for this class was generated from the following file src/Meanmax.h