SyFi  0.3
test_sfc.test_jit_volumes.VolumeTest Class Reference

Inherits TempDirTestBase.

List of all members.

Public Member Functions

def __init__
def setUp
def tearDown
def testSetup
def testJitVolumeInterval
def testJitVolumeTriangle
def xtestJitVolumeTetrahedron
def testJitConstantInterval
def testJitConstantTriangle
def xtestJitConstantTetrahedron

Private Member Functions

def _testJitVolume
def _testJitVolumeQuadrilateral
def _testJitVolumeHexahedron
def _testJitConstant
def _testJitConstantQuadrilateral
def _testJitConstantHexahedron

Detailed Description

Definition at line 31 of file test_jit_volumes.py.


Constructor & Destructor Documentation

def test_sfc.test_jit_volumes.VolumeTest.__init__ (   self,
  args,
  kwargs 
)

Definition at line 32 of file test_jit_volumes.py.

00032 
00033     def __init__(self, *args, **kwargs):
00034         TempDirTestBase.__init__(self, *args, **kwargs)


Member Function Documentation

def test_sfc.test_jit_volumes.VolumeTest._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 73 of file test_jit_volumes.py.

References test_sfc::cell_assembly.assemble_on_cell(), test_sfc::cell_assembly.num_integrals(), and test_sfc.test_tempdir_base.TempDirTestBase.options.

Referenced by test_sfc.test_jit_volumes.VolumeTest._testJitConstantHexahedron(), test_sfc.test_jit_volumes.VolumeTest._testJitConstantQuadrilateral(), test_sfc.test_jit_volumes.VolumeTest.testJitConstantInterval(), test_sfc.test_jit_volumes.VolumeTest.testJitConstantTriangle(), and test_sfc.test_jit_volumes.VolumeTest.xtestJitConstantTetrahedron().

00073 
00074     def _testJitConstant(self, polygon, degree):
00075         """Test that the integral of a constant coefficient over a unit
00076         cell mesh equals the constant times the volume of the unit cell."""
00077         element = FiniteElement("CG", polygon, degree)
00078         f = Coefficient(element)
00079         a = f*dx
00080         form, module, formdata, prefix = sfc.jit(a, parameters = self.options)
00081 
00082         self.assertTrue(form.rank() == 0)
00083         self.assertTrue(form.num_coefficients() == 1)
00084         self.assertTrue(num_integrals(form) == (1,0,0))
00085         const = 1.23
00086         A = assemble_on_cell(form, polygon, coeffs=[const])
00087         self.assertAlmostEqual(A, const*cell2volume[polygon])

Definition at line 108 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitConstant().

00108 
00109     def _testJitConstantHexahedron(self): # Not supported by dolfin yet
00110         polygon = "hexahedron"
00111         self._testJitConstant(polygon, 1)
00112         self._testJitConstant(polygon, 2)

Definition at line 103 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitConstant().

00103 
00104     def _testJitConstantQuadrilateral(self): # Not supported by dolfin yet
00105         polygon = "quadrilateral"
00106         self._testJitConstant(polygon, 1)
00107         self._testJitConstant(polygon, 2)

def test_sfc.test_jit_volumes.VolumeTest._testJitVolume (   self,
  polygon 
) [private]
Test that the integral of 1.0 over a unit cell
equals the length/area/volume of the unit cell.

Definition at line 45 of file test_jit_volumes.py.

Referenced by test_sfc.test_jit_volumes.VolumeTest._testJitVolumeHexahedron(), test_sfc.test_jit_volumes.VolumeTest._testJitVolumeQuadrilateral(), test_sfc.test_jit_volumes.VolumeTest.testJitVolumeInterval(), test_sfc.test_jit_volumes.VolumeTest.testJitVolumeTriangle(), and test_sfc.test_jit_volumes.VolumeTest.xtestJitVolumeTetrahedron().

00045 
00046     def _testJitVolume(self, polygon):
00047         """Test that the integral of 1.0 over a unit cell
00048         equals the length/area/volume of the unit cell."""
00049         c = Constant(polygon)
00050         a = c*dx
00051         form, module, formdata, prefix = sfc.jit(a, parameters = self.options)
00052 
00053         self.assertTrue(form.rank() == 0)
00054         self.assertTrue(form.num_coefficients() == 1)
00055         self.assertTrue(num_integrals(form) == (1,0,0))
00056         A = assemble_on_cell(form, polygon, coeffs=[1.0])
00057         self.assertAlmostEqual(A, cell2volume[polygon])

Definition at line 70 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitVolume().

00070 
00071     def _testJitVolumeHexahedron(self): # Not supported by dolfin yet
00072         self._testJitVolume("hexahedron")

Definition at line 67 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitVolume().

00067 
00068     def _testJitVolumeQuadrilateral(self): # Not supported by dolfin yet
00069         self._testJitVolume("quadrilateral")

Definition at line 35 of file test_jit_volumes.py.

00035 
00036     def setUp(self):
00037         TempDirTestBase.setUp(self)

Definition at line 38 of file test_jit_volumes.py.

00038 
00039     def tearDown(self):
00040         TempDirTestBase.tearDown(self)

Definition at line 88 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitConstant().

00088 
00089     def testJitConstantInterval(self):
00090         polygon = "interval"
00091         self._testJitConstant(polygon, 1)
00092         self._testJitConstant(polygon, 2)

Definition at line 93 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitConstant().

00093 
00094     def testJitConstantTriangle(self):
00095         polygon = "triangle"
00096         self._testJitConstant(polygon, 1)
00097         self._testJitConstant(polygon, 2)

Definition at line 41 of file test_jit_volumes.py.

00041 
00042     def testSetup(self):
00043         "Just see that setUp and tearDown works."
00044         pass

Definition at line 98 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitConstant().

00098 
00099     def xtestJitConstantTetrahedron(self): # FIXME: Failing!
00100         polygon = "tetrahedron"
00101         self._testJitConstant(polygon, 1)
00102         self._testJitConstant(polygon, 2)

Definition at line 64 of file test_jit_volumes.py.

References test_sfc.test_jit_volumes.VolumeTest._testJitVolume().

00064 
00065     def xtestJitVolumeTetrahedron(self): # FIXME: Failing!
00066         self._testJitVolume("tetrahedron")


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