SyFi 0.3
|
Public Member Functions | |
def | setUp |
def | tearDown |
def | testSetup |
def | testJitVolumeInterval |
def | testJitVolumeTriangle |
def | testJitVolumeTetrahedron |
def | testJitConstantInterval |
def | testJitConstantTriangle |
def | testJitConstantTetrahedron |
def | testJitSource |
def | testJitMass |
def | testJitSplitTerms |
Private Member Functions | |
def | _testJitVolume |
def | _testJitVolumeQuadrilateral |
def | _testJitVolumeHexahedron |
def | _testJitConstant |
def | _testJitConstantQuadrilateral |
def | _testJitConstantHexahedron |
Definition at line 93 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::_testJitConstant | ( | self, | |
polygon, | |||
degree | |||
) | [private] |
Test that the integral of a constant coefficient over a unit cell mesh equals the constant times the volume of the unit cell.
Definition at line 138 of file tests/sfc_jit/test.py.
00139 : 00140 """Test that the integral of a constant coefficient over a unit 00141 cell mesh equals the constant times the volume of the unit cell.""" 00142 element = FiniteElement("CG", polygon, degree) 00143 f = Function(element) 00144 a = f*dx 00145 form = sfc.jit(a) 00146 self.assertTrue(form.rank() == 0) 00147 self.assertTrue(form.num_coefficients() == 1) 00148 self.assertTrue(num_integrals(form) == (1,0,0)) 00149 const = 1.23 00150 A = assemble_on_cell(form, polygon, coeffs=[const]) 00151 self.assertAlmostEqual(A, const*cell2volume[polygon])
def sfc_jit::test::SFCJitTest::_testJitConstantHexahedron | ( | self | ) | [private] |
Definition at line 172 of file tests/sfc_jit/test.py.
00172 : # Not supported by dolfin yet 00173 polygon = "hexahedron" 00174 self._testJitConstant(polygon, 1) 00175 self._testJitConstant(polygon, 2) 00176
def sfc_jit::test::SFCJitTest::_testJitConstantQuadrilateral | ( | self | ) | [private] |
Definition at line 167 of file tests/sfc_jit/test.py.
00167 : # Not supported by dolfin yet 00168 polygon = "quadrilateral" 00169 self._testJitConstant(polygon, 1) 00170 self._testJitConstant(polygon, 2) 00171
def sfc_jit::test::SFCJitTest::_testJitVolume | ( | self, | |
polygon | |||
) | [private] |
Definition at line 112 of file tests/sfc_jit/test.py.
00113 : 00114 "Test that the integral of 1.0 over a unit cell equals the length/area/volume of the unit cell." 00115 c = Constant(polygon) 00116 a = c*dx 00117 form = sfc.jit(a) 00118 self.assertTrue(form.rank() == 0) 00119 self.assertTrue(form.num_coefficients() == 1) 00120 self.assertTrue(num_integrals(form) == (1,0,0)) 00121 A = assemble_on_cell(form, polygon, coeffs=[1.0]) 00122 self.assertAlmostEqual(A, cell2volume[polygon])
def sfc_jit::test::SFCJitTest::_testJitVolumeHexahedron | ( | self | ) | [private] |
Definition at line 135 of file tests/sfc_jit/test.py.
00135 : # Not supported by dolfin yet 00136 self._testJitVolume("hexahedron") 00137
def sfc_jit::test::SFCJitTest::_testJitVolumeQuadrilateral | ( | self | ) | [private] |
Definition at line 132 of file tests/sfc_jit/test.py.
00132 : # Not supported by dolfin yet 00133 self._testJitVolume("quadrilateral") 00134
def sfc_jit::test::SFCJitTest::setUp | ( | self | ) |
Definition at line 94 of file tests/sfc_jit/test.py.
00095 : 00096 #print "Running sfc jit test in testdir" 00097 #print "Imported SyFi from location", SyFi.__file__ 00098 #print "Imported sfc from location", sfc.__file__ 00099 # Generate code in a clean directory: 00100 shutil.rmtree(_test_temp_dir, ignore_errors=True) 00101 os.mkdir(_test_temp_dir) 00102 os.chdir(_test_temp_dir)
def sfc_jit::test::SFCJitTest::tearDown | ( | self | ) |
Definition at line 103 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::testJitConstantInterval | ( | self | ) |
Definition at line 152 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::testJitConstantTetrahedron | ( | self | ) |
Definition at line 162 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::testJitConstantTriangle | ( | self | ) |
Definition at line 157 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::testJitMass | ( | self | ) |
Definition at line 190 of file tests/sfc_jit/test.py.
00191 : 00192 "Test the mass matrix." 00193 element = FiniteElement("CG", "triangle", 1) 00194 v = TestFunction(element) 00195 u = TrialFunction(element) 00196 f = Function(element) 00197 a = f*u*v*dx 00198 form = sfc.jit(a) 00199 self.assertTrue(form.rank() == 2) 00200 self.assertTrue(form.num_coefficients() == 1) 00201 self.assertTrue(num_integrals(form) == (1,0,0)) 00202 A = assemble_on_cell(form, "triangle", coeffs=[5.43]) 00203 # TODO: Assert correct result
def sfc_jit::test::SFCJitTest::testJitSource | ( | self | ) |
Definition at line 177 of file tests/sfc_jit/test.py.
00178 : 00179 "Test the source vector." 00180 element = FiniteElement("CG", "triangle", 1) 00181 v = TestFunction(element) 00182 f = Function(element) 00183 a = f*v*dx 00184 form = sfc.jit(a) 00185 self.assertTrue(form.rank() == 1) 00186 self.assertTrue(form.num_coefficients() == 1) 00187 self.assertTrue(num_integrals(form) == (1,0,0)) 00188 A = assemble_on_cell(form, "triangle", coeffs=[3.14]) 00189 # TODO: Assert correct result
def sfc_jit::test::SFCJitTest::testJitSplitTerms | ( | self | ) |
Definition at line 204 of file tests/sfc_jit/test.py.
00205 : 00206 "Test a form split over two foo*dx terms, using the mass matrix." 00207 element = FiniteElement("CG", "triangle", 1) 00208 v = TestFunction(element) 00209 u = TrialFunction(element) 00210 f = Function(element) 00211 a = u*v*dx + f*u*v*dx 00212 form = sfc.jit(a) 00213 self.assertTrue(form.rank() == 2) 00214 self.assertTrue(form.num_coefficients() == 1) 00215 self.assertTrue(num_integrals(form) == (1,0,0)) 00216 A = assemble_on_cell(form, "triangle", coeffs=[4.43]) 00217 # TODO: Assert correct result 00218
def sfc_jit::test::SFCJitTest::testJitVolumeInterval | ( | self | ) |
Definition at line 123 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::testJitVolumeTetrahedron | ( | self | ) |
Definition at line 129 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::testJitVolumeTriangle | ( | self | ) |
Definition at line 126 of file tests/sfc_jit/test.py.
def sfc_jit::test::SFCJitTest::testSetup | ( | self | ) |
Definition at line 109 of file tests/sfc_jit/test.py.