Skip to content

[FR] Allow for user defined u in PositiveDomain #228

@evetion

Description

@evetion

Is your feature request related to a problem? Please describe.

I'd like to use the PositiveDomain callback, but only for a specific subset of u. Specifically, in our case u is a ComponentVector of which only a single variable must not be negative.

Describe the solution you’d like

As stated in the docstring of PositiveDomain, one can provide their own function for isoutofdomain: isoutofdomain=(u,p,t) -> any(x -> x < 0, u) (we use any(x -> x < 0, u.storage). Likewise, I would suggest to provide a similar method to PositiveDomain to retrieve the user specific u. That could be PositiveDomain(...; u_getter=(u,p,t) -> u), but probably using a better keyword name.

Describe alternatives you’ve considered

Diving into the code it seems we could override isaccepted by dispatching on a specific type of u, but that would be piracy of internal methods. A user defined isaccepted instead of only a u_getter could work, but would come closer to a GeneralDomain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions