def forms(): for rep in range(nreps): for cell in cells: d = cell.geometric_dimension() for degree in degrees: for family in families: V = FiniteElement(family, cell, degree) W = VectorElement(family, cell, degree) W2 = VectorElement(family, cell, degree, dim=d+1) T = TensorElement(family, cell, degree) S = TensorElement(family, cell, degree, symmetry=True) S2 = TensorElement(family, cell, degree, shape=(d, d), symmetry={(0, 0): (1, 1)}) elements = [V, W, W2, T, S, S2] assert len(elements) == nelm for H in elements[:nelm]: # Keep number and count fixed, we're not testing that here a = Argument(H, number=1) c = Coefficient(H, count=1) renumbering = domain_numbering(*cells) renumbering[c] = 0 for f in (a, c): expr = inner(f, f) reprs.add(repr(expr)) hashes.add(hash(expr)) yield compute_terminal_hashdata(expr, renumbering)
def forms(): for rep in range(nreps): for cell in cells: for k in counts: V = FiniteElement("CG", cell, 2) f = Argument(V, k) g = Argument(V, k+2) expr = inner(f, g) reprs.add(repr(expr)) hashes.add(hash(expr)) yield compute_terminal_hashdata(expr, domain_numbering(*cells))
def forms(): i, j = indices(2) for d in (2, 3): domain = as_domain({2: triangle, 3: tetrahedron}[d]) x = SpatialCoordinate(domain) I = Identity(d) for fv in (1.1, 2.2): for iv in (5, 7): expr = (I[0, j]*(fv*x[j]))**iv reprs.add(repr(expr)) hashes.add(hash(expr)) yield compute_terminal_hashdata(expr, {domain: 0})
def forms(): for rep in range(nreps): for cell in cells: for k in counts: V = FiniteElement("CG", cell, 2) f = Coefficient(V, count=k) g = Coefficient(V, count=k+2) expr = inner(f, g) renumbering = domain_numbering(*cells) renumbering[f] = 0 renumbering[g] = 1 reprs.add(repr(expr)) hashes.add(hash(expr)) yield compute_terminal_hashdata(expr, renumbering)
def forms(): for rep in range(nreps): for domain in domains: V = FunctionSpace(domain, FiniteElement("CG", domain.ufl_cell(), 2)) f = Coefficient(V, count=0) v = TestFunction(V) x = SpatialCoordinate(domain) n = FacetNormal(domain) exprs = [inner(x, n), inner(f, v)] assert num_exprs == len(exprs) # Assumed in checks below # This numbering needs to be recreated to count 'domain' and 'f' as 0 each time: renumbering = {f: 0, domain: 0} for expr in exprs: reprs.add(repr(expr)) hashes.add(hash(expr)) yield compute_terminal_hashdata(expr, renumbering)
def forms(): i, j = indices(2) cells = (triangle, tetrahedron) for cell in cells: d = cell.geometric_dimension() x = SpatialCoordinate(cell) n = FacetNormal(cell) r = Circumradius(cell) a = FacetArea(cell) # s = CellSurfaceArea(cell) v = CellVolume(cell) I = Identity(d) ws = (x, n) qs = (r, a, v) # , s) for w in ws: for q in qs: expr = (I[0, j]*(q*w[j])) reprs.add(repr(expr)) hashes.add(hash(expr)) yield compute_terminal_hashdata(expr, domain_numbering(*cells))
def forms(): i, j = indices(2) cells = (triangle, tetrahedron) for cell in cells: d = cell.geometric_dimension() x = SpatialCoordinate(cell) n = FacetNormal(cell) h = CellDiameter(cell) r = Circumradius(cell) a = FacetArea(cell) # s = CellSurfaceArea(cell) v = CellVolume(cell) I = Identity(d) ws = (x, n) qs = (h, r, a, v) # , s) for w in ws: for q in qs: expr = (I[0, j]*(q*w[j])) reprs.add(repr(expr)) hashes.add(hash(expr)) yield compute_terminal_hashdata(expr, domain_numbering(*cells))