SyFi  0.3
test_quadjit.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 __authors__ = "Martin Sandve Alnes"
00004 __date__ = "2008-09-04 -- 2012-16-05"
00005 
00006 import unittest
00007 import os, sys, glob, shutil, commands
00008 
00009 import ufl
00010 from ufl import *
00011 import SyFi
00012 import sfc as sfc
00013 
00014 from test_tempdir_base import TempDirTestBase
00015 from cell_assembly import assemble_on_cell, num_integrals
00016 
00017 class QuadJitTest(TempDirTestBase):
00018     def __init__(self, *args, **kwargs):
00019         TempDirTestBase.__init__(self, *args, **kwargs)
00020 
00021     def setUp(self):
00022         TempDirTestBase.setUp(self)
00023         self.options.code.integral.integration_method = "quadrature"
00024 
00025     def tearDown(self):
00026         TempDirTestBase.tearDown(self)
00027 
00028     def testSetup(self):
00029         "Just see that setUp and tearDown works."
00030         self.assertTrue("Did not crash in setUp.")
00031 
00032     def testJitMass(self):
00033         "Test the mass matrix."
00034         element = FiniteElement("CG", "triangle", 1)
00035         v = TestFunction(element)
00036         u = TrialFunction(element)
00037         a = u*v*dx
00038         form, module, formdata, prefix = sfc.jit(a, parameters = self.options)
00039         self.assertTrue(form.rank() == 2)
00040         self.assertTrue(form.num_coefficients() == 0)
00041         self.assertTrue(num_integrals(form) == (1,0,0))
00042         A = assemble_on_cell(form, "triangle", coeffs=[], elements=[element,element])
00043         # TODO: Assert correct result
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines