Skip to content
Snippets Groups Projects

WIP: Astnodes for interpolation

Viewing commit e66b90f2
Next
Show latest version
1 file
+ 7
9
Preferences
Compare changes
@@ -3,20 +3,18 @@
@@ -3,20 +3,18 @@
Test of pystencils.data_types.address_of
Test of pystencils.data_types.address_of
"""
"""
import sympy
import pystencils
import pystencils
from pystencils.data_types import PointerType, address_of, cast_func
from pystencils.data_types import PointerType, address_of, cast_func, create_type
from pystencils.simp.simplifications import sympy_cse
from pystencils.simp.simplifications import sympy_cse
def test_address_of():
def test_address_of():
x, y = pystencils.fields('x,y: int64[2d]')
x, y = pystencils.fields('x,y: int64[2d]')
s = pystencils.TypedSymbol('s', PointerType('int64'))
s = pystencils.TypedSymbol('s', PointerType(create_type('int64')))
assignments = pystencils.AssignmentCollection({
assignments = pystencils.AssignmentCollection({
s: address_of(x[0, 0]),
s: address_of(x[0, 0]),
y[0, 0]: cast_func(s, 'int64')
y[0, 0]: cast_func(s, create_type('int64'))
}, {})
}, {})
ast = pystencils.create_kernel(assignments)
ast = pystencils.create_kernel(assignments)
@@ -24,7 +22,7 @@ def test_address_of():
@@ -24,7 +22,7 @@ def test_address_of():
print(code)
print(code)
assignments = pystencils.AssignmentCollection({
assignments = pystencils.AssignmentCollection({
y[0, 0]: cast_func(address_of(x[0, 0]), 'int64')
y[0, 0]: cast_func(address_of(x[0, 0]), create_type('int64'))
}, {})
}, {})
ast = pystencils.create_kernel(assignments)
ast = pystencils.create_kernel(assignments)
@@ -34,11 +32,11 @@ def test_address_of():
@@ -34,11 +32,11 @@ def test_address_of():
def test_address_of_with_cse():
def test_address_of_with_cse():
x, y = pystencils.fields('x,y: int64[2d]')
x, y = pystencils.fields('x,y: int64[2d]')
s = pystencils.TypedSymbol('s', PointerType('int64'))
s = pystencils.TypedSymbol('s', PointerType(create_type('int64')))
assignments = pystencils.AssignmentCollection({
assignments = pystencils.AssignmentCollection({
y[0, 0]: cast_func(address_of(x[0, 0]), 'int64'),
y[0, 0]: cast_func(address_of(x[0, 0]), create_type('int64')) + s,
x[0, 0]: cast_func(address_of(x[0, 0]), 'int64') + 1
x[0, 0]: cast_func(address_of(x[0, 0]), create_type('int64')) + 1
}, {})
}, {})
ast = pystencils.create_kernel(assignments)
ast = pystencils.create_kernel(assignments)