Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ jobs:
- name: run tests
run: |
julia --color=yes --check-bounds=yes --inline=no --project -e 'using Pkg; Pkg.test(coverage=true)'
env:
DEVITO_BRANCH: ${{ matrix.devitoversion }}

- uses: julia-actions/julia-processcoverage@v1

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Devito"
uuid = "06ed14b1-0e40-4084-abdf-764a285f8c42"
authors = ["Sam Kaplan <Sam.Kaplan@chevron.com>"]
version = "1.3.2"
version = "1.4.0"

[deps]
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
Expand Down
5 changes: 4 additions & 1 deletion src/Devito.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ Symbol defining the size of the Dimension
function symbolic_size end

# metaprograming for Devito functions taking variable number of arguments
for (M,F) in ((:devito,:Min), (:devito,:Max),(:sympy,:And))
for (M,F) in ((:devito,:Min), (:devito,:Max), (:sympy,:And))
@eval begin
$F(args...) = $M.$F((PyObject.(args))...)
export $F
Expand Down Expand Up @@ -1559,6 +1559,9 @@ Perform Modular division on a dimension
Mod(x::Union{AbstractDimension,PyObject},y::Int) = sympy.Mod(PyObject(x),PyObject(y))
export Mod

"""function to return the sympy Or"""
sympy_or() = sympy.Or

"""Get symbolic representation for function index object"""
function Base.getindex(x::Union{TimeFunction,Function},args...)
return utils."indexobj"(x,reverse(args)...)
Expand Down
22 changes: 22 additions & 0 deletions test/serialtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,28 @@ end
end
end

@testset "Conditional dimension with sympy_or" begin
size, factr = 18, 4
i = Devito.SpaceDimension(name="i")
grd = Grid(shape=(size,),dimensions=(i,))
ci = ConditionalDimension(name="ci", parent=i, factor=factr, relation=Devito.sympy_or())
cend = ConditionalDimension(name="cend", parent=i, condition=CondEq(i, size-1), relation=Devito.sympy_or())
@test parent(ci) == i
@test parent(cend) == i
g = Devito.Function(name="g", grid=grd, shape=(size,), dimensions=(i,))
f = Devito.Function(name="f", grid=grd, shape=(div(size,factr)+2,), dimensions=(ci,))
op = Operator([Eq(g, i), Eq(f, g), Eq(f[ci+1], g, implicit_dims=cend)], name="Conditional_and_Or")
apply(op)
for j in 1:div(size,factr)+1
@test data(f)[j] == data(g)[(j-1)*factr+1]
end
if ENV["DEVITO_BRANCH"] in ("main", "devitopro")
@test data(f)[end] == data(g)[end]
else
@test_broken data(f)[end] == data(g)[end]
end
end

@testset "PyObject(Dimension)" begin
x = SpaceDimension(name="x")
@test PyObject(x) === x.o
Expand Down
Loading