SyFi
0.3
|
Functions | |
def | UnitCell |
def | assemble_on_cell |
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 } |
def cell_assembly.assemble_on_cell | ( | form, | |
celltype, | |||
coeffs | |||
) |
Definition at line 49 of file cell_assembly.py.
References UnitCell().
Referenced by volumes.VolumeTest._testJitConstant(), jit.JitTest.testJitSource(), jit.JitTest.testJitSplitTerms(), jit.JitTest.testJitWeightedMass(), element_indexing.ElementIndexingTest.testScalarCoefficient(), and element_indexing.ElementIndexingTest.testVectorCoefficient().
00049 00050 def assemble_on_cell(form, celltype, coeffs): 00051 "Assemble UFC form on a unit cell mesh and return the result as a float or numpy array." 00052 mesh = UnitCell(celltype) 00053 A = assemble(form, mesh, coeffs) 00054 if isinstance(A, float): 00055 return A 00056 return A.array() 00057
def cell_assembly.UnitCell | ( | celltype | ) |
Definition at line 8 of file cell_assembly.py.
Referenced by assemble_on_cell().
00008 00009 def UnitCell(celltype): 00010 tdim = cell2dim[celltype] 00011 gdim = tdim 00012 mesh = Mesh() 00013 editor = MeshEditor() 00014 editor.open(mesh, celltype, tdim, gdim) 00015 if celltype == "interval": 00016 vertices = [(0.0,), 00017 (1.0,)] 00018 if celltype == "triangle": 00019 vertices = [(0.0, 0.0), 00020 (1.0, 0.0), 00021 (0.0, 1.0)] 00022 if celltype == "tetrahedron": 00023 vertices = [(0.0, 0.0, 0.0), 00024 (1.0, 0.0, 0.0), 00025 (0.0, 1.0, 0.0), 00026 (0.0, 0.0, 1.0)] 00027 if celltype == "quadrilateral": 00028 vertices = [(0.0, 0.0), 00029 (1.0, 0.0), 00030 (1.0, 1.0), 00031 (0.0, 1.0)] 00032 if celltype == "hexahedron": 00033 vertices = [(0.0, 0.0, 0.0), 00034 (1.0, 0.0, 0.0), 00035 (1.0, 1.0, 0.0), 00036 (0.0, 1.0, 0.0), 00037 (0.0, 0.0, 1.0), 00038 (1.0, 0.0, 1.0), 00039 (1.0, 1.0, 1.0), 00040 (0.0, 1.0, 1.0)] 00041 editor.initVertices(len(vertices)) 00042 editor.initCells(1) 00043 for i, p in enumerate(vertices): 00044 editor.addVertex(i, *p) 00045 editor.addCell(0, *range(len(vertices))) 00046 editor.close() 00047 return mesh 00048
dictionary cell_assembly::cell2dim = { "interval": 1, "triangle": 2, "tetrahedron": 3, "quadrilateral": 2, "hexahedron": 3 } |
Definition at line 4 of file cell_assembly.py.
dictionary cell_assembly::cell2volume = { "interval": 1.0, "triangle": 0.5, "tetrahedron": 1.0/6.0, "quadrilateral": 1.0, "hexahedron": 1.0 } |
Definition at line 6 of file cell_assembly.py.