Skip to content

Different behavior when indexing with ColumnIndex vs Integers #2355

@juliasloan25

Description

@juliasloan25

Describe the bug

When calling column on a SpectralElementSpace2D, we see different behavior when indexing with a ColumnIndex or with Integers.

With integers we get the expected behavior - a new PointSpace. With ColumnIndex however the fallback method is called which does nothing, and the input space is returned unchanged.

To Reproduce

import ClimaCore
import ClimaComms
import ClimaUtilities

FT = Float64
xlim = FT.((0, 1))
ylim = FT.((0, 1))
context = ClimaComms.context()

domain_x = ClimaCore.Domains.IntervalDomain(
    ClimaCore.Geometry.XPoint(xlim[1]),
    ClimaCore.Geometry.XPoint(xlim[2]),
    periodic = true,
)
domain_y = ClimaCore.Domains.IntervalDomain(
    ClimaCore.Geometry.YPoint(ylim[1]),
    ClimaCore.Geometry.YPoint(ylim[2]),
    periodic = true,
)
plane = ClimaCore.Domains.RectangleDomain(domain_x, domain_y)
mesh = ClimaCore.Meshes.RectilinearMesh(plane, 1, 1)
grid_topology = ClimaCore.Topologies.Topology2D(context, mesh)
quad = ClimaCore.Spaces.Quadratures.GL{1}()
space_2d = ClimaCore.Spaces.SpectralElementSpace2D(
    grid_topology,
    quad,
)

# Observe different behaviors when using ColumnIndex vs. Integers
ClimaCore.Spaces.column(space_2d, 1, 1, 1) isa ClimaCore.Spaces.PointSpace # true
ClimaCore.Spaces.column(space_2d, ClimaCore.Grids.ColumnIndex((1, 1), 1)) isa ClimaCore.Spaces.PointSpace # false
ClimaCore.Spaces.column(space_2d, ClimaCore.Grids.ColumnIndex((1, 1), 1)) == space_2d # true
Project

ClimaCore v0.14.35

System details

Any relevant system information:

  • ClimaCore v0.14.35
  • Julia version 1.11.5
  • operating system MacOS Sequoia 15.5

Related issues / PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions