SyFi  0.3
test_sfc.test_geometry_code.GeometryTestMixin Class Reference
Inheritance diagram for test_sfc.test_geometry_code.GeometryTestMixin:
test_sfc.test_geometry_code.SfcQuadratureGeometryTest test_sfc.test_geometry_code.SfcSymbolicGeometryTest test_sfc.test_geometry_code.UflacsGeometryTest

List of all members.

Public Member Functions

def assertAlmostEqualNumpy
def assertAssembledAlmostEqual
def test_constant_interval
def test_constant_triangle
def test_constant_tetrahedron
def test_volume_interval
def test_volume_triangle
def test_volume_tetrahedron
def xtest_volume_quadrilateral
def xtest_volume_hexahedron
def test_coordinates_interval
def test_coordinates_triangle
def test_coordinates_tetrahedron
def xtest_coordinates_quadrilateral
def xtest_coordinates_hexahedron

Private Member Functions

def _test_constant
def _test_volume
def _test_coordinates

Detailed Description

Definition at line 113 of file test_geometry_code.py.


Member Function Documentation

Test that the integral of 1.0 over a unit cell
equals the length/area/volume of the unit cell.

Definition at line 132 of file test_geometry_code.py.

References test_sfc.test_geometry_code.GeometryTestMixin.assertAssembledAlmostEqual(), and test_sfc.test_form_argument_code.FormArgumentTestMixin.assertAssembledAlmostEqual().

Referenced by test_sfc.test_geometry_code.GeometryTestMixin.test_constant_interval(), test_sfc.test_geometry_code.GeometryTestMixin.test_constant_tetrahedron(), and test_sfc.test_geometry_code.GeometryTestMixin.test_constant_triangle().

00132 
00133     def _test_constant(self, cell):
00134         """Test that the integral of 1.0 over a unit cell
00135         equals the length/area/volume of the unit cell."""
00136         D = cell2volume[cell]
00137         c = Constant(cell)
00138         a = c*dx
00139         coeffs = [1.2]
00140         expected = 1.2 * D
00141         self.assertAssembledAlmostEqual(a, cell, coeffs, expected)

def test_sfc.test_geometry_code.GeometryTestMixin.assertAlmostEqualNumpy (   self,
  actual,
  expected,
  eps = 1e-8 
)

Definition at line 115 of file test_geometry_code.py.

Referenced by test_sfc.test_geometry_code.GeometryTestMixin.assertAssembledAlmostEqual().

00115 
00116     def assertAlmostEqualNumpy(self, actual, expected, eps=1e-8):
00117         self.assertEqual(actual.shape, expected.shape)
00118         mdiff = expected - actual
00119         vdiff = mdiff.reshape((product(mdiff.shape),))
00120         sdiff = numpy.dot(vdiff,vdiff)
00121         self.assertAlmostEqual(sdiff, 0.0, eps)

def test_sfc.test_geometry_code.GeometryTestMixin.assertAssembledAlmostEqual (   self,
  ufl_form,
  ufl_cell,
  coeffs,
  expected 
)
Test that the integral of 1.0 over a unit cell
equals the length/area/volume of the unit cell.

Definition at line 122 of file test_geometry_code.py.

References test_sfc::cell_assembly.assemble_on_cell(), test_sfc.test_geometry_code.GeometryTestMixin.assertAlmostEqualNumpy(), test_sfc.test_form_argument_code.FormArgumentTestMixin.assertAlmostEqualNumpy(), and test_sfc.test_tempdir_base.TempDirTestBase.options.

Referenced by test_sfc.test_geometry_code.GeometryTestMixin._test_constant(), test_sfc.test_geometry_code.GeometryTestMixin._test_coordinates(), and test_sfc.test_geometry_code.GeometryTestMixin._test_volume().

00122 
00123     def assertAssembledAlmostEqual(self, ufl_form, ufl_cell, coeffs, expected):
00124         """Test that the integral of 1.0 over a unit cell
00125         equals the length/area/volume of the unit cell."""
00126         ufc_form, module, formdata, prefix = sfc.jit(ufl_form, parameters=self.options)
00127         assembled = assemble_on_cell(ufc_form, ufl_cell, coeffs=coeffs)
00128         if isinstance(assembled, float):
00129             self.assertAlmostEqual(assembled, expected)
00130         else:
00131             self.assertAlmostEqualNumpy(assembled, expected)

Definition at line 189 of file test_geometry_code.py.

References test_sfc.test_geometry_code.GeometryTestMixin._test_coordinates().

00189 
00190     def xtest_coordinates_hexahedron(self): # TODO: Not supported by dolfin yet
00191         self._test_coordinates(ufl.hexahedron, 3.0/3.0) # FIXME

Definition at line 187 of file test_geometry_code.py.

References test_sfc.test_geometry_code.GeometryTestMixin._test_coordinates().

00187 
00188     def xtest_coordinates_quadrilateral(self): # TODO: Not supported by dolfin yet
        self._test_coordinates(ufl.quadrilateral, 2.0/3.0) # FIXME

Definition at line 166 of file test_geometry_code.py.

References test_sfc.test_geometry_code.GeometryTestMixin._test_volume().

00166 
00167     def xtest_volume_hexahedron(self): # TODO: Not supported by dolfin yet
00168         self._test_volume(ufl.hexahedron)

Definition at line 164 of file test_geometry_code.py.

References test_sfc.test_geometry_code.GeometryTestMixin._test_volume().

00164 
00165     def xtest_volume_quadrilateral(self): # TODO: Not supported by dolfin yet
        self._test_volume(ufl.quadrilateral)

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