# Public API Reference

This is an exhaustive list of all exported modules, constants, types, functions and macros in DomainSets.jl.

## Constants

DomainSets.AnyDomainType

AnyDomain is the union of Domain and DomainRef.

In both cases domain(d::AnyDomain) returns the domain itself.

## Functions

DomainSets.approx_inMethod

approx_in(x, domain::Domain [, tolerance])

Verify whether a point lies in the given domain with a certain tolerance.

The tolerance has to be positive. The meaning of the tolerance, in relation to the possible distance of the point to the domain, is domain-dependent. Usually, if the outcome is true, it means that the distance of the point to the domain is smaller than a constant times the tolerance. That constant may depend on the domain.

Up to inexact computations due to floating point numbers, it should also be the case that approx_in(x, d, 0) == in(x,d). This implies that approx_in reflects whether a domain is open or closed.

DomainSets.boundingboxMethod

Return a bounding box of the given domain.

A bounding box is an interval, a hyperrectangle or the full space. It is such that each point in the domain also lies in the bounding box.

DomainSets.canonicaldomainMethod
canonicaldomain([ctype::CanonicalType, ]d)

Return an associated canonical domain, if any, of the given domain.

For example, the canonical domain of an Interval [a,b] is the interval [-1,1].

Optionally, a canonical type argument may specify an alternative canonical domain. Canonical domains help with establishing equality between domains, with finding maps between domains and with finding parameterizations.

If a domain implements a canonical domain, it should also implement mapfrom_canonical and mapto_canonical.

DomainSets.checkdomainMethod

checkdomain(d)

Checks that d is a domain or refers to a domain and if so returns that domain, throws an error otherwise.

DomainSets.domaineltypeMethod
domaineltype(d)

The domaineltype of a continuous set is a valid type for elements of that set. By default it is equal to the eltype of d, which in turn defaults to Any.

DomainSets.equaldomainMethod
equaldomain(domain)

Return a canonical domain that is equal, but simpler. For example, a 1-dimensional ball is an interval. This function is equivalent to canonicaldomain(Equal(), d).

A domain and its equaldomain are always equal domains according to isequaldomain.

See also: canonicaldomain.

DomainSets.isequaldomainMethod
isequaldomain(d1, d2)

Are the two given domains equal?

Domains are considered equal if their membership functions return the same output for the same input.

It is not always possible to verify this automatically. If the result is true, then the domains are guaranteed to be equal. If the result is false, then either the domains are not equal or they are equal but the implementation fails to recognize this.

DomainSets.mapfrom_canonicalMethod
mapfrom_canonical(d[, x])

Return a map to a domain d from its canonical domain.

If a second argument x is given, the map is evaluated at that point. The point x should be a point in the canonical domain of d, and the result is a point in d.

DomainSets.maptoMethod
mapto(d1, d2)

Return a map from domain d1 to domain d2.

DomainSets.mapto_canonicalMethod
mapto_canonical(d[, x])

Return a map from a domain d to its canonical domain.

If a second argument x is given, the map is evaluated at that point. The point x should be a point in the domain d, and the result is a point in the canonical domain.

DomainSets.normalFunction

Return the normal of the domain at the point x.

It is assumed that x is a point on the boundary of the domain.

DomainSets.tangentsFunction

Return the tangents of the domain at the point x. The tangents form a basis for the tangent plane, perpendicular to the normal direction at x.

## Types

DomainSets.BallType
Ball{T,C} <: Domain{T}

Abstract supertype for volumes of elements satisfying norm(x-center(ball)) < radius(ball) (open ball) or norm(x-center(ball)) <= radius(ball) (closed ball).

DomainSets.BallMethod
Ball(radius = 1[, center])
Ball{T,C=:closed}(radius = 1[, center])

Return a concrete subtype of Ball which represents a ball with the given radius and center, the given eltype T, and which is open or closed.

The default center is the origin. In case both radius and center are omitted, a subtype of UnitBall is returned, whose concrete type depends on T.

A ball represents a volume. For the boundary of a ball, see Sphere().

DomainSets.DomainRefType
DomainRef(d)

A reference to a domain.

In a function call, DomainRef(x) can be used to indicate that x should be treated as a domain, e.g., foo(x, DomainRef(d)).

DomainSets.DynamicUnitBallType
DynamicUnitBall(dim::Int)
DynamicUnitBall{T}(dim::Int)
DynamicUnitBall{T,C=:closed}(dim::Int)

The open or closed unit ball with variable dimension. Typically the element type is a Vector{T} and dim specifies the length of the vectors.

DomainSets.FullSpaceType

A domain that represents the full space.

The element type T in FullSpace{T} should only be seen as an indication of the expected types of the elements in the context where the domain is intended to be used. Due to the default, loose interpretation of T, any FullSpace{T} actually contains any x regardless of the type of x. For a strict domain of all elements of type T, or elements convertible exactly to T, use TypeDomain{T}.

DomainSets.HalfLineType
HalfLine()
HalfLine{T=Float64,C=:closed}()

The positive halfline [0,∞) when C is :closed or (0,∞) when C is :open. The interval is always open at infinity.

DomainSets.NegativeHalfLineType
NegativeHalfLine()
NegativeHalfLine{T=Float64,C=:closed}()

The negative halfline (-∞,0] when C is :closed or (-∞,0) when C is :open. The interval is always open at minus infinity.

DomainSets.ProductDomainMethod
ProductDomain(domains...)
ProductDomain{T}(domains...)

Return a concrete subtype of ProductDomain which agrees mathematically with the cartesian product of the given domains.

The concrete subtype being returned depends on T. If T is provided, it will be the eltype of the product domain. If T is not provided, a suitable choice is deduced from the arguments.

DomainSets.RectangleType
Rectangle(a, b)
Rectangle(domains::ClosedInterval...)
Rectangle{T}(domains::ClosedInterval...)

A rectangular domain in n dimensions with extrema determined by the vectors or points a and b or by the endpoints of the given intervals.

DomainSets.SphereMethod
Sphere(radius = 1[, center])
Sphere{T}(radius = 1[, center])

Return a concrete subtype of Sphere which represents a sphere with the given radius and center, and the given eltype T.

The default center is the origin. In case both radius and center are omitted, a subtype of UnitSphere is returned, whose concrete type depends on T.

A sphere represents the boundary of a ball. For the volume, see Ball().

DomainSets.StaticUnitBallType
StaticUnitBall()
StaticUnitBall{T}()
StaticUnitBall{T,C=:closed}()

The open or closed unit ball with static dimension determined by the element type.

DomainSets.SublevelSetType

The domain defined by f(x) <= C (or f(x) < C) for a given function f and constant C.

DomainSets.UnitBallMethod
UnitBall([dim::Int])
UnitBall{T}([dim::Int])
UnitBall{T,C=:closed}([dim::Int])

The open or closed volume of all points of type T with norm smaller than (or equal to) 1.

DomainSets.UnitCircleType
UnitCircle()
UnitCircle{T=Float64}()

The unit circle in 2D, with element type SVector{2,T}.

DomainSets.UnitCubeType
UnitCube()
UnitCube(::Val{N=3})
UnitCube(dim::Int)

The d-dimensional domain $[0,1]^d$.

DomainSets.UnitDiskType
UnitDisk()
UnitDisk{T=Float64}()

The closed unit disk in 2D, with element type SVector{2,T}.

DomainSets.UnitSimplexMethod
UnitSimplex([dim::Int])
UnitSimplex{T}([dim::Int])
UnitSimplex{T,C=:closed}([dim::Int])

The open or closed volume of all points of type x, for which the sum of components is smaller than (or equal to) 1.

The unit simplex has the origin and all Euclidean unit vector as vertices.

DomainSets.UnitSphereMethod
UnitSphere([dim::Int])
UnitSphere{T}([dim::Int])
UnitSphere{T,C=:closed}([dim::Int])

The set of all points of type T with norm 1.