Skip to content

Multiple kernels per method

Nils Kohl requested to merge kohl/moving-loop-strategy-to-kernel-type into main

Enabling successive execution of multiple kernels (i.e., adding up multiple integrals) in one operator method.

Essentially, you can now add more than one integral to a kernel. Like this:


    # Generating an op for this:
    #   ∫ k ∇u · ∇v dx + ∫ uv dx

    # ...

    kernel_types = [
        ApplyWrapper(
            test,
            trial,
            type_descriptor=type_descriptor,
            dims=[2],
        )
    ]

    opts = {Opts.MOVECONSTANTS, Opts.VECTORIZE, Opts.TABULATE, Opts.QUADLOOPS}

    operator = HyTeGElementwiseOperator(
        name,
        symbolizer=symbolizer,
        kernel_wrapper_types=kernel_types,
        opts=opts,
        type_descriptor=type_descriptor,
    )

    operator.add_integral(
        name="div_k_grad",
        dim=volume_geometry.dimensions,
        geometry=volume_geometry,
        integration_domain=MacroIntegrationDomain.VOLUME,
        quad=quad,
        blending=AnnulusMap(),
        form=divkgrad,
        loop_strategy=CUBES(),
    )

    operator.add_integral(
        name="mass",
        dim=volume_geometry.dimensions,
        geometry=volume_geometry,
        integration_domain=MacroIntegrationDomain.VOLUME,
        quad=quad,
        blending=AnnulusMap(),
        form=m,
        loop_strategy=CUBES(),
    )

    # ...

There is still duplicate information (e.g., the blending map is passed to the form and to add_integral()) but I suppose that has been an issue before this MR. Somehow we need to be able to infer information about the integrals from the forms. See also #36 for more discussion points.

Eventually, this MR should pave the way for boundary integrals - volume and boundary integrals can now be added (some additional changes are probably necessary).

Edited by Nils Kohl

Merge request reports