Skip to content

Dead parameters and dead code in the RBF interpolation path (and a test silently discarding its nnn) #428

Description

@lmoresi

Found while adding the linear-exact local RBF interpolator (feature/linear-rbf). Charter §5: no speculative generality, no dead branches.

1. MeshVariable.rbf_interpolate has two dead parameters

def rbf_interpolate(self, new_coords, meth=0, p=2, verbose=False, nnn=None, rubbish=None):
    ...
    meth : int, optional
        Interpolation method (reserved, currently unused).

meth and rubbish are never read. meth is documented as "reserved", which Charter §5 rules out; rubbish is not documented at all.

2. A live test is silently affected by (1)

tests/test_0505_rbf_swarm_mesh.py:

@pytest.mark.parametrize("dim,nnn,p", [(2, 1, 2), (2, 3, 2), (3, 4, 2)])
...
rvals = var.rbf_interpolate(rx, nnn, p)

The second positional argument is meth, not nnn. So the test's nnn lands in the dead parameter and is discarded, and every case actually runs at the default nnn (3 in 2D, 4 in 3D). The (2, 1, 2) case in particular believes it is testing the raw nearest-neighbour branch and is not.

Removing meth would fix the test by making the positional argument mean what it says — but it is an API break for anything passing positionally.

3. Dead proxy machinery

SwarmVariable._rbf_reduce_to_meshVar is the old scatter-form proxy update (each particle finds its nearest node, accumulates, normalises, fills zero-weight nodes from swarm._get_map). Nothing calls it. It is also the last place in swarm.py still using the deprecated with swarm.access(...) shim.

The _nn_proxy flag exists only to gate a branch inside it, and is plumbed all the way out to Swarm.add_variable(..., _nn_proxy=False).

Suggest deleting both under the Wave-A deletion protocol.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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