Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble constructing a type that requires type parameters #811

Open
glwagner opened this issue Feb 25, 2025 · 4 comments
Open

Trouble constructing a type that requires type parameters #811

glwagner opened this issue Feb 25, 2025 · 4 comments

Comments

@glwagner
Copy link
Collaborator

For example RectilinearGrid has an inner constructor of the form RectilinearGrid{TX, TY, TZ}(args...).

This error comes from includeing

https://github.com/CliMA/Oceananigans.jl/blob/glw/arch-dep-clock/test/test_reactant.jl

which can be done by cloning Oceananigans, navigating to test/ and typing

using TestEnv; TestEnv.activate()
include("test_reactant.jl")

btw also requires #810 so if that isn't merged yet, need to dev or add the Reactant branch explicitly.

cc @avik-pal

error: https://gist.github.com/glwagner/cba29b2dcaee57e1cc7f5d428386a65d

@avik-pal
Copy link
Collaborator

Can we add ConstructorBase definitions for these types in Oceananigans? Similar to https://juliaobjects.github.io/ConstructionBase.jl/dev/#ConstructionBase.constructorof

@avik-pal
Copy link
Collaborator

using ConstructionBase: ConstructionBase

function ConstructionBase.constructorof(::Type{<:RectilinearGrid{FT, TX, TY, TZ}}) where {FT, TX, TY, TZ}
    return RectilinearGrid{TX, TY, TZ}
end

@glwagner
Copy link
Collaborator Author

Seems easy enough

@glwagner
Copy link
Collaborator Author

There are probably a fair number of these so we will have to see how many to add

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

No branches or pull requests

2 participants