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