Skip to content

File Halo.h

FileList > src > Halo.h

Go to the source code of this file

  • #include "General.h"
  • #include "Param.h"
  • #include "Write_txtlog.h"
  • #include "Util_CPU.h"
  • #include "Arrays.h"
  • #include "Mesh.h"
  • #include "MemManagement.h"
  • #include "Boundary.h"
  • #include "ConserveElevation.h"

Public Functions

Type Name
__global__ void HaloFluxGPUBT (Param XParam, BlockP< T > XBlock, T * z)
GPU kernel for applying halo flux correction on the top and bottom boundaries of all active blocks.
__global__ void HaloFluxGPUBTnew (Param XParam, BlockP< T > XBlock, T * z)
GPU kernel for applying halo flux correction on the top and bottom boundaries of all active blocks.
__global__ void HaloFluxGPULR (Param XParam, BlockP< T > XBlock, T * z)
Wrapping function for applying halo flux correction on the left and right boundaries of all active blocks.
__global__ void HaloFluxGPULRnew (Param XParam, BlockP< T > XBlock, T * z)
GPU kernel for applying halo flux correction on the left and right boundaries of all active blocks.
void RecalculateZs (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb)
Recalculate water surface after recalculating the values on the halo on the CPU.
__global__ void RecalculateZsGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb)
void Recalculatehh (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb)
Recalculate water depth after recalculating the values on the halo on the CPU.
void bndmaskGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, FluxP< T > Flux)
Wrapping function for applying boundary masks to flux variables on GPU.
void fillBot (Param XParam, int ib, BlockP< T > XBlock, T *& z)
Function to fill the bottom halo region of a block, handling various neighbor configurations.
__global__ void fillBot (int halowidth, int * active, int * level, int * botleft, int * botright, int * topleft, int * lefttop, int * righttop, T * a)
CUDA kernel to fill the bottom halo region of blocks in parallel, handling various neighbor configurations.
__global__ void fillBotnew (int halowidth, int nblk, int * active, int * level, int * botleft, int * botright, int * topleft, int * lefttop, int * righttop, T * a)
CUDA kernel to fill the bottom halo region of blocks in parallel for new refinement, handling various neighbor configurations, new version.
void fillCorners (Param XParam, int ib, BlockP< T > XBlock, T *& z)
Function to fill the corner halo regions for a specific block, handling various neighbor configurations.
void fillCorners (Param XParam, BlockP< T > XBlock, T *& z)
Function to fill the corner halo regions for all active blocks.
void fillCorners (Param XParam, BlockP< T > XBlock, EvolvingP< T > & Xev)
Function to fill the corner halo regions for all active blocks and all evolving variables.
__global__ void fillCornersGPU (Param XParam, BlockP< T > XBlock, T * z)
CUDA kernel to fill the corner halo regions for all active blocks in parallel, handling various neighbor configurations.
void fillHalo (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb)
Wrapping function for calculating halos for each block and each variable on CPU.
void fillHalo (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev)
Wrapping function for calculating halos for each block and each variable on CPU.
void fillHalo (Param XParam, BlockP< T > XBlock, GradientsP< T > Grad)
Wrapping function for calculating halos for each block and each variable on CPU.
void fillHalo (Param XParam, BlockP< T > XBlock, FluxP< T > Flux)
Wrapping function for calculating flux halos for each block and each variable on CPU.
void fillHaloC (Param XParam, BlockP< T > XBlock, T * z)
Wrapping function for calculating halos for each block of a single variable on CPU.
void fillHaloF (Param XParam, bool doProlongation, BlockP< T > XBlock, T * z)
Wrapping function for calculating flux in the halos for a block and a single variable on CPU.
void fillHaloGPU (Param XParam, BlockP< T > XBlock, cudaStream_t stream, T * z)
Wrapping function for calculating halos for each block of a single variable on GPU.
void fillHaloGPU (Param XParam, BlockP< T > XBlock, T * z)
Wrapping function for calculating halos for each block of a single variable on GPU.
void fillHaloGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev)
Wrapping function for calculating halos for each block and each variable on GPU.
void fillHaloGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb)
Wrapping function for calculating halos for each block and each variable on GPU.
void fillHaloGPU (Param XParam, BlockP< T > XBlock, GradientsP< T > Grad)
Wrapping function for calculating halos for each block and each variable on GPU.
void fillHaloGPU (Param XParam, BlockP< T > XBlock, FluxP< T > Flux)
Wrapping function for calculating flux halos for each block and each variable on GPU.
void fillHaloGPUnew (Param XParam, BlockP< T > XBlock, cudaStream_t stream, T * z)
Wrapping function for calculating halos for each block of a single variable on GPU. New version.
void fillHaloTopRightC (Param XParam, BlockP< T > XBlock, T * z)
Wrapping function for calculating flux for halos for each block of a single variable on GPU.
void fillHaloTopRightGPU (Param XParam, bool doprolong, BlockP< T > XBlock, cudaStream_t stream, T * z)
void fillLeft (Param XParam, int ib, BlockP< T > XBlock, T *& z)
Applying halo flux correction on the left boundaries of all active blocks on GPU.
__global__ void fillLeft (int halowidth, int * active, int * level, int * leftbot, int * lefttop, int * rightbot, int * botright, int * topright, T * a)
GPU kernel for applying halo flux correction on the left boundaries of all active blocks.
__global__ void fillLeftnew (int halowidth, int nblk, int * active, int * level, int * leftbot, int * lefttop, int * rightbot, int * botright, int * topright, T * a)
New way of filling the left halo 2 blocks at a time to maximize GPU occupancy.
void fillRight (Param XParam, int ib, BlockP< T > XBlock, T *& z)
Fills the right halo region of a block.
__global__ void fillRight (int halowidth, int * active, int * level, int * rightbot, int * righttop, int * leftbot, int * botleft, int * topleft, T * a)
CUDA kernel to fill the right halo region of blocks in parallel.
void fillRightFlux (Param XParam, bool doProlongation, int ib, BlockP< T > XBlock, T *& z)
Function to fill the right halo region of a block, handling various neighbor configurations.
__global__ void fillRightFlux (int halowidth, bool doProlongation, int * active, int * level, int * rightbot, int * righttop, int * leftbot, int * botleft, int * topleft, T * a)
CUDA kernel to fill the right halo region of blocks in parallel for flux variables, handling various neighbor configurations.
__global__ void fillRightnew (int halowidth, int nblk, int * active, int * level, int * rightbot, int * righttop, int * leftbot, int * botleft, int * topleft, T * a)
CUDA kernel to fill the right halo region of blocks in parallel (new version).
void fillTop (Param XParam, int ib, BlockP< T > XBlock, T *& z)
Fills the top halo region of a block, handling various neighbor configurations.
__global__ void fillTop (int halowidth, int * active, int * level, int * topleft, int * topright, int * botleft, int * leftbot, int * rightbot, T * a)
CUDA kernel to fill the top halo region of blocks in parallel for new refinement, handling various neighbor configurations, new version.
void fillTopFlux (Param XParam, bool doProlongation, int ib, BlockP< T > XBlock, T *& z)
Function to fill the top halo region of a block for new refinement, handling various neighbor configurations.
__global__ void fillTopFlux (int halowidth, bool doProlongation, int * active, int * level, int * topleft, int * topright, int * botleft, int * leftbot, int * rightbot, T * a)
CUDA kernel to fill the top halo region of blocks in parallel for new refinement, handling various neighbor configurations, new version.
__global__ void fillTopnew (int halowidth, int nblk, int * active, int * level, int * topleft, int * topright, int * botleft, int * leftbot, int * rightbot, T * a)
void refine_linear (Param XParam, BlockP< T > XBlock, T * z, T * dzdx, T * dzdy)
Wrapping function for refining all sides of active blocks using linear reconstruction.
void refine_linearGPU (Param XParam, BlockP< T > XBlock, T * z, T * dzdx, T * dzdy)
Wrapping function for refining all sides of active blocks using linear reconstruction on GPU.
void refine_linear_Bot (Param XParam, int ib, BlockP< T > XBlock, T * z, T * dzdy)
void refine_linear_Left (Param XParam, int ib, BlockP< T > XBlock, T * z, T * dzdx, T * dzdy)
Refine a block on the left side using linear reconstruction.
void refine_linear_Right (Param XParam, int ib, BlockP< T > XBlock, T * z, T * dzdx)
void refine_linear_Top (Param XParam, int ib, BlockP< T > XBlock, T * z, T * dzdy)

Public Functions Documentation

function HaloFluxGPUBT

GPU kernel for applying halo flux correction on the top and bottom boundaries of all active blocks.

template<class T>
__global__ void HaloFluxGPUBT (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to be refined

Template parameters:

  • T The data type (float or double)

function HaloFluxGPUBTnew

GPU kernel for applying halo flux correction on the top and bottom boundaries of all active blocks.

template<class T>
__global__ void HaloFluxGPUBTnew (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to be refined

Template parameters:

  • T The data type (float or double)

function HaloFluxGPULR

Wrapping function for applying halo flux correction on the left and right boundaries of all active blocks.

template<class T>
__global__ void HaloFluxGPULR (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to be refined

Template parameters:

  • T The data type (float or double)

function HaloFluxGPULRnew

GPU kernel for applying halo flux correction on the left and right boundaries of all active blocks.

template<class T>
__global__ void HaloFluxGPULRnew (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to be refined

Template parameters:

  • T The data type (float or double)

function RecalculateZs

Recalculate water surface after recalculating the values on the halo on the CPU.

template<class T>
void RecalculateZs (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev,
    T * zb
) 

Recalculate water surface after recalculating the values on the halo on the GPU.

!

Description

Recalculate water surface after recalculating the values on the halo on the CPU. zb (bottom elevation) on each halo is calculated at the start of the loop or as part of the initial condition. When conserve-elevation is not required, only h is recalculated on the halo at ever 1/2 steps. zs then needs to be recalculated to obtain a mass-conservative solution (if zs is conserved then mass conservation is not garanteed)

Warning:

This function calculate zs everywhere in the block... this is a bit unecessary. Instead it should recalculate only where there is a prolongation or a restiction

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables
  • zb The bottom elevation variable

Template parameters:

  • T The data type (float or double)

!

Description

Recalculate water surface after recalculating the values on the halo on the CPU. zb (bottom elevation) on each halo is calculated at the start of the loop or as part of the initial condition. When conserve-elevation is not required, only h is recalculated on the halo at ever 1/2 steps. zs then needs to be recalculated to obtain a mass-conservative solution (if zs is conserved then mass conservation is not garanteed)

Warning:

This function calculate zs everywhere in the block... this is a bit unecessary. Instead it should recalculate only where there is a prolongation or a restiction

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables
  • zb The bottom elevation variable

Template parameters:

  • T The data type (float or double)

function RecalculateZsGPU

template<class T>
__global__ void RecalculateZsGPU (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev,
    T * zb
) 

function Recalculatehh

Recalculate water depth after recalculating the values on the halo on the CPU.

template<class T>
void Recalculatehh (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev,
    T * zb
) 

Description

Recalculate water depth after recalculating the values on the halo on the CPU. zb (bottom elevation) on each halo is calculated at the start of the loop or as part of the initial condition. When conserve-elevation is not required, only h is recalculated on the halo at ever 1/2 steps. zs then needs to be recalculated to obtain a mass-conservative solution (if zs is conserved then mass conservation is not garanteed)

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables
  • zb The bottom elevation variable

Template parameters:

  • T The data type (float or double)

function bndmaskGPU

Wrapping function for applying boundary masks to flux variables on GPU.

template<class T>
void bndmaskGPU (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev,
    FluxP < T > Flux
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables
  • Flux The flux structure containing the flux variables

Template parameters:

  • T The data type (float or double)

function fillBot

Function to fill the bottom halo region of a block, handling various neighbor configurations.

template<class T>
void fillBot (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The parameters of the grid and blocks
  • ib The index of the current block
  • XBlock The block structure containing neighbor information
  • z The variable to be refined
  • T The data type of the variable (e.g., float, double)

function fillBot

CUDA kernel to fill the bottom halo region of blocks in parallel, handling various neighbor configurations.

template<class T>
__global__ void fillBot (
    int halowidth,
    int * active,
    int * level,
    int * botleft,
    int * botright,
    int * topleft,
    int * lefttop,
    int * righttop,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • active The array of active block indices
  • level The array of block levels
  • botleft The array of bottom left neighbor block indices
  • botright The array of bottom right neighbor block indices
  • topleft The array of top left neighbor block indices
  • lefttop The array of left top neighbor block indices
  • righttop The array of right top neighbor block indices
  • a The variable to be refined
  • T The data type of the variable (e.g., float, double)

function fillBotnew

CUDA kernel to fill the bottom halo region of blocks in parallel for new refinement, handling various neighbor configurations, new version.

template<class T>
__global__ void fillBotnew (
    int halowidth,
    int nblk,
    int * active,
    int * level,
    int * botleft,
    int * botright,
    int * topleft,
    int * lefttop,
    int * righttop,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • nblk The number of active blocks
  • active The array of active block indices
  • level The array of block levels
  • botleft The array of bottom left neighbor block indices
  • botright The array of bottom right neighbor block indices
  • topleft The array of top left neighbor block indices
  • lefttop The array of left top neighbor block indices
  • righttop The array of right top neighbor block indices
  • a The variable to be refined
  • T The data type of the variable (e.g., float, double)

function fillCorners

Function to fill the corner halo regions for a specific block, handling various neighbor configurations.

template<class T>
void fillCorners (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The parameters of the grid and blocks
  • ib The index of the block to be processed
  • XBlock The structure containing block neighbor information
  • z The variable to be processed
  • T The data type of the variable (e.g., float, double)

function fillCorners

Function to fill the corner halo regions for all active blocks.

template<class T>
void fillCorners (
    Param XParam,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The parameters of the grid and blocks
  • XBlock The structure containing block neighbor information
  • z The variable to be processed

Template parameters:

  • T The data type of the variable (e.g., float, double)

function fillCorners

Function to fill the corner halo regions for all active blocks and all evolving variables.

template<class T>
void fillCorners (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > & Xev
) 

Parameters:

  • XParam The parameters of the grid and blocks
  • XBlock The structure containing block neighbor information
  • Xev The structure containing evolving variables

Template parameters:

  • T The data type of the variables (e.g., float, double)

function fillCornersGPU

CUDA kernel to fill the corner halo regions for all active blocks in parallel, handling various neighbor configurations.

template<class T>
__global__ void fillCornersGPU (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

Parameters:

  • XParam The parameters of the grid and blocks
  • XBlock The structure containing block neighbor information
  • z The variable to be processed
  • T The data type of the variable (e.g., float, double)

function fillHalo

Wrapping function for calculating halos for each block and each variable on CPU.

template<class T>
void fillHalo (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev,
    T * zb
) 

Description

This function is a wraping fuction of the halo functions on CPU. It is called from the main Halo function. It uses multithreading to calculate the halos of the 4 variables in parallel.

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables
  • zb The bottom elevation variable

Template parameters:

  • T The data type (float or double)

function fillHalo

Wrapping function for calculating halos for each block and each variable on CPU.

template<class T>
void fillHalo (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev
) 

Description

This function is a wraping fuction of the halo functions on CPU. It is called from the main Halo function. It uses multithreading to calculate the halos of the 4 variables in parallel.

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables

Template parameters:

  • T The data type (float or double)

function fillHalo

Wrapping function for calculating halos for each block and each variable on CPU.

template<class T>
void fillHalo (
    Param XParam,
    BlockP < T > XBlock,
    GradientsP < T > Grad
) 

Description

This function is a wrapping function of the halo functions on CPU. It is called from the main Halo function. It uses multithreading to calculate the halos of the 4 variables in parallel.

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Grad The gradients structure containing the gradients

Template parameters:

  • T The data type (float or double)

function fillHalo

Wrapping function for calculating flux halos for each block and each variable on CPU.

template<class T>
void fillHalo (
    Param XParam,
    BlockP < T > XBlock,
    FluxP < T > Flux
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Flux The flux structure containing the flux variables

Template parameters:

  • T The data type (float or double)

function fillHaloC

Wrapping function for calculating halos for each block of a single variable on CPU.

template<class T>
void fillHaloC (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

!

Description

This function is a wraping fuction of the halo functions on CPU. It is called from the main Halo CPU function. This is layer 2 of 3 wrap so the candy doesn't stick too much.

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to work on

function fillHaloF

Wrapping function for calculating flux in the halos for a block and a single variable on CPU.

template<class T>
void fillHaloF (
    Param XParam,
    bool doProlongation,
    BlockP < T > XBlock,
    T * z
) 

!

Deprecated

This function is was never sucessful and will never be used. It is fundamentally flawed because is doesn't preserve the balance of fluxes on the restiction interface. It should be deleted soon.


function fillHaloGPU

Wrapping function for calculating halos for each block of a single variable on GPU.

template<class T>
void fillHaloGPU (
    Param XParam,
    BlockP < T > XBlock,
    cudaStream_t stream,
    T * z
) 

!

Description

This function is a wraping fuction of the halo functions on GPU. It is called from the main Halo GPU function. The present imnplementation is naive and slow one that calls the rather complex fillLeft type functions

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • stream The cuda stream to use
  • z The variable to work on

function fillHaloGPU

Wrapping function for calculating halos for each block of a single variable on GPU.

template<class T>
void fillHaloGPU (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

Deprecated

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • stream The cuda stream to use
  • z The variable to work on

function fillHaloGPU

Wrapping function for calculating halos for each block and each variable on GPU.

template<class T>
void fillHaloGPU (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables

Template parameters:

  • T The data type (float or double)

function fillHaloGPU

Wrapping function for calculating halos for each block and each variable on GPU.

template<class T>
void fillHaloGPU (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > Xev,
    T * zb
) 

Description

This function is a wraping fuction of the halo functions on GPU. It is called from the main Halo GPU function. It uses multiple cuda streams to calculate the halos of the 4 variables in parallel. After filling the halos, it applies either the elevation conservation or wet-dry fix if enabled in parameters. Finally, it recalculates the surface elevation zs based on the updated water depth h and bottom elevation zb.

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Xev The evolving structure containing the evolving variables
  • zb The bottom elevation variable

Template parameters:

  • T The data type (float or double)

function fillHaloGPU

Wrapping function for calculating halos for each block and each variable on GPU.

template<class T>
void fillHaloGPU (
    Param XParam,
    BlockP < T > XBlock,
    GradientsP < T > Grad
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Grad The gradients structure containing the gradients

Template parameters:

  • T The data type (float or double)

function fillHaloGPU

Wrapping function for calculating flux halos for each block and each variable on GPU.

template<class T>
void fillHaloGPU (
    Param XParam,
    BlockP < T > XBlock,
    FluxP < T > Flux
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • Flux The flux structure containing the flux variables

Template parameters:

  • T The data type (float or double)

function fillHaloGPUnew

Wrapping function for calculating halos for each block of a single variable on GPU. New version.

template<class T>
void fillHaloGPUnew (
    Param XParam,
    BlockP < T > XBlock,
    cudaStream_t stream,
    T * z
) 

!

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • stream The cuda stream to use
  • z The variable to work on

function fillHaloTopRightC

Wrapping function for calculating flux for halos for each block of a single variable on GPU.

template<class T>
void fillHaloTopRightC (
    Param XParam,
    BlockP < T > XBlock,
    T * z
) 

Description

This function is a wraping function of the halo flux functions on GPU. It is called from the main Halo GPU function. The present imnplementation is naive and slow one that calls the rather complex fillLeft type functions

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to work on

Note:

For flux term and actually most terms, only top and right neighbours are needed!


function fillHaloTopRightGPU

template<class T>
void fillHaloTopRightGPU (
    Param XParam,
    bool doprolong,
    BlockP < T > XBlock,
    cudaStream_t stream,
    T * z
) 

function fillLeft

Applying halo flux correction on the left boundaries of all active blocks on GPU.

template<class T>
void fillLeft (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The model parameters
  • ib The block index
  • XBlock The block structure containing the block information
  • z The variable to be refined

Template parameters:

  • T The data type (float or double)

function fillLeft

GPU kernel for applying halo flux correction on the left boundaries of all active blocks.

template<class T>
__global__ void fillLeft (
    int halowidth,
    int * active,
    int * level,
    int * leftbot,
    int * lefttop,
    int * rightbot,
    int * botright,
    int * topright,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • active The array of active block indices
  • level The array of block levels
  • leftbot The array of left bottom neighbor block indices
  • lefttop The array of left top neighbor block indices
  • rightbot The array of right bottom neighbor block indices
  • botright The array of bottom right neighbor block indices
  • topright The array of top right neighbor block indices
  • a The variable to be refined
  • T The data type (float or double)

function fillLeftnew

New way of filling the left halo 2 blocks at a time to maximize GPU occupancy.

template<class T>
__global__ void fillLeftnew (
    int halowidth,
    int nblk,
    int * active,
    int * level,
    int * leftbot,
    int * lefttop,
    int * rightbot,
    int * botright,
    int * topright,
    T * a
) 

Description

This fuction is a wraping fuction of the halo functions for CPU. It is called from another wraping function to keep things clean. In a sense this is the third (and last) layer of wrapping

Parameters:

  • halowidth The width of the halo region
  • nblk The number of active blocks
  • active The array of active block indices
  • level The array of block levels
  • leftbot The array of left bottom neighbor block indices
  • lefttop The array of left top neighbor block indices
  • rightbot The array of right bottom neighbor block indices
  • botright The array of bottom right neighbor block indices
  • topright The array of top right neighbor block indices
  • a The variable to be refined

function fillRight

Fills the right halo region of a block.

template<class T>
void fillRight (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The simulation parameters
  • ib The index of the block to process
  • XBlock The block structure containing neighbor information
  • z The variable to be refined

function fillRight

CUDA kernel to fill the right halo region of blocks in parallel.

template<class T>
__global__ void fillRight (
    int halowidth,
    int * active,
    int * level,
    int * rightbot,
    int * righttop,
    int * leftbot,
    int * botleft,
    int * topleft,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • active The array of active block indices
  • level The array of block levels
  • rightbot The array of right bottom neighbor block indices
  • righttop The array of right top neighbor block indices
  • leftbot The array of left bottom neighbor block indices
  • botleft The array of bottom left neighbor block indices
  • topleft The array of top left neighbor block indices
  • a The variable to be refined

Template parameters:

  • T The data type of the variable (e.g., float, double)

function fillRightFlux

Function to fill the right halo region of a block, handling various neighbor configurations.

template<class T>
void fillRightFlux (
    Param XParam,
    bool doProlongation,
    int ib,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The parameters of the grid and blocks
  • doProlongation Flag indicating whether to perform prolongation
  • ib The index of the current block
  • XBlock The block structure containing neighbor information
  • z The variable to be refined

Template parameters:

  • T The data type of the variable (e.g., float, double)

function fillRightFlux

CUDA kernel to fill the right halo region of blocks in parallel for flux variables, handling various neighbor configurations.

template<class T>
__global__ void fillRightFlux (
    int halowidth,
    bool doProlongation,
    int * active,
    int * level,
    int * rightbot,
    int * righttop,
    int * leftbot,
    int * botleft,
    int * topleft,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • doProlongation Flag indicating whether to perform prolongation
  • active The array of active block indices
  • level The array of block levels
  • rightbot The array of right bottom neighbor block indices
  • righttop The array of right top neighbor block indices
  • leftbot The array of left bottom neighbor block indices
  • botleft The array of bottom left neighbor block indices
  • topleft The array of top left neighbor block indices
  • a The variable to be refined
  • T The data type of the variable (e.g., float, double)

function fillRightnew

CUDA kernel to fill the right halo region of blocks in parallel (new version).

template<class T>
__global__ void fillRightnew (
    int halowidth,
    int nblk,
    int * active,
    int * level,
    int * rightbot,
    int * righttop,
    int * leftbot,
    int * botleft,
    int * topleft,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • nblk The number of active blocks
  • active The array of active block indices
  • level The array of block levels
  • rightbot The array of right bottom neighbor block indices
  • righttop The array of right top neighbor block indices
  • leftbot The array of left bottom neighbor block indices
  • botleft The array of bottom left neighbor block indices
  • topleft The array of top left neighbor block indices
  • a The variable to be refined

Template parameters:

  • T The data type of the variable (e.g., float, double)

function fillTop

Fills the top halo region of a block, handling various neighbor configurations.

template<class T>
void fillTop (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The parameters of the grid/block structure
  • ib The index of the current block
  • XBlock The block structure containing neighbor information
  • z The variable to be refined
  • T The data type of the variable (e.g., float, double)

function fillTop

CUDA kernel to fill the top halo region of blocks in parallel for new refinement, handling various neighbor configurations, new version.

template<class T>
__global__ void fillTop (
    int halowidth,
    int * active,
    int * level,
    int * topleft,
    int * topright,
    int * botleft,
    int * leftbot,
    int * rightbot,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • active The array of active block indices
  • level The array of block levels
  • topleft The array of top left neighbor block indices
  • topright The array of top right neighbor block indices
  • botleft The array of bottom left neighbor block indices
  • leftbot The array of left bottom neighbor block indices
  • rightbot The array of right bottom neighbor block indices
  • a The variable to be refined
  • T The data type of the variable (e.g., float, double)

function fillTopFlux

Function to fill the top halo region of a block for new refinement, handling various neighbor configurations.

template<class T>
void fillTopFlux (
    Param XParam,
    bool doProlongation,
    int ib,
    BlockP < T > XBlock,
    T *& z
) 

Parameters:

  • XParam The parameters of the grid and blocks
  • doProlongation Flag indicating whether to perform prolongation
  • ib The index of the block to be processed
  • XBlock The structure containing block neighbor information
  • z The variable to be refined

Template parameters:

  • T The data type of the variable (e.g., float, double)

function fillTopFlux

CUDA kernel to fill the top halo region of blocks in parallel for new refinement, handling various neighbor configurations, new version.

template<class T>
__global__ void fillTopFlux (
    int halowidth,
    bool doProlongation,
    int * active,
    int * level,
    int * topleft,
    int * topright,
    int * botleft,
    int * leftbot,
    int * rightbot,
    T * a
) 

Parameters:

  • halowidth The width of the halo region
  • doProlongation Flag indicating whether to perform prolongation
  • active The array of active block indices
  • level The array of block levels
  • topleft The array of top left neighbor block indices
  • topright The array of top right neighbor block indices
  • botleft The array of bottom left neighbor block indices
  • leftbot The array of left bottom neighbor block indices
  • rightbot The array of right bottom neighbor block indices
  • a The variable to be refined
  • T The data type of the variable (e.g., float, double)

function fillTopnew

template<class T>
__global__ void fillTopnew (
    int halowidth,
    int nblk,
    int * active,
    int * level,
    int * topleft,
    int * topright,
    int * botleft,
    int * leftbot,
    int * rightbot,
    T * a
) 

function refine_linear

Wrapping function for refining all sides of active blocks using linear reconstruction.

template<class T>
void refine_linear (
    Param XParam,
    BlockP < T > XBlock,
    T * z,
    T * dzdx,
    T * dzdy
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to be refined
  • dzdx The gradient of z in the x direction
  • dzdy The gradient of z in the y direction

Template parameters:

  • T The data type (float or double)

function refine_linearGPU

Wrapping function for refining all sides of active blocks using linear reconstruction on GPU.

template<class T>
void refine_linearGPU (
    Param XParam,
    BlockP < T > XBlock,
    T * z,
    T * dzdx,
    T * dzdy
) 

Parameters:

  • XParam The model parameters
  • XBlock The block structure containing the block information
  • z The variable to be refined
  • dzdx The gradient of z in the x direction
  • dzdy The gradient of z in the y direction

Template parameters:

  • T The data type (float or double)

function refine_linear_Bot

template<class T>
void refine_linear_Bot (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T * z,
    T * dzdy
) 

function refine_linear_Left

Refine a block on the left side using linear reconstruction.

template<class T>
void refine_linear_Left (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T * z,
    T * dzdx,
    T * dzdy
) 

Description

This function refines a block on the left side using linear reconstruction. It checks if the neighboring block on the left is at a coarser level. If so, it calculates the new values for the left boundary of the current block using the gradients in the x and y directions. The new values are computed based on the distance to the neighboring block and the gradients, ensuring a smooth transition between different resolution levels.

Parameters:

  • XParam The model parameters
  • ib The index of the current block
  • XBlock The block structure containing the block information
  • z The variable to be refined
  • dzdx The gradient of z in the x direction
  • dzdy The gradient of z in the y direction

Template parameters:

  • T The data type (float or double)

function refine_linear_Right

template<class T>
void refine_linear_Right (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T * z,
    T * dzdx
) 

function refine_linear_Top

template<class T>
void refine_linear_Top (
    Param XParam,
    int ib,
    BlockP < T > XBlock,
    T * z,
    T * dzdy
) 


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