QuantEcon / SimpleDifferentialOperators.jl

Library for simple upwind finite differences
MIT License
12 stars 2 forks source link

Modify types for the MixedBoundaryCondition #142

Closed jlperla closed 5 years ago

jlperla commented 5 years ago

https://github.com/QuantEcon/SimpleDifferentialOperators.jl/blob/master/src/types.jl#L8

Add in a new

    struct DefaultFirstDifference <: DifferenceMethod{1} end

Type:

    struct Mixed{T, T2} <: HomogeneousBoundaryCondition where {T <: Real, T2 <: DifferenceMethod{1}}
        ξ::T
        direction::T2 
    end

To construct

Mixed(1.0, ForwardFirstDifference())
Mixed( ξ = 1.0, direction = ForwardFirstDifference())
Mixed( ξ = 1.0) # defaults to `direction = DefaultFirstDifference

Add in defaults, etc. with https://github.com/mauro3/Parameters.jl using @with_kw

jlperla commented 5 years ago

Figure out the multiple dispatch as well to get specialized functions.