Domain

This folder contains structures that are used to encode different kinds of concrete and abstract domains.

Concrete continuous domains

Grids

Dionysos.Domain.GridType
abstract type Grid{N, T} end

Defines an abstract type for grid-based structures in N dimensions with floating-point values T.

source
Dionysos.Domain.get_pos_by_coordFunction
get_pos_by_coord(grid::Grid{N, T}, x::SVector{N, T}) -> NTuple{N, Int}

Returns the discrete position (grid indices) corresponding to a coordinate x.

  • The cell (0,0) is centered between -h/2 and +h/2.
  • h is the length of a grid cell in each dimension.
source
Dionysos.Domain.GridFreeType
GridFree{N,T} <: Grid{N,T}

Uniform grid on unbounded space, centered at orig and with steps set by the vector h.

source
Dionysos.Domain.GridEllipsoidalRectangularType
GridEllipsoidalRectangular{N,T} <: Grid{N,T}

Uniform grid on rectangular space rect, centered at orig and with steps set by the vector h. Cells are (possibly overlapping) ellipsoids defined at each grid point c as (x-c)'P(x-c) ≤ 1.

source
Dionysos.Domain.DeformedGridType
DeformedGrid{N, T} <: Grid{N, T}

Represents a deformed version of a GridFree grid, where points are mapped via an invertible transformation f and its inverse fi.

Fields

  • grid::GridFree{N, T} : The underlying grid.
  • f::Function : The forward transformation (physical -> deformed).
  • fi::Function : The inverse transformation (deformed -> physical).
  • A::Union{Nothing, SMatrix{N, N, T, N*N}} : Optional linear transformation matrix for volume calculations.
source
Dionysos.Domain.get_volumeFunction
get_volume(Dgrid::DeformedGrid) -> T

Computes the volume of a grid cell.

  • If A is provided (linear transformation), uses det(A).
  • Otherwise, defaults to the volume of the base grid.
source

Abstract domains

Dionysos.Domain.GridDomainTypeType
abstract type GridDomainType{N, T} <: DomainType{N, T}

An abstract interface for grid-based domains, enforcing required methods for interaction.

source
Dionysos.Domain.merge_to_hyperrectangles_posFunction
merge_to_hyperrectangles_pos(domain::GridDomainType)

Aggregates the grid elements in GridDomainType into the largest possible hyperrectangles. Returns a list of HyperRectangles that efficiently represent the domain.

source
Dionysos.Domain.merge_to_hyperrectangles_realFunction
merge_hyperrectangles_real(domain_list::GridDomainType)

Uses the existing merge_to_hyperrectangles(domain_list) function to merge elements in grid positions, then converts the result into real-world HyperRectangles using get_rec(grid, pos).

source

Concrete domains

Classical domains

Dionysos.Domain.CustomListType
CustomList{N, T} <: DomainType{N, T}

A flexible, generic domain representation that stores elements as a list of SVector{N, T}. Useful for managing discrete sets of points in an N-dimensional space.

source

Periodic domain

Dionysos.Domain.PeriodicDomainListType
PeriodicDomainList{N, T, S, P} <: GridDomainType{N, T}

A periodic extension of DomainList, where specified dimensions wrap around with specified periods.

Fields

  • periodic_dims::SVector{P, Int}: Indices of the periodic dimensions.
  • periods::SVector{P, T}: Period length in each periodic dimension.
  • start::SVector{P, T}: Start value for each periodic dimension.
  • underlying_domain::DomainList{N, T, S}: The wrapped domain over all N dimensions.
source
Dionysos.Domain.is_periodicFunction
is_periodic(domain::PeriodicDomainList, d::Int) -> Bool

Returns true if dimension d is periodic in the given domain.

source
is_periodic(domain::PeriodicDomainList) -> Bool

Returns true if any dimension in the domain is periodic. Uses is_periodic(domain, d) internally.

source
Dionysos.Domain.wrap_posFunction
wrap_pos(domain::PeriodicDomainList{N, T}, pos::NTuple{N, Int}) -> NTuple{N, Int}

Wraps a grid position pos into its equivalent within the periodic boundaries defined by domain.

Only the periodic dimensions (as defined in domain.periodic_dims) are wrapped. Non-periodic dimensions are returned as-is.

Returns

  • An NTuple{N, Int} where periodic dimensions are wrapped modulo the number of cells in the period.
source
Dionysos.Domain.wrap_coordFunction
wrap_coord(domain::PeriodicDomainList{N, T}, coord::SVector{N, T}) -> SVector{N, T}

Wraps a real-valued coordinate coord into its periodic equivalent, based on the periodic dimensions defined in the domain.

Non-periodic dimensions are returned unchanged.

source
Dionysos.Domain._make_periodic_index_mapFunction
_make_periodic_index_map(periodic_dims::SVector{P, Int}, N::Int)

Returns an NTuple{N, Union{Nothing, Int}} where each entry is either:

  • nothing if dimension d is not periodic
  • i such that periodic_dims[i] == d
source

Nested domain

Dionysos.Domain.NestedDomainType
NestedDomain{N, T}

A multiresolution hierarchical domain structure that stores a hierarchy of nested grid-based domains (GridDomainType), allowing dynamic refinement of the domain in space.

Each level represents a grid discretization of the state space, where finer grids can be added incrementally.

Fields

  • domains::Vector{GridDomainType{N, T}}: List of domain grids at each refinement level.
  • active::Vector{Dict{NTuple{N, Int}, Bool}}: Dictionary at each level storing which cells are currently active (occupied).
  • levels::Int: Current number of refinement levels.

Key Features

  • Dynamic Refinement: You can subdivide a cell into finer cells on demand (cut_pos!).
  • Multi-level Access: Query which level (depth) a point belongs to.
  • Efficient Storage: Only active cells are stored at each level.
  • Grid-Based: Works with any domain subtype implementing GridDomainType.

Typical Usage

  • Start from a coarse grid domain.
  • Add levels by splitting cells when higher resolution is needed.
  • Track multi-resolution hierarchical structure easily.
source