Skip to content

File GridManip.h

FileList > src > GridManip.h

Go to the source code of this file

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

Public Functions

Type Name
void Copy2CartCPU (int nx, int ny, T * dest, T * src)
Copy values from source to destination for a Cartesian grid.
void CopyArrayBUQ (Param XParam, BlockP< F > XBlock, T * source, T *& dest)
Copy values from source array to destination array for all blocks.
void CopyArrayBUQ (Param XParam, BlockP< T > XBlock, EvolvingP< T > source, EvolvingP< T > & dest)
Copy all evolving variables from source to destination.
void CopyArrayBUQ (Param XParam, BlockP< T > XBlock, EvolvingP< T > source, EvolvingP_M< T > & dest)
Copy all evolving variables and compute derived quantities (U, hU).
void InitArrayBUQ (Param XParam, BlockP< F > XBlock, T initval, T *& Arr)
Initialize a block-structured array with a given value.
void InitBlkBUQ (Param XParam, BlockP< F > XBlock, T initval, T *& Arr)
Initialize a block-level array with a given value.
void InterpstepCPU (int nx, int ny, int hdstep, F totaltime, F hddt, T *& Ux, T * Uo, T * Un)
CPU routine for time interpolation of solution arrays.
__global__ void InterpstepGPU (int nx, int ny, T totaltime, T beforetime, T aftertime, T * Ux, T * Uo, T * Un)
GPU kernel for time interpolation of solution arrays.
void interp2BUQ (Param XParam, BlockP< T > XBlock, std::vector< StaticForcingP< float > > forcing, T * z)
Interpolate values from multiple forcing maps to block array using bilinear interpolation.
void interp2BUQ (Param XParam, BlockP< T > XBlock, F forcing, T *& z)
Interpolate values from forcing map to block array using bilinear interpolation.
T interp2BUQ (T x, T y, F forcing)
Bilinear interpolation for value at (x, y) from forcing map.
T interp2BUQ (T x, T y, T dx, F forcing)
Interpolate value at (x, y) using either bilinear or blockmean interpolation.
void setedges (Param XParam, BlockP< T > XBlock, T *& zb)
Set edge values for bathymetry array at domain boundaries.

Public Functions Documentation

function Copy2CartCPU

Copy values from source to destination for a Cartesian grid.

template<class T>
void Copy2CartCPU (
    int nx,
    int ny,
    T * dest,
    T * src
) 

Copies all values from src to dest for a regular Cartesian grid.

Template parameters:

  • T Data type

Parameters:

  • nx Number of x grid points
  • ny Number of y grid points
  • dest Destination array
  • src Source array

function CopyArrayBUQ

Copy values from source array to destination array for all blocks.

template<class T, class F>
void CopyArrayBUQ (
    Param XParam,
    BlockP < F > XBlock,
    T * source,
    T *& dest
) 

Copies all elements for each active block from source to dest.

Template parameters:

  • T Data type
  • F Block type

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • source Source array
  • dest Destination array

function CopyArrayBUQ

Copy all evolving variables from source to destination.

template<class T>
void CopyArrayBUQ (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > source,
    EvolvingP < T > & dest
) 

Copies h, u, v, zs arrays for all blocks.

Template parameters:

  • T Data type

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • source Source evolving variables
  • dest Destination evolving variables

function CopyArrayBUQ

Copy all evolving variables and compute derived quantities (U, hU).

template<class T>
void CopyArrayBUQ (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > source,
    EvolvingP_M < T > & dest
) 

Copies h, u, v, zs arrays and computes U and hU for all blocks.

Template parameters:

  • T Data type

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • source Source evolving variables
  • dest Destination evolving variables (with derived quantities)

function InitArrayBUQ

Initialize a block-structured array with a given value.

template<class T, class F>
void InitArrayBUQ (
    Param XParam,
    BlockP < F > XBlock,
    T initval,
    T *& Arr
) 

Sets all elements of Arr for each active block to initval.

Template parameters:

  • T Data type (float, double, int, bool)
  • F Block type

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • initval Value to initialize
  • Arr Array to initialize

function InitBlkBUQ

Initialize a block-level array with a given value.

template<class T, class F>
void InitBlkBUQ (
    Param XParam,
    BlockP < F > XBlock,
    T initval,
    T *& Arr
) 

Sets each block's entry in Arr to initval.

Template parameters:

  • T Data type
  • F Block type

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • initval Value to initialize
  • Arr Array to initialize

function InterpstepCPU

CPU routine for time interpolation of solution arrays.

template<class T, class F>
void InterpstepCPU (
    int nx,
    int ny,
    int hdstep,
    F totaltime,
    F hddt,
    T *& Ux,
    T * Uo,
    T * Un
) 

Interpolates between Uo and Un to compute Ux at a given time step.

Template parameters:

  • T Data type
  • F Time type

Parameters:

  • nx Number of x grid points
  • ny Number of y grid points
  • hdstep Time step index
  • totaltime Total simulation time
  • hddt Time step size
  • Ux Output array
  • Uo Previous solution array
  • Un Next solution array

function InterpstepGPU

GPU kernel for time interpolation of solution arrays.

template<class T>
__global__ void InterpstepGPU (
    int nx,
    int ny,
    T totaltime,
    T beforetime,
    T aftertime,
    T * Ux,
    T * Uo,
    T * Un
) 

Interpolates between Uo and Un to compute Ux at a given time using shared memory.

Template parameters:

  • T Data type

Parameters:

  • nx Number of x grid points
  • ny Number of y grid points
  • totaltime Total simulation time
  • beforetime Previous time
  • aftertime Next time
  • Ux Output array
  • Uo Previous solution array
  • Un Next solution array

function interp2BUQ

Interpolate values from multiple forcing maps to block array using bilinear interpolation.

template<class T>
void interp2BUQ (
    Param XParam,
    BlockP < T > XBlock,
    std::vector< StaticForcingP < float > > forcing,
    T * z
) 

Fills z array for each block using bilinear interpolation from multiple forcing maps.

Template parameters:

  • T Data type

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • forcing Vector of forcing maps
  • z Output array

function interp2BUQ

Interpolate values from forcing map to block array using bilinear interpolation.

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

Fills z array for each block using bilinear interpolation from forcing map(s).

Template parameters:

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • forcing Forcing map(s)
  • z Output array

function interp2BUQ

Bilinear interpolation for value at (x, y) from forcing map.

template<class T, class F>
T interp2BUQ (
    T x,
    T y,
    F forcing
) 

Performs bilinear interpolation using surrounding grid points in forcing map.

Template parameters:

Parameters:

  • x X coordinate
  • y Y coordinate
  • forcing Forcing map

Returns:

Interpolated value


function interp2BUQ

Interpolate value at (x, y) using either bilinear or blockmean interpolation.

template<class T, class F>
T interp2BUQ (
    T x,
    T y,
    T dx,
    F forcing
) 

Chooses interpolation method based on grid spacing dx.

Template parameters:

Parameters:

  • x X coordinate
  • y Y coordinate
  • dx Grid spacing
  • forcing Forcing map

Returns:

Interpolated value


function setedges

Set edge values for bathymetry array at domain boundaries.

template<class T>
void setedges (
    Param XParam,
    BlockP < T > XBlock,
    T *& zb
) 

Copies values from interior to boundary cells for blocks with no neighbor.

Template parameters:

  • T Data type

Parameters:

  • XParam Simulation parameters
  • XBlock Block parameters
  • zb Bathymetry array


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