Skip to content

Refactor HenrysLaw #451

@K20shores

Description

@K20shores

Refactor HenrysLaw in musica.mechanism_configuration to use composition instead of inheritance from _HenrysLaw.

Acceptance Criteria

  • The class no longer inherits from _HenrysLaw.
  • The internal C++ instance is held in self._instance.
  • All properties (name, gas_phase, gas_phase_species, aerosol_phase, aerosol_phase_water, aerosol_phase_species, other_properties) delegate to or update self._instance.
  • gas_phase_species and aerosol_phase_species use Python Species or (float, Species) and convert to/from C++ _ReactionComponent.
  • serialize() is converted from static method to instance method, operating only on Python-visible data.
  • Public interface exposes only Python-native types with no direct C++ inheritance.

Ideas

  • Follow the wrapper pattern from tuvx.py.
  • Use helper functions or properties for clean conversion between Python and C++ types.
  • Use @property decorators to forward attributes.
  • Refactor serialize() as an instance method, removing static method usage.

Tasks

  • Remove _HenrysLaw inheritance.
  • Initialize self._instance as _HenrysLaw() inside __init__.
  • Forward all attribute access and mutation to self._instance via properties.
  • Convert gas_phase_species and aerosol_phase_species between Python and C++ representations on set/get.
  • Refactor serialize() to instance method accessing Python-visible data only.
  • Update call sites for serialization accordingly.

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