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

add module to RuntimeGeneratedFunctions call #2259

Merged
merged 4 commits into from
Sep 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/systems/pde/pdesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@
throw(ArgumentError("The number of analytic solutions must match the number of dependent variables"))
end

if isnothing(analytic_func)
analytic_func = map(analytic) do eq
args = arguments(eq.lhs)
p = ps isa SciMLBase.NullParameters ? [] : map(a -> a.first, ps)
args = vcat(DestructuredArgs(p), args)
ex = Func(args, [], eq.rhs) |> toexpr
eq.lhs => drop_expr(@RuntimeGeneratedFunction(ex))
end
end
end
if isnothing(analytic_func)
analytic_func = map(analytic) do eq
args = arguments(eq.lhs)
p = ps isa SciMLBase.NullParameters ? [] : map(a -> a.first, ps)
args = vcat(DestructuredArgs(p), args)
ex = Func(args, [], eq.rhs) |> toexpr
eq.lhs => drop_expr(RuntimeGeneratedFunction(@__MODULE__, @__MODULE__, ex))

Check warning on line 117 in src/systems/pde/pdesystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/pde/pdesystem.jl#L111-L117

Added lines #L111 - L117 were not covered by tests
Copy link
Member

Choose a reason for hiding this comment

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

This should not hardcoded. Also, I think only the first argument is necessary for correct precompilation caching.

Copy link
Member Author

@xtalax xtalax Sep 14, 2023

Choose a reason for hiding this comment

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

This actually doesn't fix the bug I have, I may need to pass down @MODULE from PDESysLibrary as the cache module, this function needs all 3 arguments though

Copy link
Member

Choose a reason for hiding this comment

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

You can use the @RuntimeGeneratedFunction macro which only needs two.

end
end
end

if !isnothing(analytic_func)
analytic_func = analytic_func isa Dict ? analytic_func : analytic_func |> Dict
Expand Down
Loading