Skip to content

package extensions and interoperability with different domain types #149

@daanhb

Description

@daanhb

At the start of DomainSets we identified a host of packages that did similar work (#14). There is an uncountable number of Julia packages defining a Point type!

The combination of package extensions with the improvements in DomainSets v0.7 towards domains-as-an-interface makes a lot more things possible. I'm experimenting with that in DomainSetsExtensions.jl. The mechanism of associating domains with "canonical domains" is essential here. It allows for automatic translation of types across packages.

Here is an example (works with master):

julia> using DomainSets, DomainSetsExtensions

julia> using Intervals, IntervalSets, GeometryBasics, Meshes

julia> d1 = Intervals.Interval(0.0, 1.0)
Intervals.Interval{Float64, Closed, Closed}(0.0, 1.0)

julia> d2 = IntervalSets.Interval(2.0, 3.0)
2.0 .. 3.0

julia> productdomain(d1, d2)
[0.0 .. 1.0] × (2.0 .. 3.0)

julia> isequaldomain( productdomain(d1, d2), Meshes.Box((0.0, 2.0), (1.0, 3.0)))
true

The code allows to combine domains of different types and different packages. It also automatically deduces that the cartesian product of an interval from Intervals.jl with an interval from IntervalSets.jl is equal to a Box as defined in Meshes.jl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions