Skip to content

Commit

Permalink
fix test_slate_infrastructure array bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
tj-sun committed Aug 21, 2018
1 parent b2e4fc6 commit 874ab43
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/slate/test_slate_infrastructure.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from firedrake import *
from firedrake.formmanipulation import ExtractSubBlock
import math


@pytest.fixture(scope='module', params=[interval, triangle, quadrilateral])
Expand Down Expand Up @@ -58,23 +59,32 @@ def stiffness(function_space):
@pytest.fixture
def load(function_space):
f = Function(function_space)
f.interpolate(Expression("cos(x[0]*pi*2)"))
x = SpatialCoordinate(function_space.mesh())
f.interpolate(cos(x[0])*math.pi*2)
v = TestFunction(function_space)
return Tensor(f * v * dx)


@pytest.fixture
def boundary_load(function_space):
f = Function(function_space)
f.interpolate(Expression("cos(x[1]*pi*2)"))
x = SpatialCoordinate(function_space.mesh())
if function_space.mesh().cell_dimension() == 1:
f.interpolate(cos(x[0]*math.pi*2))
else:
f.interpolate(cos(x[1] * math.pi*2))
v = TestFunction(function_space)
return Tensor(f * v * ds)


@pytest.fixture
def zero_rank_tensor(function_space):
c = Function(function_space)
c.interpolate(Expression("x[0]*x[1]"))
x = SpatialCoordinate(function_space.mesh())
if function_space.mesh().cell_dimension() == 1:
c.interpolate(x[0]*x[0])
else:
c.interpolate(x[0]*x[1])
return Tensor(c * dx)


Expand Down

0 comments on commit 874ab43

Please sign in to comment.