Skip to content

fix: 2D-vector setter writes nothing (- instead of =)#471

Merged
ilhamv merged 2 commits into
mcdc-project:devfrom
steps-re:fix/generated-vector-setter
Jul 11, 2026
Merged

fix: 2D-vector setter writes nothing (- instead of =)#471
ilhamv merged 2 commits into
mcdc-project:devfrom
steps-re:fix/generated-vector-setter

Conversation

@steps-re

Copy link
Copy Markdown
Contributor

_accessor_2d_vector in mcdc/code_factory/numba_objects_generator.py generates its setter with:

text += f"    data[start:end] - value\n\n\n"

That emits data[start:end] - value — a subtraction whose result is thrown away — instead of data[start:end] = value. Every sibling accessor generator (_accessor_1d, _accessor_2d, _accessor_3d_element, ...) correctly emits = value, so this one is the odd one out and every generated *_vector setter silently writes nothing.

This fixes the generator template and the checked-in generated modules where the broken setter already landed:

  • mcdc/mcdc_set/table_data.py
  • mcdc/mcdc_set/multigroup_material.py (4 setters)
  • mcdc/mcdc_set/source.py (2)
  • mcdc/mcdc_set/neutron_inelastic_scattering_reaction.py
  • mcdc/mcdc_set/surface.py (2)

If those modules are meant to be regenerated from the template rather than hand-edited, let me know and I'll drop the generated-file changes and keep only the template fix.

steps-re and others added 2 commits July 10, 2026 20:05
_accessor_2d_vector's setter branch in the numba object-code generator emitted
`data[start:end] - value` -- a subtraction whose result is discarded -- instead
of `data[start:end] = value`. Every other generated accessor (_accessor_1d,
_accessor_2d, _accessor_3d_*) correctly emits `= value`, so all generated
*_vector setters silently failed to write.

Fixed the generator template and regenerated the affected checked-in modules
(mcdc_set/{table_data,multigroup_material,source,neutron_inelastic_scattering_reaction,surface}.py).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ilhamv

ilhamv commented Jul 11, 2026

Copy link
Copy Markdown
Member

Thanks, @steps-re!

@ilhamv ilhamv self-requested a review July 11, 2026 03:45

@ilhamv ilhamv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @steps-re!

This PR will be part of patch release v0.14.2, along with #470.

@ilhamv ilhamv merged commit 859bcfc into mcdc-project:dev Jul 11, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants