Domains
GraviPet.Domains.Domain
— Typeabstract type Domain{T}
A computational domain of type T
. The domain of a function is the type of its argument(s). For example, Domain{Float64}
would describe a one-dimensional domain, and Domain{SVector{3,Float64}}
would describe a three-dimensional domain.
This type can also describe a codomain, i.e. the result type of a function. A codomain of Domain{Float64}
describes a scalar function, and a codomain of Domain{SVector{3,Float64}}
describes a vector-valued function.
GraviPet.Domains.expanded
— Methodexpanded(dom::Domain, delta)::Domain
expanded(dom::Domain, delta_lo, delta_hi)::Domain
Expand the domain dom
. The lower and upper domain bounds are moved by either delta
, or delta_lo
and delta_hi
, respectively. Positive deltas enlarge the domain, negative values shrink it. Domains must be non-empty.
expanded(dom, delta)
is equivalent to expanded(dom, delta, delta)
.
See also shifted
.
GraviPet.Domains.shifted
— Methodshifted(dom::Domain, shift)::Domain
Shift the domain dom
by moving both domain bounds in the same direction. This does not change the size of the domain.
shfited(dom, shift)
is equivalent to expanded(dom, -shift, +shift)
.
See also expanded
.
Intervals
GraviPet.Intervals.Interval
— Typestruct Interval{T} <: Domain{T}
A one-dimensional Domain
, i.e. an interval. T
should be a real-valued scalar type such as Float64
.
GraviPet.Intervals.Interval
— MethodInterval{T}(first::Real, last::Real)
Interval(first::Real, last::Real)
Create an interval with the specified bounds. The bounds can be infinity. The constraint first < last
must hold.
GraviPet.Intervals.Interval
— MethodInterval{T}()
Create a zero-valued interval, i.e. an interval where both lower and upper bounds are zero. This is also a convenient way to provide a "skeleton" for a domain without having to specify any bounds.
Boxes
GraviPet.Boxes.Box
— Typestruct Box{D,T} <: Domain{SVector{D,T}}
A multi-dimensional Domains.Domain
, i.e. a box or hyper-rectangle. The number of dimensions D
must be a non-negative integer. T
should be a real-valued scalar type such as Float64
. The domain's element type is SVector{D,T}
.
Zero-dimensional and one-dimensional domains are supported. Zero-dimensional domains contain only a single point (the origin). One-dimensional domains correspond to intervals (see Interval
).
GraviPet.Boxes.Box
— MethodBox{D,T}(first::SVector{D}, last::SVector{D})
Box(first::SVector{D}, last::SVector{D})
Create a box domain with the specified lower and upper bounds. The bounds are given as vectors, and (some of) their elements can be infinity. The constraint first < last
must hold in each dimension.
GraviPet.Boxes.Box
— MethodBox{D,T}()
Create a zero-valued box domain, i.e. a box where both lower and upper bounds are zero. This is also a convenient way to provide a "skeleton" for a domain without having to specify any bounds.