Basic Grids

CompositeGrids.SimpleGModule

Basic grids including common grids like arbitrary grids, uniform grids, log grids, and optimized grids like barycheb for interpolation and gausslegendre for integration.

source
CompositeGrids.SimpleG.ArbitraryType
struct Arbitrary{T<:AbstractFloat} <: AbstractGrid

Arbitrary grid generated from given sorted grid.

#Members:

  • bound : boundary of the grid
  • size : number of grid points
  • grid : grid points
  • weight : integration weight

#Constructor:

  • function Arbitrary{T}(grid) where {T<:AbstractFloat}
source
CompositeGrids.SimpleG.BaryChebType
struct BaryCheb{T<:AbstractFloat} <: AbstractGrid

BaryCheb grid generated on [bound[1], bound[2]] with order N.

#Members:

  • bound : boundary of the grid
  • size : number of grid points
  • grid : grid points
  • weight : interpolation weight

#Constructor:

  • function BaryCheb{T}(bound, size) where {T<:AbstractFloat}
source
CompositeGrids.SimpleG.GaussLegendreType
struct GaussLegendre{T<:AbstractFloat} <: AbstractGrid

GaussLegendre grid generated on [bound[1], bound[2]] with order N.

#Members:

  • bound : boundary of the grid
  • size : number of grid points
  • grid : grid points
  • weight : integration weight

#Constructor:

  • function GaussLegendre{T}(bound, size) where {T<:AbstractFloat}
source
CompositeGrids.SimpleG.LogType
struct Log{T<:AbstractFloat} <: AbstractGrid

Log grid generated on [bound[1], bound[2]] with N grid points. Minimal interval is set to be minterval. Dense to sparse if d2s, vice versa.

On [0, 1], a typical d2s Log grid looks like [0, λ^(N-1), ..., λ^2, λ, 1].

#Members:

  • bound : boundary of the grid

  • size : number of grid points

  • grid : grid points

  • weight : integration weight

  • λ : scale parameter

  • d2s : dense to sparse or not

#Constructor:

  • function Log{T}(bound, size, minterval, d2s) where {T<:AbstractFloat}
source
CompositeGrids.SimpleG.UniformType
struct Uniform{T<:AbstractFloat} <: AbstractGrid

Uniform grid generated on [bound[1], bound[2]] with N points

#Members:

  • bound : boundary of the grid
  • size : number of grid points
  • grid : grid points
  • weight : integration weight

#Constructor:

  • function Uniform{T}(bound, size) where {T<:AbstractFloat}
source
Base.floorMethod
function Base.floor(grid::AbstractGrid, x) #where {T}

use basic searchsorted function to find the index of largest grid point smaller than x.

return 1 for x<grid[1] and grid.size-1 for x>grid[end].

source
Base.floorMethod
function Base.floor(grid::Log{T}, x) where {T}

find the index of largest grid point smaller than x.

return 1 for x<grid[1] and grid.size-1 for x>grid[end].

source
Base.floorMethod
function Base.floor(grid::Uniform{T}, x) where {T}

find the index of largest grid point smaller than x.

return 1 for x<grid[1] and grid.size-1 for x>grid[end].

source
Base.showMethod
show(io::IO, grid::AbstractGrid)

Write a text representation of the AbstractGrid grid to the output stream io.

source