File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ abstract type Expression <: Number end
8
8
abstract type AbstractOperation <: Expression end
9
9
abstract type AbstractOperator <: Expression end
10
10
abstract type AbstractSystem end
11
+ abstract type AbstractDomain end
11
12
12
13
include (" variables.jl" )
13
14
@@ -23,6 +24,7 @@ include("systems/diffeqs/diffeqsystem.jl")
23
24
include (" systems/diffeqs/first_order_transform.jl" )
24
25
include (" systems/nonlinear/nonlinear_system.jl" )
25
26
include (" function_registration.jl" )
27
+ include (" domains.jl" )
26
28
include (" simplify.jl" )
27
29
include (" utils.jl" )
28
30
Original file line number Diff line number Diff line change
1
+ Base. ndims (:: AbstractDomain ) = error (" Domain dimension is undefined" )
2
+
3
+ struct DiscreteDomain <: AbstractDomain
4
+ length:: Int
5
+ end
6
+
7
+ struct Interval{T} <: AbstractDomain
8
+ start:: T
9
+ stop:: T
10
+ end
11
+
12
+ struct ProductDomain{T} <: AbstractDomain
13
+ domains:: T
14
+ end
15
+
16
+ Base.:* (x:: AbstractDomain... ) = ProductDomain ((x... ))
17
+
18
+ export DiscreteDomain, Interval, ProductDomain
Original file line number Diff line number Diff line change
1
+ using ModelingToolkit
2
+ using Base. Test
3
+
4
+ d = DiscreteDomain (5 ) * Interval (0.0 ,5.0 )
5
+ typeof (d) <: ProductDomain
6
+ typeof (d. domains[1 ]) <: DiscreteDomain
7
+ typeof (d. domains[2 ]) <: Interval
Original file line number Diff line number Diff line change @@ -4,5 +4,6 @@ using ModelingToolkit, Base.Test
4
4
@testset " Basic Variables and Operations" begin include (" basic_variables_and_operations.jl" ) end
5
5
@testset " Differentiation Test" begin include (" derivatives.jl" ) end
6
6
@testset " Internal Test" begin include (" internal.jl" ) end
7
+ @testset " Domain Test" begin include (" domains.jl" ) end
7
8
@testset " Ambiguity Test" begin include (" ambiguity.jl" ) end
8
9
@testset " System Construction Test" begin include (" system_construction.jl" ) end
You can’t perform that action at this time.
0 commit comments