Skip to content

File AdaptCriteria.cu

FileList > src > AdaptCriteria.cu

Go to the source code of this file

  • #include "AdaptCriteria.h"

Public Functions

Type Name
int AdaptCriteria (Param XParam, Forcing< float > XForcing, Model< T > XModel)
Selects and applies the adaptation criteria for mesh refinement/coarsening.
template int AdaptCriteria< double > (Param XParam, Forcing< float > XForcing, Model< double > XModel)
template int AdaptCriteria< float > (Param XParam, Forcing< float > XForcing, Model< float > XModel)
int Thresholdcriteria (Param XParam, T threshold, T * z, BlockP< T > XBlock, bool * refine, bool * coarsen)
Applies threshold-based adaptation criteria for mesh refinement/coarsening.
template int Thresholdcriteria< double > (Param XParam, double threshold, double * z, BlockP< double > XBlock, bool * refine, bool * coarsen)
template int Thresholdcriteria< float > (Param XParam, float threshold, float * z, BlockP< float > XBlock, bool * refine, bool * coarsen)
int inrangecriteria (Param XParam, T zmin, T zmax, T * z, BlockP< T > XBlock, bool * refine, bool * coarsen)
Applies in-range adaptation criteria for mesh refinement/coarsening.
template int inrangecriteria< double > (Param XParam, double zmin, double zmax, double * z, BlockP< double > XBlock, bool * refine, bool * coarsen)
template int inrangecriteria< float > (Param XParam, float zmin, float zmax, float * z, BlockP< float > XBlock, bool * refine, bool * coarsen)
int targetlevelcriteria (Param XParam, StaticForcingP< int > targetlevelmap, BlockP< T > XBlock, bool * refine, bool * coarsen)
Applies target level adaptation criteria for mesh refinement/coarsening.
template int targetlevelcriteria< double > (Param XParam, StaticForcingP< int > targetlevelmap, BlockP< double > XBlock, bool * refine, bool * coarsen)
template int targetlevelcriteria< float > (Param XParam, StaticForcingP< int > targetlevelmap, BlockP< float > XBlock, bool * refine, bool * coarsen)

Public Functions Documentation

function AdaptCriteria

Selects and applies the adaptation criteria for mesh refinement/coarsening.

template<class T>
int AdaptCriteria (
    Param XParam,
    Forcing < float > XForcing,
    Model < T > XModel
) 

Template parameters:

  • T Data type

Parameters:

Returns:

Success flag (0 or 1)

This function chooses the adaptation method ("Threshold", "Inrange", "Targetlevel") based on XParam.AdaptCrit, and applies it to the mesh using the corresponding criteria function. It sets the refine/coarsen flags for each block according to the selected method and arguments. For "Targetlevel", it loops over all target adaptation maps.


function AdaptCriteria< double >

template int AdaptCriteria< double > (
    Param XParam,
    Forcing < float > XForcing,
    Model < double > XModel
) 

function AdaptCriteria< float >

template int AdaptCriteria< float > (
    Param XParam,
    Forcing < float > XForcing,
    Model < float > XModel
) 

function Thresholdcriteria

Applies threshold-based adaptation criteria for mesh refinement/coarsening.

template<class T>
int Thresholdcriteria (
    Param XParam,
    T threshold,
    T * z,
    BlockP < T > XBlock,
    bool * refine,
    bool * coarsen
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • threshold Threshold value for adaptation
  • z Array of variable values (e.g., water depth)
  • XBlock Block data structure
  • refine Array of refinement flags
  • coarsen Array of coarsening flags

Returns:

Success flag (0 or 1)

Refines blocks where any cell value exceeds the threshold, coarsens otherwise.

Threshold criteria is a general form of wet dry criteria. Simple wet/dry refining criteria. If the block is wet -> refine is true. If the block is dry -> coarsen is true.

Warning:

the refinement sanity check is meant to be done after running this function.


function Thresholdcriteria< double >

template int Thresholdcriteria< double > (
    Param XParam,
    double threshold,
    double * z,
    BlockP < double > XBlock,
    bool * refine,
    bool * coarsen
) 

function Thresholdcriteria< float >

template int Thresholdcriteria< float > (
    Param XParam,
    float threshold,
    float * z,
    BlockP < float > XBlock,
    bool * refine,
    bool * coarsen
) 

function inrangecriteria

Applies in-range adaptation criteria for mesh refinement/coarsening.

template<class T>
int inrangecriteria (
    Param XParam,
    T zmin,
    T zmax,
    T * z,
    BlockP < T > XBlock,
    bool * refine,
    bool * coarsen
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • zmin Minimum value for refinement
  • zmax Maximum value for refinement
  • z Array of variable values
  • XBlock Block data structure
  • refine Array of refinement flags
  • coarsen Array of coarsening flags

Returns:

Success flag (0 or 1)

Refines blocks where any cell value is within [zmin, zmax], coarsens otherwise.

Simple in-range refining criteria. If any value of z (could be any variable) is zmin <= z <= zmax the block will try to refine. Otherwise, the block will try to coarsen.

Warning:

the refinement sanity check is meant to be done after running this function.


function inrangecriteria< double >

template int inrangecriteria< double > (
    Param XParam,
    double zmin,
    double zmax,
    double * z,
    BlockP < double > XBlock,
    bool * refine,
    bool * coarsen
) 

function inrangecriteria< float >

template int inrangecriteria< float > (
    Param XParam,
    float zmin,
    float zmax,
    float * z,
    BlockP < float > XBlock,
    bool * refine,
    bool * coarsen
) 

function targetlevelcriteria

Applies target level adaptation criteria for mesh refinement/coarsening.

template<class T>
int targetlevelcriteria (
    Param XParam,
    StaticForcingP < int > targetlevelmap,
    BlockP < T > XBlock,
    bool * refine,
    bool * coarsen
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • targetlevelmap Map of target levels for adaptation
  • XBlock Block data structure
  • refine Array of refinement flags
  • coarsen Array of coarsening flags

Returns:

Success flag (0 or 1)

Refines blocks where target level is greater than current, coarsens if equal or lower.


function targetlevelcriteria< double >

template int targetlevelcriteria< double > (
    Param XParam,
    StaticForcingP < int > targetlevelmap,
    BlockP < double > XBlock,
    bool * refine,
    bool * coarsen
) 

function targetlevelcriteria< float >

template int targetlevelcriteria< float > (
    Param XParam,
    StaticForcingP < int > targetlevelmap,
    BlockP < float > XBlock,
    bool * refine,
    bool * coarsen
) 


The documentation for this class was generated from the following file src/AdaptCriteria.cu