diff --git a/docs/source/firedrake_usa_25.rst b/docs/source/firedrake_usa_25.rst index e1d7a2b293..8cac5f4a9c 100644 --- a/docs/source/firedrake_usa_25.rst +++ b/docs/source/firedrake_usa_25.rst @@ -27,13 +27,13 @@ The conference will begin with a tutorial session on the morning of 28 February Conference venue ---------------- -The conference will take place in the Bill Daniel Student Center in Room 202 in the heart of the Baylor campus. +The conference will take place in the Bill Daniel Student Center in Room 202 in the heart of the Baylor campus. A `campus map `__ is available online, and both Apple Maps and Google Maps accurately locate the Bill Daniel Student Center. Accommodation ------------- -We will be reserving a room block in a hotel near campus. More information to follow. +We have reserved a block of hotel rooms at SpringHill Suites Waco, about a 15 minute walk from the Bill Daniel Student Center. Follow `this link `__ to hold your room. The group rate is only available until 20 January 2025. Conference dinner @@ -53,9 +53,9 @@ The registration fees are as follows: :widths: 25 50 :header-rows: 0 - * - Student + * - Student: - $50 - * - Non-student + * - Non-student: - $200 The `SIAM Texas-Louisiana Section `__ is providing some support for students currently attending universities in Texas or Louisiana to attend. @@ -66,7 +66,7 @@ Conference registration is coming soon. Abstract submission ------------------- -Abstract submission will open soon via Easy Chair. +Abstracts can be submitted `via EasyChair `__. @@ -79,17 +79,11 @@ The conference has been kindly supported by the SIAM TX-LA Section and EPSRC. Travel to Waco -------------- -* By air +* By air: Waco has a small airport. There is daily service between Waco and Dallas/Fort Worth International Airport via American Airlines. - Waco has a small airport. There is daily service between Waco and Dallas/Fort Worth International Airport via American Airlines. +* By ground: We are less than two hours by car from the Dallas and Austin airports, and just under three hours from Bush Intercontinental Airport in Houston. Additionally, Waco is reachable by bus services such as Greyhound and FlixBus. -* By ground - - We are less than two hours by car from the Dallas and Austin airports, and just under three hours from Bush Intercontinental Airport in Houston. Additionally, Waco is reachable by bus services such as Greyhound and FlixBus. - -* Parking on campus - - Baylor has plenty of visitor parking for your personal or rental vehicle, but conslut `these instructions __` and make sure to `register your vehicle __`. +* Parking on campus: Baylor has plenty of visitor parking for your personal or rental vehicle, but consult `these instructions `__ and make sure to `register your vehicle `__. diff --git a/firedrake/cython/dmcommon.pyx b/firedrake/cython/dmcommon.pyx index eda8470d4e..8b8e1da170 100644 --- a/firedrake/cython/dmcommon.pyx +++ b/firedrake/cython/dmcommon.pyx @@ -3358,7 +3358,7 @@ def make_global_numbering(PETSc.Section lsec, PETSc.Section gsec): cdef: PetscInt c, cc, p, pStart, pEnd, dof, cdof, loff, goff np.ndarray val - PetscInt *dof_array = NULL + const PetscInt *dof_array = NULL val = np.empty(lsec.getStorageSize(), dtype=IntType) pStart, pEnd = lsec.getChart() diff --git a/firedrake/interpolation.py b/firedrake/interpolation.py index e8555ba7dd..0a598ba34b 100644 --- a/firedrake/interpolation.py +++ b/firedrake/interpolation.py @@ -1092,8 +1092,7 @@ def _interpolator(V, tensor, expr, subset, arguments, access, bcs=None): # interpolation) we have to pass the finat element we construct # here. Ideally we would only pass the UFL element through. kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(), - domain=source_mesh, parameters=parameters, - log=PETSc.Log.isActive()) + domain=source_mesh, parameters=parameters) ast = kernel.ast oriented = kernel.oriented needs_cell_sizes = kernel.needs_cell_sizes @@ -1221,10 +1220,9 @@ def _interpolator(V, tensor, expr, subset, arguments, access, bcs=None): f"firedrake-tsfc-expression-kernel-cache-uid{os.getuid()}") -def _compile_expression_key(comm, expr, to_element, ufl_element, domain, parameters, log): +def _compile_expression_key(comm, expr, to_element, ufl_element, domain, parameters): """Generate a cache key suitable for :func:`tsfc.compile_expression_dual_evaluation`.""" - key = hash_expr(expr), hash(ufl_element), utils.tuplify(parameters), log - return key + return (hash_expr(expr), hash(ufl_element), utils.tuplify(parameters)) @memory_and_disk_cache( diff --git a/firedrake/parloops.py b/firedrake/parloops.py index 08cb57e3d8..0a33cd4ae5 100644 --- a/firedrake/parloops.py +++ b/firedrake/parloops.py @@ -171,7 +171,7 @@ def par_loop(kernel, measure, args, kernel_kwargs=None, **kwargs): domain = '{[i]: 0 <= i < A.dofs}' instructions = ''' for i - A[i] = max(A[i], B[0]) + A[i] = fmax(A[i], B[0]) end ''' par_loop((domain, instructions), dx, {'A' : (A, RW), 'B': (B, READ)}) diff --git a/firedrake/preconditioners/pmg.py b/firedrake/preconditioners/pmg.py index 251f585cbe..87524336ee 100644 --- a/firedrake/preconditioners/pmg.py +++ b/firedrake/preconditioners/pmg.py @@ -530,7 +530,7 @@ def coarsen_bc_value(self, bc, cV): def prolongation_transfer_kernel_action(Vf, expr): to_element = create_element(Vf.ufl_element()) - kernel = compile_expression_dual_evaluation(expr, to_element, Vf.ufl_element(), log=PETSc.Log.isActive()) + kernel = compile_expression_dual_evaluation(expr, to_element, Vf.ufl_element()) coefficients = extract_numbered_coefficients(expr, kernel.coefficient_numbers) if kernel.needs_external_coords: coefficients = [Vf.mesh().coordinates] + coefficients diff --git a/firedrake/slate/slac/compiler.py b/firedrake/slate/slac/compiler.py index 7e1b14281c..d9e7bced02 100644 --- a/firedrake/slate/slac/compiler.py +++ b/firedrake/slate/slac/compiler.py @@ -237,4 +237,4 @@ def gem_to_loopy(gem_expr, var2terminal, scalar_type): # Part B: impero_c to loopy output_arg = OutputKernelArg(output_loopy_arg) - return generate_loopy(impero_c, args, scalar_type, "slate_loopy", [], log=PETSc.Log.isActive()), output_arg + return generate_loopy(impero_c, args, scalar_type, "slate_loopy", []), output_arg diff --git a/firedrake/tsfc_interface.py b/firedrake/tsfc_interface.py index a4a57ae0cb..ba10d79507 100644 --- a/firedrake/tsfc_interface.py +++ b/firedrake/tsfc_interface.py @@ -53,8 +53,8 @@ ) -def tsfc_compile_form_hashkey(form, prefix, parameters, interface, diagonal, log): - # Drop prefix as it's only used for naming and log +def tsfc_compile_form_hashkey(form, prefix, parameters, interface, diagonal): + # Drop prefix as it's only used for naming return default_parallel_hashkey(form.signature(), prefix, parameters, interface, diagonal) @@ -94,7 +94,7 @@ def __init__( """ tree = tsfc_compile_form(form, prefix=name, parameters=parameters, interface=interface, - diagonal=diagonal, log=PETSc.Log.isActive()) + diagonal=diagonal) kernels = [] for kernel in tree: # Individual kernels do not have to use all of the coefficients diff --git a/firedrake/utility_meshes.py b/firedrake/utility_meshes.py index 4f2a0f34f1..99d687449e 100644 --- a/firedrake/utility_meshes.py +++ b/firedrake/utility_meshes.py @@ -24,6 +24,7 @@ as_tensor, dot, And, + Or, sin, cos, real @@ -1800,6 +1801,8 @@ def PeriodicBoxMesh( Lx, Ly, Lz, + directions=(True, True, True), + hexahedral=False, reorder=None, distribution_parameters=None, comm=COMM_WORLD, @@ -1809,105 +1812,185 @@ def PeriodicBoxMesh( ): """Generate a periodic mesh of a 3D box. - :arg nx: The number of cells in the x direction - :arg ny: The number of cells in the y direction - :arg nz: The number of cells in the z direction - :arg Lx: The extent in the x direction - :arg Ly: The extent in the y direction - :arg Lz: The extent in the z direction - :kwarg reorder: (optional), should the mesh be reordered? - :kwarg distribution_parameters: options controlling mesh - distribution, see :func:`.Mesh` for details. - :kwarg comm: Optional communicator to build the mesh on. - :kwarg name: Optional name of the mesh. - :kwarg distribution_name: the name of parallel distribution used - when checkpointing; if `None`, the name is automatically - generated. - :kwarg permutation_name: the name of entity permutation (reordering) used - when checkpointing; if `None`, the name is automatically - generated. + Parameters + ---------- + nx : int + Number of cells in the x direction. + ny : int + Number of cells in the y direction. + nz : int + Number of cells in the z direction. + Lx : float + Extent in the x direction. + Ly : float + Extent in the y direction. + Lz : float + Extent in the z direction. + directions : list or tuple + Directions of periodicity. + hexahedral : bool + Whether to make hexahedral mesh or not. + reorder : bool or None + Whether to reorder the mesh. + distribution_parameters : dict or None + Options controlling mesh distribution, see :func:`.Mesh` for details. + comm : + Communicator to build the mesh on. + name : str + Name of the mesh. + distribution_name : str or None + Name of parallel distribution used when checkpointing; + if `None`, the name is automatically generated. + permutation_name : str or None + Name of entity permutation (reordering) used when checkpointing; + if `None`, the name is automatically generated. + + Returns + ------- + MeshGeometry + The mesh. + + Notes + ----- + + The boundary surfaces are numbered as follows: + + * 1: plane x == 0 + * 2: plane x == 1 + * 3: plane y == 0 + * 4: plane y == 1 + * 5: plane z == 0 + * 6: plane z == 1 + + where periodic surfaces are regarded as interior, for which dS integral is to be used. + """ for n in (nx, ny, nz): if n < 3: raise ValueError( "3D periodic meshes with fewer than 3 cells are not currently supported" ) + if hexahedral: + if len(directions) != 3: + raise ValueError(f"directions must have exactly dim (=3) elements : Got {directions}") + plex = PETSc.DMPlex().createBoxMesh( + (nx, ny, nz), + lower=(0., 0., 0.), + upper=(Lx, Ly, Lz), + simplex=False, + periodic=directions, + interpolate=True, + sparseLocalize=False, + comm=comm, + ) + m = mesh.Mesh( + plex, + reorder=reorder, + distribution_parameters=distribution_parameters, + name=name, + distribution_name=distribution_name, + permutation_name=permutation_name, + comm=comm) + x, y, z = SpatialCoordinate(m) + V = FunctionSpace(m, "Q", 2) + eps = min([Lx / nx, Ly / ny, Lz / nz]) / 1000. + if directions[0]: # x + fx0 = Function(V).interpolate(conditional(Or(x < eps, x > Lx - eps), 1., 0.)) + fx1 = fx0 + else: + fx0 = Function(V).interpolate(conditional(x < eps, 1., 0.)) + fx1 = Function(V).interpolate(conditional(x > Lx - eps, 1., 0.)) + if directions[1]: # y + fy0 = Function(V).interpolate(conditional(Or(y < eps, y > Ly - eps), 1., 0.)) + fy1 = fy0 + else: + fy0 = Function(V).interpolate(conditional(y < eps, 1., 0.)) + fy1 = Function(V).interpolate(conditional(y > Ly - eps, 1., 0.)) + if directions[2]: # z + fz0 = Function(V).interpolate(conditional(Or(z < eps, z > Lz - eps), 1., 0.)) + fz1 = fz0 + else: + fz0 = Function(V).interpolate(conditional(z < eps, 1., 0.)) + fz1 = Function(V).interpolate(conditional(z > Lz - eps, 1., 0.)) + return mesh.RelabeledMesh(m, [fx0, fx1, fy0, fy1, fz0, fz1], [1, 2, 3, 4, 5, 6], name=name) + else: + if tuple(directions) != (True, True, True): + raise NotImplementedError("Can only specify directions with hexahedral = True") + xcoords = np.arange(0.0, Lx, Lx / nx, dtype=np.double) + ycoords = np.arange(0.0, Ly, Ly / ny, dtype=np.double) + zcoords = np.arange(0.0, Lz, Lz / nz, dtype=np.double) + coords = ( + np.asarray(np.meshgrid(xcoords, ycoords, zcoords)).swapaxes(0, 3).reshape(-1, 3) + ) + i, j, k = np.meshgrid( + np.arange(nx, dtype=np.int32), + np.arange(ny, dtype=np.int32), + np.arange(nz, dtype=np.int32), + ) + v0 = k * nx * ny + j * nx + i + v1 = k * nx * ny + j * nx + (i + 1) % nx + v2 = k * nx * ny + ((j + 1) % ny) * nx + i + v3 = k * nx * ny + ((j + 1) % ny) * nx + (i + 1) % nx + v4 = ((k + 1) % nz) * nx * ny + j * nx + i + v5 = ((k + 1) % nz) * nx * ny + j * nx + (i + 1) % nx + v6 = ((k + 1) % nz) * nx * ny + ((j + 1) % ny) * nx + i + v7 = ((k + 1) % nz) * nx * ny + ((j + 1) % ny) * nx + (i + 1) % nx - xcoords = np.arange(0.0, Lx, Lx / nx, dtype=np.double) - ycoords = np.arange(0.0, Ly, Ly / ny, dtype=np.double) - zcoords = np.arange(0.0, Lz, Lz / nz, dtype=np.double) - coords = ( - np.asarray(np.meshgrid(xcoords, ycoords, zcoords)).swapaxes(0, 3).reshape(-1, 3) - ) - i, j, k = np.meshgrid( - np.arange(nx, dtype=np.int32), - np.arange(ny, dtype=np.int32), - np.arange(nz, dtype=np.int32), - ) - v0 = k * nx * ny + j * nx + i - v1 = k * nx * ny + j * nx + (i + 1) % nx - v2 = k * nx * ny + ((j + 1) % ny) * nx + i - v3 = k * nx * ny + ((j + 1) % ny) * nx + (i + 1) % nx - v4 = ((k + 1) % nz) * nx * ny + j * nx + i - v5 = ((k + 1) % nz) * nx * ny + j * nx + (i + 1) % nx - v6 = ((k + 1) % nz) * nx * ny + ((j + 1) % ny) * nx + i - v7 = ((k + 1) % nz) * nx * ny + ((j + 1) % ny) * nx + (i + 1) % nx - - cells = [ - [v0, v1, v3, v7], - [v0, v1, v7, v5], - [v0, v5, v7, v4], - [v0, v3, v2, v7], - [v0, v6, v4, v7], - [v0, v2, v6, v7], - ] - cells = np.asarray(cells).reshape(-1, ny, nx, nz).swapaxes(0, 3).reshape(-1, 4) - plex = mesh.plex_from_cell_list( - 3, cells, coords, comm, mesh._generate_default_mesh_topology_name(name) - ) - m = mesh.Mesh( - plex, - reorder=reorder_noop, - distribution_parameters=distribution_parameters_no_overlap, - name=name, - distribution_name=distribution_name, - permutation_name=permutation_name, - comm=comm, - ) + cells = [ + [v0, v1, v3, v7], + [v0, v1, v7, v5], + [v0, v5, v7, v4], + [v0, v3, v2, v7], + [v0, v6, v4, v7], + [v0, v2, v6, v7], + ] + cells = np.asarray(cells).reshape(-1, ny, nx, nz).swapaxes(0, 3).reshape(-1, 4) + plex = mesh.plex_from_cell_list( + 3, cells, coords, comm, mesh._generate_default_mesh_topology_name(name) + ) + m = mesh.Mesh( + plex, + reorder=reorder_noop, + distribution_parameters=distribution_parameters_no_overlap, + name=name, + distribution_name=distribution_name, + permutation_name=permutation_name, + comm=comm, + ) - new_coordinates = Function( - VectorFunctionSpace( - m, FiniteElement("DG", tetrahedron, 1, variant="equispaced") - ), - name=mesh._generate_default_mesh_coordinates_name(name), - ) - new_coordinates.interpolate(m.coordinates) + new_coordinates = Function( + VectorFunctionSpace( + m, FiniteElement("DG", tetrahedron, 1, variant="equispaced") + ), + name=mesh._generate_default_mesh_coordinates_name(name), + ) + new_coordinates.interpolate(m.coordinates) - coords_by_cell = new_coordinates.dat.data.reshape((-1, 4, 3)).transpose(1, 0, 2) + coords_by_cell = new_coordinates.dat.data.reshape((-1, 4, 3)).transpose(1, 0, 2) - # ensure we really got a view: - assert coords_by_cell.base is new_coordinates.dat.data.base + # ensure we really got a view: + assert coords_by_cell.base is new_coordinates.dat.data.base - # Find the cells that are too big in each direction because they are - # wrapped. - cell_is_wrapped = ( - (coords_by_cell.max(axis=0) - coords_by_cell.min(axis=0)) - / (Lx/nx, Ly/ny, Lz/nz) > 1.1 - ) + # Find the cells that are too big in each direction because they are + # wrapped. + cell_is_wrapped = ( + (coords_by_cell.max(axis=0) - coords_by_cell.min(axis=0)) + / (Lx/nx, Ly/ny, Lz/nz) > 1.1 + ) - # Move wrapped coordinates to the other end of the domain. - for i, extent in enumerate((Lx, Ly, Lz)): - coords = coords_by_cell[:, :, i] - coords[np.logical_and(cell_is_wrapped[:, i], np.isclose(coords, 0))] \ - = extent + # Move wrapped coordinates to the other end of the domain. + for i, extent in enumerate((Lx, Ly, Lz)): + coords = coords_by_cell[:, :, i] + coords[np.logical_and(cell_is_wrapped[:, i], np.isclose(coords, 0))] \ + = extent - return _postprocess_periodic_mesh(new_coordinates, - comm, - distribution_parameters, - reorder, - name, - distribution_name, - permutation_name) + return _postprocess_periodic_mesh(new_coordinates, + comm, + distribution_parameters, + reorder, + name, + distribution_name, + permutation_name) @PETSc.Log.EventDecorator() @@ -1915,6 +1998,8 @@ def PeriodicUnitCubeMesh( nx, ny, nz, + directions=(True, True, True), + hexahedral=False, reorder=None, distribution_parameters=None, comm=COMM_WORLD, @@ -1924,20 +2009,52 @@ def PeriodicUnitCubeMesh( ): """Generate a periodic mesh of a unit cube - :arg nx: The number of cells in the x direction - :arg ny: The number of cells in the y direction - :arg nz: The number of cells in the z direction - :kwarg reorder: (optional), should the mesh be reordered? - :kwarg distribution_parameters: options controlling mesh - distribution, see :func:`.Mesh` for details. - :kwarg comm: Optional communicator to build the mesh on. - :kwarg name: Optional name of the mesh. - :kwarg distribution_name: the name of parallel distribution used - when checkpointing; if `None`, the name is automatically - generated. - :kwarg permutation_name: the name of entity permutation (reordering) used - when checkpointing; if `None`, the name is automatically - generated. + Parameters + ---------- + nx : int + Number of cells in the x direction. + ny : int + Number of cells in the y direction. + nz : int + Number of cells in the z direction. + directions : list or tuple + Directions of periodicity. + hexahedral : bool + Whether to make hexahedral mesh or not. + reorder : bool or None + Should the mesh be reordered? + distribution_parameters : dict or None + Options controlling mesh distribution, see :func:`.Mesh` for details. + comm : + Communicator to build the mesh on. + name : str + Name of the mesh. + distribution_name : str or None + Name of parallel distribution used when checkpointing; + if `None`, the name is automatically generated. + permutation_name : str or None + Name of entity permutation (reordering) used when checkpointing; + if `None`, the name is automatically generated. + + Returns + ------- + MeshGeometry + The mesh. + + Notes + ----- + + The boundary surfaces are numbered as follows: + + * 1: plane x == 0 + * 2: plane x == 1 + * 3: plane y == 0 + * 4: plane y == 1 + * 5: plane z == 0 + * 6: plane z == 1 + + where periodic surfaces are regarded as interior, for which dS integral is to be used. + """ return PeriodicBoxMesh( nx, @@ -1946,6 +2063,8 @@ def PeriodicUnitCubeMesh( 1.0, 1.0, 1.0, + directions=directions, + hexahedral=hexahedral, reorder=reorder, distribution_parameters=distribution_parameters, comm=comm, diff --git a/tests/firedrake/regression/test_mesh_generation.py b/tests/firedrake/regression/test_mesh_generation.py index 637b0a1502..d2efe2a8b4 100644 --- a/tests/firedrake/regression/test_mesh_generation.py +++ b/tests/firedrake/regression/test_mesh_generation.py @@ -476,6 +476,28 @@ def test_boxmesh_kind(kind, num_cells): assert m.num_cells() == num_cells +@pytest.mark.parallel(nprocs=2) +def test_periodic_unit_cube_hex_cell(): + mesh = PeriodicUnitCubeMesh(3, 3, 3, directions=[True, True, False], hexahedral=True) + x, y, z = SpatialCoordinate(mesh) + V = FunctionSpace(mesh, "CG", 3) + expr = (1 - x) * x + (1 - y) * y + z + f = Function(V).interpolate(expr) + error = assemble((f - expr) ** 2 * dx) + assert error < 1.e-30 + + +@pytest.mark.parallel(nprocs=4) +def test_periodic_unit_cube_hex_facet(): + mesh = PeriodicUnitCubeMesh(3, 3, 3, directions=[True, False, False], hexahedral=True) + for subdomain_id in [1, 2]: + area = assemble(Constant(1.) * dS(domain=mesh, subdomain_id=subdomain_id)) + assert abs(area - 1.0) < 1.e-15 + for subdomain_id in [3, 4, 5, 6]: + area = assemble(Constant(1.) * ds(domain=mesh, subdomain_id=subdomain_id)) + assert abs(area - 1.0) < 1.e-15 + + @pytest.mark.parallel(nprocs=4) def test_split_comm_dm_mesh(): nspace = 2 diff --git a/tsfc/driver.py b/tsfc/driver.py index 6e3c3baaf3..38a780a0ad 100644 --- a/tsfc/driver.py +++ b/tsfc/driver.py @@ -47,14 +47,13 @@ """ -def compile_form(form, prefix="form", parameters=None, interface=None, diagonal=False, log=False): +def compile_form(form, prefix="form", parameters=None, interface=None, diagonal=False): """Compiles a UFL form into a set of assembly kernels. :arg form: UFL form :arg prefix: kernel name will start with this string :arg parameters: parameters object :arg diagonal: Are we building a kernel for the diagonal of a rank-2 element tensor? - :arg log: bool if the Kernel should be profiled with Log events :returns: list of kernels """ cpu_time = time.time() @@ -71,7 +70,7 @@ def compile_form(form, prefix="form", parameters=None, interface=None, diagonal= kernels = [] for integral_data in fd.integral_data: start = time.time() - kernel = compile_integral(integral_data, fd, prefix, parameters, interface=interface, diagonal=diagonal, log=log) + kernel = compile_integral(integral_data, fd, prefix, parameters, interface=interface, diagonal=diagonal) if kernel is not None: kernels.append(kernel) logger.info(GREEN % "compile_integral finished in %g seconds.", time.time() - start) @@ -80,7 +79,7 @@ def compile_form(form, prefix="form", parameters=None, interface=None, diagonal= return kernels -def compile_integral(integral_data, form_data, prefix, parameters, interface, *, diagonal=False, log=False): +def compile_integral(integral_data, form_data, prefix, parameters, interface, *, diagonal=False): """Compiles a UFL integral into an assembly kernel. :arg integral_data: UFL integral data @@ -89,7 +88,6 @@ def compile_integral(integral_data, form_data, prefix, parameters, interface, *, :arg parameters: parameters object :arg interface: backend module for the kernel interface :arg diagonal: Are we building a kernel for the diagonal of a rank-2 element tensor? - :arg log: bool if the Kernel should be profiled with Log events :returns: a kernel constructed by the kernel interface """ parameters = preprocess_parameters(parameters) @@ -137,7 +135,7 @@ def compile_integral(integral_data, form_data, prefix, parameters, interface, *, integrand_exprs = builder.compile_integrand(integrand, params, ctx) integral_exprs = builder.construct_integrals(integrand_exprs, params) builder.stash_integrals(integral_exprs, params, ctx) - return builder.construct_kernel(kernel_name, ctx, log) + return builder.construct_kernel(kernel_name, ctx, parameters["add_petsc_events"]) def preprocess_parameters(parameters): @@ -157,7 +155,7 @@ def preprocess_parameters(parameters): def compile_expression_dual_evaluation(expression, to_element, ufl_element, *, domain=None, interface=None, - parameters=None, log=False): + parameters=None): """Compile a UFL expression to be evaluated against a compile-time known reference element's dual basis. Useful for interpolating UFL expressions into e.g. N1curl spaces. @@ -168,7 +166,6 @@ def compile_expression_dual_evaluation(expression, to_element, ufl_element, *, :arg domain: optional UFL domain the expression is defined on (required when expression contains no domain). :arg interface: backend module for the kernel interface :arg parameters: parameters object - :arg log: bool if the Kernel should be profiled with Log events :returns: Loopy-based ExpressionKernel object. """ if parameters is None: @@ -267,7 +264,7 @@ def compile_expression_dual_evaluation(expression, to_element, ufl_element, *, builder.register_requirements([evaluation]) builder.set_output(return_var) # Build kernel tuple - return builder.construct_kernel(impero_c, index_names, needs_external_coords, log=log) + return builder.construct_kernel(impero_c, index_names, needs_external_coords, parameters["add_petsc_events"]) class DualEvaluationCallable(object): diff --git a/tsfc/parameters.py b/tsfc/parameters.py index 1277713ad5..af44ce0cd4 100644 --- a/tsfc/parameters.py +++ b/tsfc/parameters.py @@ -20,6 +20,9 @@ # So that tests pass (needs to match scalar_type) "scalar_type_c": "double", + + # Whether to wrap the generated kernels in a PETSc event + "add_petsc_events": False, }