SyFi 0.3
|
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.
def element_indexing::ElementIndexingTest::setUp | ( | self | ) |
Definition at line 45 of file element_indexing.py.
00046 : 00047 #print "Running sfc jit test in testdir" 00048 #print "Imported SyFi from location", SyFi.__file__ 00049 #print "Imported sfc from location", sfc.__file__ 00050 self.options = sfc.default_options() 00051 self.options.compilation.cache_dir = os.path.abspath("test_cache") 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 element_indexing::ElementIndexingTest::tearDown | ( | self | ) |
Definition at line 56 of file element_indexing.py.
def element_indexing::ElementIndexingTest::testScalarBasisFunction | ( | self | ) |
Definition at line 65 of file element_indexing.py.
00066 : 00067 polygon = "triangle" 00068 degree = 1 00069 element = FiniteElement("CG", polygon, degree) 00070 v = BasisFunction(element) 00071 a = v*dx 00072 form = sfc.jit(a, options = self.options) 00073 # Test form properties 00074 self.assertTrue(form.rank() == 1) 00075 self.assertTrue(form.num_coefficients() == 0) 00076 self.assertTrue(num_integrals(form) == (1,0,0)) 00077 # TODO: Test values 00078 #const = 1.23 00079 #A = assemble_on_cell(form, polygon, coeffs=[const]) 00080 #self.assertAlmostEqual(A, const*cell2volume[polygon])
def element_indexing::ElementIndexingTest::testScalarFunction | ( | self | ) |
Definition at line 81 of file element_indexing.py.
00082 : 00083 polygon = "triangle" 00084 degree = 1 00085 element = FiniteElement("CG", polygon, degree) 00086 f = Function(element) 00087 a = f*dx 00088 form = sfc.jit(a, options = self.options) 00089 # Test form properties 00090 self.assertTrue(form.rank() == 0) 00091 self.assertTrue(form.num_coefficients() == 1) 00092 self.assertTrue(num_integrals(form) == (1,0,0)) 00093 # Test values 00094 const = 1.23 00095 A = assemble_on_cell(form, polygon, coeffs=[const]) 00096 self.assertAlmostEqual(A, const*cell2volume[polygon])
def element_indexing::ElementIndexingTest::testSetup | ( | self | ) |
Definition at line 62 of file element_indexing.py.
def element_indexing::ElementIndexingTest::testVectorBasisFunction | ( | self | ) |
Definition at line 97 of file element_indexing.py.
00098 : 00099 polygon = "triangle" 00100 degree = 1 00101 element = VectorElement("CG", polygon, degree) 00102 v = BasisFunction(element) 00103 a = v[0]*dx 00104 form = sfc.jit(a, options = self.options) 00105 # Test form properties 00106 self.assertTrue(form.rank() == 1) 00107 self.assertTrue(form.num_coefficients() == 0) 00108 self.assertTrue(num_integrals(form) == (1,0,0)) 00109 # TODO: Test values 00110 #const = ("1.23", "4.56") 00111 #A = assemble_on_cell(form, polygon, coeffs=[const]) 00112 #self.assertAlmostEqual(A, (float(const[0]) + float(const[1]))*cell2volume[polygon])
def element_indexing::ElementIndexingTest::testVectorFunction | ( | self | ) |
Definition at line 113 of file element_indexing.py.
00114 : 00115 polygon = "triangle" 00116 degree = 1 00117 element = VectorElement("CG", polygon, degree) 00118 f = Function(element) 00119 a = (f[0] + f[1])*dx 00120 form = sfc.jit(a, options = self.options) 00121 # Test form properties 00122 self.assertTrue(form.rank() == 0) 00123 self.assertTrue(form.num_coefficients() == 1) 00124 self.assertTrue(num_integrals(form) == (1,0,0)) 00125 # Test values 00126 const = ("1.23", "4.56") 00127 A = assemble_on_cell(form, polygon, coeffs=[const]) 00128 self.assertAlmostEqual(A, (float(const[0]) + float(const[1]))*cell2volume[polygon]) 00129
Definition at line 45 of file element_indexing.py.