Skip to content

Commit

Permalink
tests: add staggered origin in Abs MFE
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed May 10, 2023
1 parent eb66c63 commit 84ba5a0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/test_symbolics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Operator, SubDimension, norm, Le, Ge, Gt, Lt, Abs, sin, cos, Min, Max)
from devito.ir import Expression, FindNodes
from devito.symbolics import (retrieve_functions, retrieve_indexed, evalrel, # noqa
CallFromPointer, Cast, FieldFromPointer,
CallFromPointer, Cast, FieldFromPointer, INT,
FieldFromComposite, IntDiv, ccode, uxreplace)
from devito.types import Array, Bundle, LocalObject, Object, Symbol as dSymbol

Expand All @@ -31,6 +31,18 @@ def test_float_indices():
assert indices == 1


def test_func_of_indices():
"""
Test that origin is correctly processed with functions
"""
grid = Grid((10,))
x = grid.dimensions[0]
u = Function(name="u", grid=grid, space_order=2, staggered=x)
us = u.subs({u.indices[0]: INT(Abs(u.indices[0]))})
assert us.indices[0] == INT(Abs(x + x.spacing/2))
assert us.indexify().indices[0] == INT(Abs(x))


@pytest.mark.parametrize('dtype,expected', [
(np.float32, "float r0 = 1.0F/h_x;"),
(np.float64, "double r0 = 1.0/h_x;")
Expand Down

0 comments on commit 84ba5a0

Please sign in to comment.