SyFi  0.3
sfc_jit::test Namespace Reference

Classes

class  SFCJitTest

Functions

def num_integrals
def UnitCell
def assemble_on_cell
def test

Variables

dictionary cell2dim = { "interval": 1, "triangle": 2, "tetrahedron": 3, "quadrilateral": 2, "hexahedron": 3 }
dictionary cell2volume = { "interval": 1.0, "triangle": 0.5, "tetrahedron": 1.0/6.0, "quadrilateral": 1.0, "hexahedron": 1.0 }
string _test_temp_dir = "temp_dir"
string _done_test_temp_dir = "done_temp_dir"

Function Documentation

def sfc_jit.test.assemble_on_cell (   form,
  celltype,
  coeffs 
)

Definition at line 83 of file tests/sfc_jit/test.py.

References UnitCell().

Referenced by sfc_jit.test.SFCJitTest._testJitConstant(), sfc_jit.test.SFCJitTest.testJitMass(), sfc_jit.test.SFCJitTest.testJitSource(), and sfc_jit.test.SFCJitTest.testJitSplitTerms().

00083 
00084 def assemble_on_cell(form, celltype, coeffs):
00085     "Assemble UFC form on a unit cell mesh and return the result as a float or numpy array."
00086     mesh = UnitCell(celltype)
00087     A = assemble(form, mesh, coeffs)
00088     if isinstance(A, float):
00089         return A
00090     return A.array()

Definition at line 34 of file tests/sfc_jit/test.py.

Referenced by sfc_jit.test.SFCJitTest._testJitConstant(), sfc_jit.test.SFCJitTest.testJitMass(), sfc_jit.test.SFCJitTest.testJitSource(), and sfc_jit.test.SFCJitTest.testJitSplitTerms().

00034 
00035 def num_integrals(form):
00036     return (form.num_cell_integrals(), form.num_exterior_facet_integrals(), form.num_interior_facet_integrals())

def sfc_jit.test.test (   verbosity = 0)

Definition at line 219 of file tests/sfc_jit/test.py.

00219 
00220 def test(verbosity=0):
00221     shutil.rmtree(_done_test_temp_dir, ignore_errors=True)
00222     os.mkdir(_done_test_temp_dir)
00223     
00224     classes = [SFCJitTest]
00225     suites = [unittest.makeSuite(c) for c in classes]
00226     testsuites = unittest.TestSuite(suites)
00227     unittest.TextTestRunner(verbosity=verbosity).run(testsuites)

def sfc_jit.test.UnitCell (   celltype)

Definition at line 42 of file tests/sfc_jit/test.py.

Referenced by assemble_on_cell().

00042 
00043 def UnitCell(celltype):
00044     tdim = cell2dim[celltype]
00045     gdim = tdim
00046     mesh = Mesh()
00047     editor = MeshEditor()
00048     editor.open(mesh, celltype, tdim, gdim)
00049     if celltype == "interval":
00050         vertices = [(0.0,),
00051                     (1.0,)]
00052     if celltype == "triangle":
00053         vertices = [(0.0, 0.0),
00054                     (1.0, 0.0),
00055                     (0.0, 1.0)]
00056     if celltype == "tetrahedron":
00057         vertices = [(0.0, 0.0, 0.0),
00058                     (1.0, 0.0, 0.0),
00059                     (0.0, 1.0, 0.0),
00060                     (0.0, 0.0, 1.0)]
00061     if celltype == "quadrilateral":
00062         vertices = [(0.0, 0.0),
00063                     (1.0, 0.0),
00064                     (1.0, 1.0),
00065                     (0.0, 1.0)]
00066     if celltype == "hexahedron":
00067         vertices = [(0.0, 0.0, 0.0),
00068                     (1.0, 0.0, 0.0),
00069                     (1.0, 1.0, 0.0),
00070                     (0.0, 1.0, 0.0),
00071                     (0.0, 0.0, 1.0),
00072                     (1.0, 0.0, 1.0),
00073                     (1.0, 1.0, 1.0),
00074                     (0.0, 1.0, 1.0)]
00075     editor.initVertices(len(vertices))
00076     editor.initCells(1)
00077     for i, p in enumerate(vertices):
00078         editor.addVertex(i, *p)
00079     editor.addCell(0, *range(len(vertices)))
00080     editor.close()
00081     return mesh
00082 


Variable Documentation

string sfc_jit::test::_done_test_temp_dir = "done_temp_dir"

Definition at line 92 of file tests/sfc_jit/test.py.

string sfc_jit::test::_test_temp_dir = "temp_dir"

Definition at line 91 of file tests/sfc_jit/test.py.

dictionary sfc_jit::test::cell2dim = { "interval": 1, "triangle": 2, "tetrahedron": 3, "quadrilateral": 2, "hexahedron": 3 }

Definition at line 37 of file tests/sfc_jit/test.py.

dictionary sfc_jit::test::cell2volume = { "interval": 1.0, "triangle": 0.5, "tetrahedron": 1.0/6.0, "quadrilateral": 1.0, "hexahedron": 1.0 }

Definition at line 39 of file tests/sfc_jit/test.py.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines