Public Member Functions | |
def | __init__ |
def | setUp |
def | tearDown |
def | testSetup |
def | testScalarBasisFunction |
def | testScalarFunction |
def | testVectorBasisFunction |
def | testVectorFunction |
Public Attributes | |
options |
Definition at line 39 of file element_indexing.py.
def element_indexing::ElementIndexingTest::__init__ | ( | self, | ||
args, | ||||
kwargs | ||||
) |
Definition at line 40 of file element_indexing.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) 00044 def setUp(self):
def element_indexing::ElementIndexingTest::setUp | ( | self | ) |
Definition at line 45 of file element_indexing.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 # Generate code in a clean directory: 00052 shutil.rmtree(_test_temp_dir, ignore_errors=True) 00053 os.mkdir(_test_temp_dir) 00054 os.chdir(_test_temp_dir) 00055 def tearDown(self):
def element_indexing::ElementIndexingTest::tearDown | ( | self | ) |
Definition at line 56 of file element_indexing.py.
00056 : 00057 dirs = glob.glob("*") 00058 os.chdir("..") 00059 for d in dirs: 00060 os.rename(os.path.join(_test_temp_dir, d), os.path.join(_done_test_temp_dir, d)) 00061 def testSetup(self):
def element_indexing::ElementIndexingTest::testScalarBasisFunction | ( | self | ) |
Definition at line 65 of file element_indexing.py.
00065 : 00066 polygon = "triangle" 00067 degree = 1 00068 element = FiniteElement("CG", polygon, degree) 00069 v = BasisFunction(element) 00070 a = v*dx 00071 form = sfc.jit(a, options = self.options) 00072 # Test form properties 00073 self.assertTrue(form.rank() == 1) 00074 self.assertTrue(form.num_coefficients() == 0) 00075 self.assertTrue(num_integrals(form) == (1,0,0)) 00076 # TODO: Test values 00077 #const = 1.23 00078 #A = assemble_on_cell(form, polygon, coeffs=[const]) 00079 #self.assertAlmostEqual(A, const*cell2volume[polygon]) 00080 def testScalarFunction(self):
def element_indexing::ElementIndexingTest::testScalarFunction | ( | self | ) |
Definition at line 81 of file element_indexing.py.
00081 : 00082 polygon = "triangle" 00083 degree = 1 00084 element = FiniteElement("CG", polygon, degree) 00085 f = Function(element) 00086 a = f*dx 00087 form = sfc.jit(a, options = self.options) 00088 # Test form properties 00089 self.assertTrue(form.rank() == 0) 00090 self.assertTrue(form.num_coefficients() == 1) 00091 self.assertTrue(num_integrals(form) == (1,0,0)) 00092 # Test values 00093 const = 1.23 00094 A = assemble_on_cell(form, polygon, coeffs=[const]) 00095 self.assertAlmostEqual(A, const*cell2volume[polygon]) 00096 def testVectorBasisFunction(self):
def element_indexing::ElementIndexingTest::testSetup | ( | self | ) |
Definition at line 62 of file element_indexing.py.
00062 : 00063 pass 00064 def testScalarBasisFunction(self):
def element_indexing::ElementIndexingTest::testVectorBasisFunction | ( | self | ) |
Definition at line 97 of file element_indexing.py.
00097 : 00098 polygon = "triangle" 00099 degree = 1 00100 element = VectorElement("CG", polygon, degree) 00101 v = BasisFunction(element) 00102 a = v[0]*dx 00103 form = sfc.jit(a, options = self.options) 00104 # Test form properties 00105 self.assertTrue(form.rank() == 1) 00106 self.assertTrue(form.num_coefficients() == 0) 00107 self.assertTrue(num_integrals(form) == (1,0,0)) 00108 # TODO: Test values 00109 #const = ("1.23", "4.56") 00110 #A = assemble_on_cell(form, polygon, coeffs=[const]) 00111 #self.assertAlmostEqual(A, (float(const[0]) + float(const[1]))*cell2volume[polygon]) 00112 def testVectorFunction(self):
def element_indexing::ElementIndexingTest::testVectorFunction | ( | self | ) |
Definition at line 113 of file element_indexing.py.
00113 : 00114 polygon = "triangle" 00115 degree = 1 00116 element = VectorElement("CG", polygon, degree) 00117 f = Function(element) 00118 a = (f[0] + f[1])*dx 00119 form = sfc.jit(a, options = self.options) 00120 # Test form properties 00121 self.assertTrue(form.rank() == 0) 00122 self.assertTrue(form.num_coefficients() == 1) 00123 self.assertTrue(num_integrals(form) == (1,0,0)) 00124 # Test values 00125 const = ("1.23", "4.56") 00126 A = assemble_on_cell(form, polygon, coeffs=[const]) 00127 self.assertAlmostEqual(A, (float(const[0]) + float(const[1]))*cell2volume[polygon]) 00128 00129 tests = [ElementIndexingTest]
Definition at line 49 of file element_indexing.py.