SyFi  0.3
test_sfc.test_ufl2swiginac.Ufl2SwiginacTest Class Reference

List of all members.

Public Member Functions

def __init__
def setUp
def tearDown
def testSetup
def testIndexed1
def testIndexed2
def testIndexed3
def testProduct1
def testProduct2
def testProduct3
def testProduct4
def testSpatialDiff1
def testSpatialDiff2
def testSpatialDiff3

Detailed Description

Definition at line 39 of file test_ufl2swiginac.py.


Constructor & Destructor Documentation

def test_sfc.test_ufl2swiginac.Ufl2SwiginacTest.__init__ (   self,
  args,
  kwargs 
)

Definition at line 40 of file test_ufl2swiginac.py.

00040 
00041     def __init__(self, *args, **kwargs):
00042         unittest.TestCase.__init__(self, *args, **kwargs)


Member Function Documentation

Definition at line 43 of file test_ufl2swiginac.py.

00043 
00044     def setUp(self):
00045         pass

Definition at line 46 of file test_ufl2swiginac.py.

00046 
00047     def tearDown(self):
00048         pass

Definition at line 52 of file test_ufl2swiginac.py.

00052 
00053     def testIndexed1(self):
00054         A = as_vector((1,2,3))
00055         a = A[0] + A[1] +A[2]
00056         b = ufl2swiginac(a, 3)
00057         c = 1 + 2 + 3
00058         self.assertEqual(c, b)

Definition at line 59 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00059 
00060     def testIndexed2(self):
00061         A = as_matrix(((1,2),(3,4)))
00062         a = sum(A[i,j] for i in (0,1) for j in (0,1))
00063         b = ufl2swiginac(a, 2)
00064         c = 1 + 2 + 3 + 4
00065         self.assertEqual(c, b)

Definition at line 66 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00066 
00067     def testIndexed3(self):
00068         A = as_tensor(((1,2,3), (4,5,6), (7,8,9)))
00069         a = A[i,i]
00070         b = ufl2swiginac(a, 3)
00071         c = 1+5+9
00072         self.assertEqual(c, b)

Definition at line 73 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00073 
00074     def testProduct1(self):
00075         A = as_vector((1,2,3))
00076         a = A[0]*A[1]*A[2]
00077         b = ufl2swiginac(a, 3)
00078         c = 1 * 2 * 3
00079         self.assertEqual(c, b)

Definition at line 80 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00080 
00081     def testProduct2(self):
00082         u = as_vector((2,3,5))
00083         v = as_vector((7,11,13))
00084         a = u[i]*v[i]
00085         b = ufl2swiginac(a, 3)
00086         c = 2*7 + 3*11 + 5*13
00087         self.assertEqual(c, b)

Definition at line 88 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00088 
00089     def testProduct3(self):
00090         u = as_tensor(((1,2,3), (4,5,6), (7,8,9)))
00091         v = as_tensor(((4,5,6), (1,2,3), (4,5,6)))
00092         a = u[i,j]*v[i,j]
00093         b = ufl2swiginac(a, 3)
00094         c = (4+10+18)*2 + 7*4+8*5+9*6
00095         self.assertEqual(c, b)

Definition at line 96 of file test_ufl2swiginac.py.

References SyFi.inner(), and test_sfc::test_ufl2swiginac.ufl2swiginac().

00096 
00097     def testProduct4(self):
00098         u = as_tensor(((1,2,3), (4,5,6), (7,8,9)))
00099         v = as_tensor(u[i,j], (j,i))
00100         a = inner(u, v.T)
00101         a = expand_compounds(a, 3)
00102         b = ufl2swiginac(a, 3)
00103         c = sum(ii**2 for ii in range(10))
00104         self.assertEqual(c, b)

Definition at line 49 of file test_ufl2swiginac.py.

00049 
00050     def testSetup(self):
00051         pass

Definition at line 105 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00105 
00106     def testSpatialDiff1(self):
00107         "Test a single constant dx"
00108         A = as_vector((2,3))
00109         a = A[0].dx(0)
00110         b = ufl2swiginac(a, 2)
00111         c = 0
00112         self.assertEqual(c, b)

Definition at line 113 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00113 
00114     def testSpatialDiff2(self):
00115         "Test a single div-type df_i/dx_i"
00116         A = as_vector((2,3))
00117         a = A[i].dx(i)
00118         b = ufl2swiginac(a, 2)
00119         c = 0
00120         self.assertEqual(c, b)

Definition at line 121 of file test_ufl2swiginac.py.

References test_sfc::test_ufl2swiginac.ufl2swiginac().

00121 
00122     def testSpatialDiff3(self):
00123         "Test a double div-type df_ij/dx_ij"
00124         A = as_vector(((2,3),(4,5)))
00125         a = A[i,j].dx(j,i)
00126         b = ufl2swiginac(a, 2)
00127         c = 0
00128         self.assertEqual(c, b)

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines