Skip to content

Make canonical coordinates polymorphic like magnetic_field_t #293

@krystophny

Description

@krystophny

Priority: Low

Problem

The canonical coordinate implementations (Boozer, Meiss, Albert, Flux) do not use the polymorphic pattern established by magnetic_field_t. Instead, they use separate modules with similar but not identical interfaces.

Current structure:

  • field_can_boozer.f90 - standalone module
  • field_can_meiss.f90 - standalone module
  • field_can_albert.f90 - standalone module
  • field_can_flux.f90 - standalone module

Proposed Solution

Create a canonical_field_t base class:

type, abstract, extends(magnetic_field_t) :: canonical_field_t
contains
    procedure(eval_can_iface), deferred :: evaluate_canonical
    procedure :: evaluate => evaluate_via_canonical
end type

type, extends(canonical_field_t) :: boozer_field_t
type, extends(canonical_field_t) :: meiss_field_t
type, extends(canonical_field_t) :: albert_field_t

Benefits

  • Consistent interface across all canonical coordinate types
  • Easier to add new canonical coordinate systems
  • Better code organization

Caveats

  • Significant refactoring effort
  • Current approach is well-tested and functional
  • Performance impact needs evaluation

Related

  • See DOC/coordinates-and-fields.md Section 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions