SyFi  0.3
test_sfc.test_cache.TestCache Class Reference

Inherits TempDirTestBase.

List of all members.

Public Member Functions

def __init__
def setUp
def tearDown
def test_cache

Detailed Description

Definition at line 16 of file test_cache.py.


Constructor & Destructor Documentation

def test_sfc.test_cache.TestCache.__init__ (   self,
  args,
  kwargs 
)

Definition at line 17 of file test_cache.py.

00017 
00018     def __init__(self, *args, **kwargs):
00019         TempDirTestBase.__init__(self, *args, **kwargs)


Member Function Documentation

Definition at line 20 of file test_cache.py.

References test_sfc.test_tempdir_base.TempDirTestBase.options.

00020 
00021     def setUp(self):
00022         TempDirTestBase.setUp(self)
00023         self.options.code.integral.integration_method = "quadrature"

Definition at line 24 of file test_cache.py.

00024 
00025     def tearDown(self):
00026         TempDirTestBase.tearDown(self)

Definition at line 27 of file test_cache.py.

References test_sfc::test_cache.info().

00027 
00028     def test_cache(self):
00029         cells = (interval, triangle, tetrahedron) #, quadrilateral, hexahedron)
00030         times = []
00031         for take in range(3):
00032             info("="*40, "Take", take)
00033             avg, n = 0.0, 0
00034             for cell in cells:
00035                 for degree in range(1, 3):
00036                     U1 = FiniteElement("CG", cell, degree)
00037                     U2 = FiniteElement("CG", cell, degree+1)
00038                     V1 = TensorElement("CG", cell, degree)
00039                     V2 = VectorElement("CG", cell, degree+1)
00040                     V3 = FiniteElement("CG", cell, degree+2)
00041 
00042                     inputs = [U1, [U1],
00043                               U1 * U2,
00044                               V1 * V2 * V3]
00045 
00046                     for input in inputs:
00047                         t1 = time()
00048                         sfc.jit(input) # FIXME: Use local cache, clear before test
00049                         t2 = time()
00050                         t = t2 - t1
00051                         info("Time for %s: %.4f s" % (repr(input), t))
00052                         avg += t
00053                         n += 1
00054             avg /= n
00055             info("Average for take", take, "is", avg)
00056             times.append(avg)
00057         #self.assertLess(times[-1], times[0])

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