Skip to content

Do not fail for empty reductions #266

@inducer

Description

@inducer

Originally raised by @MTCam in #264:

A second problem is that this pattern fails to actually execute for CV objects since we have:
CV = [DOFArray, DOFArray, DOFArray, ... , numpy.ndarray = [] ], i.e., an empty array for the species_mass component for non-mixture CV. Attempting a reduction operation using a single gas CV now produces this error:

        if not isinstance(vec, DOFArray):
>           return max(
                nodal_max_loc(dcoll, dd, comp, initial=initial)
                for _, comp in serialize_container(vec)
            )
E           ValueError: max() arg is an empty sequence

../../grudge/grudge/reductions.py:257: ValueError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions