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.
00138 : 00139 """Test that the integral of a constant coefficient over a unit 00140 cell mesh equals the constant times the volume of the unit cell.""" 00141 element = FiniteElement("CG", polygon, degree) 00142 f = Function(element) 00143 a = f*dx 00144 form = sfc.jit(a) 00145 self.assertTrue(form.rank() == 0) 00146 self.assertTrue(form.num_coefficients() == 1) 00147 self.assertTrue(num_integrals(form) == (1,0,0)) 00148 const = 1.23 00149 A = assemble_on_cell(form, polygon, coeffs=[const]) 00150 self.assertAlmostEqual(A, const*cell2volume[polygon]) 00151 def testJitConstantInterval(self):
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.
00112 : 00113 "Test that the integral of 1.0 over a unit cell equals the length/area/volume of the unit cell." 00114 c = Constant(polygon) 00115 a = c*dx 00116 form = sfc.jit(a) 00117 self.assertTrue(form.rank() == 0) 00118 self.assertTrue(form.num_coefficients() == 1) 00119 self.assertTrue(num_integrals(form) == (1,0,0)) 00120 A = assemble_on_cell(form, polygon, coeffs=[1.0]) 00121 self.assertAlmostEqual(A, cell2volume[polygon]) 00122 def testJitVolumeInterval(self):
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.
00094 : 00095 #print "Running sfc jit test in testdir" 00096 #print "Imported SyFi from location", SyFi.__file__ 00097 #print "Imported sfc from location", sfc.__file__ 00098 # Generate code in a clean directory: 00099 shutil.rmtree(_test_temp_dir, ignore_errors=True) 00100 os.mkdir(_test_temp_dir) 00101 os.chdir(_test_temp_dir) 00102 def tearDown(self):
def sfc_jit::test::SFCJitTest::tearDown | ( | self | ) |
Definition at line 103 of file tests/sfc_jit/test.py.
00103 : 00104 dirs = glob.glob("*") 00105 os.chdir("..") 00106 for d in dirs: 00107 os.rename(os.path.join(_test_temp_dir, d), os.path.join(_done_test_temp_dir, d)) 00108 def testSetup(self):
def sfc_jit::test::SFCJitTest::testJitConstantInterval | ( | self | ) |
Definition at line 152 of file tests/sfc_jit/test.py.
00152 : 00153 polygon = "interval" 00154 self._testJitConstant(polygon, 1) 00155 self._testJitConstant(polygon, 2) 00156 def testJitConstantTriangle(self):
def sfc_jit::test::SFCJitTest::testJitConstantTetrahedron | ( | self | ) |
Definition at line 162 of file tests/sfc_jit/test.py.
00162 : 00163 polygon = "tetrahedron" 00164 self._testJitConstant(polygon, 1) 00165 self._testJitConstant(polygon, 2) 00166 def _testJitConstantQuadrilateral(self): # Not supported by dolfin yet
def sfc_jit::test::SFCJitTest::testJitConstantTriangle | ( | self | ) |
Definition at line 157 of file tests/sfc_jit/test.py.
00157 : 00158 polygon = "triangle" 00159 self._testJitConstant(polygon, 1) 00160 self._testJitConstant(polygon, 2) 00161 def testJitConstantTetrahedron(self):
def sfc_jit::test::SFCJitTest::testJitMass | ( | self | ) |
Definition at line 190 of file tests/sfc_jit/test.py.
00190 : 00191 "Test the mass matrix." 00192 element = FiniteElement("CG", "triangle", 1) 00193 v = TestFunction(element) 00194 u = TrialFunction(element) 00195 f = Function(element) 00196 a = f*u*v*dx 00197 form = sfc.jit(a) 00198 self.assertTrue(form.rank() == 2) 00199 self.assertTrue(form.num_coefficients() == 1) 00200 self.assertTrue(num_integrals(form) == (1,0,0)) 00201 A = assemble_on_cell(form, "triangle", coeffs=[5.43]) 00202 # TODO: Assert correct result 00203 def testJitSplitTerms(self):
def sfc_jit::test::SFCJitTest::testJitSource | ( | self | ) |
Definition at line 177 of file tests/sfc_jit/test.py.
00177 : 00178 "Test the source vector." 00179 element = FiniteElement("CG", "triangle", 1) 00180 v = TestFunction(element) 00181 f = Function(element) 00182 a = f*v*dx 00183 form = sfc.jit(a) 00184 self.assertTrue(form.rank() == 1) 00185 self.assertTrue(form.num_coefficients() == 1) 00186 self.assertTrue(num_integrals(form) == (1,0,0)) 00187 A = assemble_on_cell(form, "triangle", coeffs=[3.14]) 00188 # TODO: Assert correct result 00189 def testJitMass(self):
def sfc_jit::test::SFCJitTest::testJitSplitTerms | ( | self | ) |
Definition at line 204 of file tests/sfc_jit/test.py.
00204 : 00205 "Test a form split over two foo*dx terms, using the mass matrix." 00206 element = FiniteElement("CG", "triangle", 1) 00207 v = TestFunction(element) 00208 u = TrialFunction(element) 00209 f = Function(element) 00210 a = u*v*dx + f*u*v*dx 00211 form = sfc.jit(a) 00212 self.assertTrue(form.rank() == 2) 00213 self.assertTrue(form.num_coefficients() == 1) 00214 self.assertTrue(num_integrals(form) == (1,0,0)) 00215 A = assemble_on_cell(form, "triangle", coeffs=[4.43]) 00216 # TODO: Assert correct result 00217 00218 def test(verbosity=0):
def sfc_jit::test::SFCJitTest::testJitVolumeInterval | ( | self | ) |
Definition at line 123 of file tests/sfc_jit/test.py.
00123 : 00124 self._testJitVolume("interval") 00125 def testJitVolumeTriangle(self):
def sfc_jit::test::SFCJitTest::testJitVolumeTetrahedron | ( | self | ) |
Definition at line 129 of file tests/sfc_jit/test.py.
00129 : 00130 self._testJitVolume("tetrahedron") 00131 def _testJitVolumeQuadrilateral(self): # Not supported by dolfin yet
def sfc_jit::test::SFCJitTest::testJitVolumeTriangle | ( | self | ) |
Definition at line 126 of file tests/sfc_jit/test.py.
00126 : 00127 self._testJitVolume("triangle") 00128 def testJitVolumeTetrahedron(self):
def sfc_jit::test::SFCJitTest::testSetup | ( | self | ) |
Definition at line 109 of file tests/sfc_jit/test.py.
00109 : 00110 pass 00111 def _testJitVolume(self, polygon):