Skip to content

File Spherical.cu

FileList > src > Spherical.cu

Go to the source code of this file

  • #include "Spherical.h"

Public Functions

Type Name
__host__ __device__ T calcCM (T Radius, T delta, T yo, int iy)
Calculate the scale factor for the y face length in a spherical model. This function computes the scale factor based on the sphere's radius, grid spacing, origin offset, and index in the y direction. Scale factor for y face length (x face lengh scale is always 1 in spherical model assuming that lat long are entered)
template __host__ __device__ double calcCM (double Radius, double delta, double yo, int iy)
template __host__ __device__ float calcCM (float Radius, float delta, float yo, int iy)
__host__ __device__ T calcFM (T Radius, T delta, T yo, T iy)
Calculate the scale factor for the y face length in a spherical model. This function computes the scale factor based on the sphere's radius, grid spacing, origin offset and index in the y direction. Scale factor for y face length (x face lengh scale is always 1 in spherical model assuming that lat long are entered)
template __host__ __device__ double calcFM (double Radius, double delta, double yo, double iy)
template __host__ __device__ float calcFM (float Radius, float delta, float yo, float iy)
__host__ __device__ T haversin (T Radius, T lon1, T lat1, T lon2, T lat2)
Classic Haversine formula to calculate great-circle distance between two points on a sphere. The function is too slow to use directly in BG_flood engine but is more usable (i.e. naive) for model setup.
__host__ __device__ T spharea (T Radius, T lon, T lat, T dx)
Calculate the surface area of a spherical cap.
template __host__ __device__ double spharea (double Radius, double lon, double lat, double dx)
template __host__ __device__ float spharea (float Radius, float lon, float lat, float dx)

Public Functions Documentation

function calcCM

Calculate the scale factor for the y face length in a spherical model. This function computes the scale factor based on the sphere's radius, grid spacing, origin offset, and index in the y direction. Scale factor for y face length (x face lengh scale is always 1 in spherical model assuming that lat long are entered)

template<class T>
__host__ __device__ T calcCM (
    T Radius,
    T delta,
    T yo,
    int iy
) 

Parameters:

  • Radius Radius of the sphere
  • delta Grid spacing
  • yo Origin offset in the y direction
  • iy Index in the y direction

function calcCM

template __host__ __device__ double calcCM (
    double Radius,
    double delta,
    double yo,
    int iy
) 

function calcCM

template __host__ __device__ float calcCM (
    float Radius,
    float delta,
    float yo,
    int iy
) 

function calcFM

Calculate the scale factor for the y face length in a spherical model. This function computes the scale factor based on the sphere's radius, grid spacing, origin offset and index in the y direction. Scale factor for y face length (x face lengh scale is always 1 in spherical model assuming that lat long are entered)

template<class T>
__host__ __device__ T calcFM (
    T Radius,
    T delta,
    T yo,
    T iy
) 

Parameters:

  • Radius Radius of the sphere
  • delta Grid spacing
  • yo Origin offset in the y direction
  • iy Index in the y direction

function calcFM

template __host__ __device__ double calcFM (
    double Radius,
    double delta,
    double yo,
    double iy
) 

function calcFM

template __host__ __device__ float calcFM (
    float Radius,
    float delta,
    float yo,
    float iy
) 

function haversin

Classic Haversine formula to calculate great-circle distance between two points on a sphere. The function is too slow to use directly in BG_flood engine but is more usable (i.e. naive) for model setup.

template<class T>
__host__ __device__ T haversin (
    T Radius,
    T lon1,
    T lat1,
    T lon2,
    T lat2
) 

Parameters:

  • Radius Radius of the sphere
  • lon1 Longitude of the first point (in degrees)
  • lat1 Latitude of the first point (in degrees)
  • lon2 Longitude of the second point (in degrees)
  • lat2 Latitude of the second point (in degrees)

Returns:

Great-circle distance between the two points


function spharea

Calculate the surface area of a spherical cap.

template<class T>
__host__ __device__ T spharea (
    T Radius,
    T lon,
    T lat,
    T dx
) 

Template parameters:

  • T Data type (float or double)

Parameters:

  • Radius Radius of the sphere
  • lon Longitude of the center of the cap (in degrees)
  • lat Latitude of the center of the cap (in degrees)
  • dx Grid spacing (in degrees)

Returns:

Surface area of the spherical cap


function spharea

template __host__ __device__ double spharea (
    double Radius,
    double lon,
    double lat,
    double dx
) 

function spharea

template __host__ __device__ float spharea (
    float Radius,
    float lon,
    float lat,
    float dx
) 


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