SyFi 0.3
jit::JitTest Class Reference

List of all members.

Public Member Functions

def __init__
def setUp
def tearDown
def testSetup
def testJitMass
def testJitWeightedMass
def testJitSource
def testJitSplitTerms

Public Attributes

 options

Detailed Description

Definition at line 38 of file jit.py.


Constructor & Destructor Documentation

def jit::JitTest::__init__ (   self,
  args,
  kwargs 
)

Definition at line 39 of file jit.py.

00040                                        :
00041         unittest.TestCase.__init__(self, *args, **kwargs)
00042         shutil.rmtree(_done_test_temp_dir, ignore_errors=True)
00043         os.mkdir(_done_test_temp_dir)
    

Member Function Documentation

def jit::JitTest::setUp (   self)

Definition at line 44 of file jit.py.

00045                    :
00046         #print "Running sfc jit test in testdir"
00047         #print "Imported SyFi from location", SyFi.__file__
00048         #print "Imported sfc  from location", sfc.__file__
00049         self.options = sfc.default_options()
00050         self.options.compilation.cache_dir = os.path.abspath("test_cache")
00051         self.options.code.integral.integration_method = "quadrature"
00052         # Generate code in a clean directory:
00053         shutil.rmtree(_test_temp_dir, ignore_errors=True)
00054         os.mkdir(_test_temp_dir)
00055         os.chdir(_test_temp_dir)
    
def jit::JitTest::tearDown (   self)

Definition at line 56 of file jit.py.

00057                       :
00058         dirs = glob.glob("*")
00059         os.chdir("..")
00060         for d in dirs:
00061             os.rename(os.path.join(_test_temp_dir, d), os.path.join(_done_test_temp_dir, d))
    
def jit::JitTest::testJitMass (   self)

Definition at line 65 of file jit.py.

00066                          :
00067         "Test the mass matrix."
00068         element = FiniteElement("CG", "triangle", 1)
00069         v = TestFunction(element)
00070         u = TrialFunction(element)
00071         a = u*v*dx
00072         form = sfc.jit(a, options = self.options)
00073         self.assertTrue(form.rank() == 2)
00074         self.assertTrue(form.num_coefficients() == 0)
00075         self.assertTrue(num_integrals(form) == (1,0,0))
00076         A = assemble_on_cell(form, "triangle", coeffs=[5.43])
00077         # TODO: Assert correct result
    
def jit::JitTest::testJitSource (   self)

Definition at line 92 of file jit.py.

00093                            :
00094         "Test the source vector."
00095         element = FiniteElement("CG", "triangle", 1)
00096         v = TestFunction(element)
00097         f = Function(element)
00098         a = f*v*dx
00099         form = sfc.jit(a, options = self.options)
00100         self.assertTrue(form.rank() == 1)
00101         self.assertTrue(form.num_coefficients() == 1)
00102         self.assertTrue(num_integrals(form) == (1,0,0))
00103         A = assemble_on_cell(form, "triangle", coeffs=[3.14])
00104         # TODO: Assert correct result
    
def jit::JitTest::testJitSplitTerms (   self)

Definition at line 105 of file jit.py.

00106                                :
00107         "Test a form split over two foo*dx terms, using the mass matrix."
00108         element = FiniteElement("CG", "triangle", 1)
00109         v = TestFunction(element)
00110         u = TrialFunction(element)
00111         f = Function(element)
00112         a = u*v*dx + f*u*v*dx
00113         form = sfc.jit(a, options = self.options)
00114         self.assertTrue(form.rank() == 2)
00115         self.assertTrue(form.num_coefficients() == 1)
00116         self.assertTrue(num_integrals(form) == (1,0,0))
00117         A = assemble_on_cell(form, "triangle", coeffs=[4.43])
00118         # TODO: Assert correct result
00119 

def jit::JitTest::testJitWeightedMass (   self)

Definition at line 78 of file jit.py.

00079                                  :
00080         "Test the weighted mass matrix."
00081         element = FiniteElement("CG", "triangle", 1)
00082         v = TestFunction(element)
00083         u = TrialFunction(element)
00084         f = Function(element)
00085         a = f*u*v*dx
00086         form = sfc.jit(a, options = self.options)
00087         self.assertTrue(form.rank() == 2)
00088         self.assertTrue(form.num_coefficients() == 1)
00089         self.assertTrue(num_integrals(form) == (1,0,0))
00090         A = assemble_on_cell(form, "triangle", coeffs=[5.43])
00091         # TODO: Assert correct result

def jit::JitTest::testSetup (   self)

Definition at line 62 of file jit.py.

00063                        :
00064         pass
    

Member Data Documentation

Definition at line 44 of file jit.py.


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