Domain
This folder contains structures that are used to encode different kinds of concrete and abstract domains.
Concrete continuous domains
Dionysos.Domain.ContinuousUnboundedDomain — TypeContinuousUnboundedDomain{N,T}Struct for a basic unbounded continuous domain.
Dionysos.Domain.ContinuousBoundedDomain — TypeContinuousBoundedDomain{N,T,B}Struct for a basic bounded continuous domain.
Dionysos.Domain.ContinuousBoundedEllipsoidDomain — TypeContinuousBoundedEllipsoidDomain{N,T,S<:Grid{N,T}}Struct for a basic bounded continuous domain formed by a finite number of ellipsoids.
Grids
Dionysos.Domain.Grid — Typeabstract type Grid{N, T} endDefines an abstract type for grid-based structures in N dimensions with floating-point values T.
Dionysos.Domain.get_pos_by_coord — Functionget_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/2and+h/2. his the length of a grid cell in each dimension.
Dionysos.Domain.GridFree — TypeGridFree{N,T} <: Grid{N,T}Uniform grid on unbounded space, centered at orig and with steps set by the vector h.
Dionysos.Domain.GridEllipsoidalRectangular — TypeGridEllipsoidalRectangular{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.
Dionysos.Domain.DeformedGrid — TypeDeformedGrid{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.
Dionysos.Domain.get_volume — Functionget_volume(Dgrid::DeformedGrid) -> TComputes the volume of a grid cell.
- If
Ais provided (linear transformation), usesdet(A). - Otherwise, defaults to the volume of the base grid.
Abstract domains
Dionysos.Domain.DomainType — Typeabstract type DomainType{N, T} endGeneral abstract type for spatial domains in N dimensions with elements of type T.
Dionysos.Domain.GridDomainType — Typeabstract type GridDomainType{N, T} <: DomainType{N, T}An abstract interface for grid-based domains, enforcing required methods for interaction.
Dionysos.Domain.merge_to_hyperrectangles_pos — Functionmerge_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.
Dionysos.Domain.merge_to_hyperrectangles_real — Functionmerge_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).
Concrete domains
Classical domains
Dionysos.Domain.DomainList — TypeDomainList{N,T,S<:Grid{N,T}}Struct for a basic domain based on a Grid.
Dionysos.Domain.CustomList — TypeCustomList{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.
Periodic domain
Dionysos.Domain.PeriodicDomainList — TypePeriodicDomainList{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 allNdimensions.
Dionysos.Domain.is_periodic — Functionis_periodic(domain::PeriodicDomainList, d::Int) -> BoolReturns true if dimension d is periodic in the given domain.
is_periodic(domain::PeriodicDomainList) -> BoolReturns true if any dimension in the domain is periodic. Uses is_periodic(domain, d) internally.
Dionysos.Domain.has_same_periodicity — Functionhas_same_periodicity(domain1::PeriodicDomainList, domain2::PeriodicDomainList) -> BoolReturns true if both domains have the same periodic settings.
Dionysos.Domain.wrap_pos — Functionwrap_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.
Dionysos.Domain.wrap_coord — Functionwrap_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.
Dionysos.Domain._make_periodic_index_map — Function_make_periodic_index_map(periodic_dims::SVector{P, Int}, N::Int)Returns an NTuple{N, Union{Nothing, Int}} where each entry is either:
nothingif dimensiondis not periodicisuch thatperiodic_dims[i] == d
Nested domain
Dionysos.Domain.NestedDomain — TypeNestedDomain{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.