DistributedSparseGrids.AHSG
— Typeconst AHSG{N,HCP} = AdaptiveHierarchicalSparseGrid{N,HCP}
Shortcut for AdaptiveHierarchicalSparseGrid
DistributedSparseGrids.AbstractHierarchicalSparseGrid
— TypeAbstractHierarchicalSparseGrid{N,HCP}
Abstract Type
N
: Dimension of hierarchical sparse grid HCP<:AbstractHierarchicalCollocationPoint
: Collocation point type
DistributedSparseGrids.AbstractSparseGrid
— TypeAbstractSparseGrid{N}
Abstract Type
N
: Dimension of hierarchical sparse grid
DistributedSparseGrids.AdaptiveHierarchicalSparseGrid
— TypeAdaptiveHierarchicalSparseGrid{N,HCP}
Container for hierarchical collocation points
Fields
cpts::Vector{PointDict{N,HCP}}
: DistributedSparseGrids.PointDict
with collocation points pointSetProperties::SVector{N,Int}
: Vector containing all pointset properties.
Pointset properties = [psp1,...,pspN], psp_i in [1,2,3,4]. 1=>closed point set
, 2=>open point set
, 3=>left-open point set
, 4=>right-open point set
.
DistributedSparseGrids.CollocationPoint
— TypeCollocationPoint{N,CT} <: AbstractCollocationPoint{N,CT}
A collocation point.
Fields
i_multi::SVector{N,Int}
: The i-th item of this Vector represents to the level of the collocation point in the i-th dimension. pt_idx::SVector{N,Int}
: The i-th item of this Vector represents to the point index of the collocation point in the i-th dimension. coords::SVector{N,CT}
: Coordinates of the collocation point. interv::SVector{N,SVector{2,CT}}
: The i-th item of the Vector defines the non-zero interval of the associated basis function in the i-th dimension.
DistributedSparseGrids.HierarchicalCollocationPoint
— TypeHierarchicalCollocationPoint{N,CP,RT} <: AbstractHierarchicalCollocationPoint{N,CP,RT}
A collocation point.
Fields
cpt::CP
: DistributedSparseGrids.CollocationPoint
children::SVector{N,SVector{2,HierarchicalCollocationPoint{N,CP,RT}}}
: Container for at most two children per dimension parents::SVector{N,HierarchicalCollocationPoint{N,CP,RT}}
: Container for parents fval::RT
: Function Value scaling_weight::RT
: Scaling Weight (function value minus l-1 level interpolator both at cpt.coords)
DistributedSparseGrids.PointDict
— TypePointDict{ N, HCP <: AbstractHierarchicalCollocationPoint{N}}
Typedef for Dict{SVector{N,Int},Dict{SVector{N,Int},HCP}}
N
: Dimension of hierarchical sparse grid HCP<:AbstractHierarchicalCollocationPoint
: Collocation point type
DistributedSparseGrids.distributed_init_weights!
— Methoddistributed_init_weights!(asg::SG, cpts::AbstractVector{HCP}, fun::F, worker_ids::Vector{Int})
Computes all weights in cpts
on all workers in worker_ids
.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse gridcpts::AbstractVector{HCP}
: all weights of the collocation points incpts
will be (re-)calculated.fun
::Function to be interpolated.worker_ids
: All available workers (can be added viausing Distributed; addprocs(...)
).
DistributedSparseGrids.distributed_init_weights!
— Methoddistributed_init_weights!(asg::SG, fun::F, worker_ids::Vector{Int})
Computes all weights in asg
on all workers in worker_ids
.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse gridfun
::Function to be interpolated.worker_ids
: All available workers (can be added viausing Distributed; addprocs(...)
).
DistributedSparseGrids.distributed_init_weights_inplace_ops!
— Methoddistributed_init_weights_inplace_ops!(asg::SG, cpts::AbstractVector{HCP}, fun::F, worker_ids::Vector{Int})
Computes all weights in cpts
on all workers in worker_ids
. In-place functions mul!(::RT,::RT)
,mul!(::RT,::Float64)
,add!(::RT,::RT)
have to be defined.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse gridcpts::AbstractVector{HCP}
: all weights of the collocation points incpts
will be (re-)calculated.fun
::Function to be interpolated.worker_ids
: All available workers (can be added viausing Distributed; addprocs(...)
).
DistributedSparseGrids.distributed_init_weights_inplace_ops!
— Methoddistributed_init_weights_inplace_ops!(asg::SG, fun::F, worker_ids::Vector{Int})
(Re-)computes all weights in asg
on all workers in worker_ids
. In-place functions mul!(::RT,::RT)
,mul!(::RT,::Float64)
,add!(::RT,::RT)
have to be defined.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse gridfun
::Function to be interpolated.worker_ids
: All available workers (can be added viausing Distributed; addprocs(...)
).
DistributedSparseGrids.generate_next_level!
— Methodgenerate_next_level!(asg::AHSG{N,HCP}) where {N,HCP<:AbstractHierarchicalCollocationPoint{N}}
Generates all collocation point of the next hierarchical level.
Constructor
asg::AHSG{N,HCP}
: sparse grid
DistributedSparseGrids.generate_next_level!
— Methodgenerate_next_level!(asg::AHSG{N,HCP}, tol::CT,maxlvl::Int) where {N,CT,CP<:AbstractCollocationPoint{N,CT},HCP<:AbstractHierarchicalCollocationPoint{N,CP}}
Adaptively generate all collocation point of the next hierarchical level, where norm(scaling_weight(cpt)) > tol && level(cpt)<maxlvl
.
Constructor
asg::AHSG{N,HCP}
: sparse gridtol::CT
: tolerancemaxlvl::Int
: maximum hierarchical level
DistributedSparseGrids.init
— Methodinit(::Type{AHSG{N,HCP}}, pointSetProperties::SVector{N,Int})
Initialize the sparse grid. Returns a N
-dimensional sparse grid where only the root point has been created.
Constructor
::Type{AHSG{N,HCP}}
: Define type ofDistributedSparseGrids.ASHG
pointSetProperties::SVector{N,Int}
: Vector containing all pointset properties.
Pointset properties = [psp1,...,pspN], psp_i in [1,2,3,4]. 1=>closed point set
, 2=>open point set
, 3=>left-open point set
, 4=>right-open point set.
Example
N = 1; pointprobs = @SVector [1]; RT = Float64; CT = Float64; CPType = CollocationPoint{N,CT}; HCPType = HierarchicalCollocationPoint{N,CPType,RT}; asg = init(AHSG{N,HCPType},pointprobs)
DistributedSparseGrids.init_weights!
— Methodinit_weights!(asg::SG, cpts::AbstractVector{HCP}, fun::F)
(Re-)Computes all weights in cpts
.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse gridcpts::AbstractVector{HCP}
: all weights of the collocation points incpts
will be (re-)calculated.fun
::Function to be interpolated.
DistributedSparseGrids.init_weights!
— Methodinit_weights!(asg::SG, fun::F)
(Re-)Computes all weights in asg
.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse gridfun
::Function to be interpolated.
DistributedSparseGrids.init_weights_inplace_ops!
— Methodinit_weights_inplace_ops!(asg::SG, cpts::AbstractVector{HCP}, fun::F)
(Re-)Computes all weights in cpts
with in-place operations. In-place functions mul!(::RT,::RT)
,mul!(::RT,::Float64)
,add!(::RT,::RT)
have to be defined.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse gridcpts::AbstractVector{HCP}
: all weights of the collocation points incpts
will be (re-)calculated.fun
::Function to be interpolated.
DistributedSparseGrids.init_weights_inplace_ops!
— Methodinit_weights_inplace_ops!(asg::SG, fun::F)
(Re-)Computes all weights in asg
with in-place operations. In-place functions mul!(::RT,::RT)
,mul!(::RT,::Float64)
,add!(::RT,::RT)
have to be defined.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: adaptive sparse grid
DistributedSparseGrids.integrate
— Methodintegrate(asg::SG) where {N,CP,RT,HCP<:AbstractHierarchicalCollocationPoint{N,CP,RT}, SG<:AbstractHierarchicalSparseGrid{N,HCP}}
Integrates the sparse grid. Returns an instance of RT.
Constructor
asg::SG
: adaptie sparse grid
DistributedSparseGrids.interpolate
— Methodinterpolate(asg::SG, x::VCT, stplvl::Int=numlevels(asg))
Interpolate at position x
.
Arguments
asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}
: initialized adaptive sparse gridcpts::Dict{SVector{N,Int},Dict{SVector{N,Int},HCP}}
: Dict cointaining all collocation points
DistributedSparseGrids.root_point
— Methodroot_point(::Type{CollocationPoint{N,CT}}) where {N,CT<:Real}
generates a root point.
Constructor
::Type{CollocationPoint{N,CT}}
: a colloction point of dimensionN
and collocation typeCT
.