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 macro trixi_include_changeprecision to make a double precision elixir run with single precision #35

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TrixiBase"
uuid = "9a0f1c46-06d5-4909-a5a3-ce25d3fa3284"
authors = ["Michael Schlottke-Lakemper <[email protected]>"]
version = "0.1.5-DEV"
version = "0.1.5"

[deps]
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
Expand Down
9 changes: 7 additions & 2 deletions src/trixi_include.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ julia> redirect_stdout(devnull) do
0.1
```
"""
function trixi_include(mod::Module, elixir::AbstractString; kwargs...)
function trixi_include(mapexpr::Function, mod::Module, elixir::AbstractString; kwargs...)
efaulhaber marked this conversation as resolved.
Show resolved Hide resolved
# Check that all kwargs exist as assignments
code = read(elixir, String)
expr = Meta.parse("begin \n$code \nend")
Expand All @@ -45,7 +45,12 @@ function trixi_include(mod::Module, elixir::AbstractString; kwargs...)
if !mpi_isparallel(Val{:MPIExt}())
@info "You just called `trixi_include`. Julia may now compile the code, please be patient."
end
Base.include(ex -> replace_assignments(insert_maxiters(ex); kwargs...), mod, elixir)
Base.include(ex -> replace_assignments(insert_maxiters(mapexpr(ex)); kwargs...),
ranocha marked this conversation as resolved.
Show resolved Hide resolved
mod, elixir)
Comment on lines +52 to +53
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Base.include(ex -> replace_assignments(insert_maxiters(mapexpr(ex)); kwargs...),
mod, elixir)
Base.include(replace_assignments insert_maxiters mapexpr; kwargs...),
mod, elixir)

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, the Trixi style guide says:

Executable code should only use ASCII characters.

Copy link
Member

Choose a reason for hiding this comment

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

@sloede? Composing functions is only available using . From my point of view, makes it easier to read the code in this case.

end

function trixi_include(mod::Module, elixir::AbstractString; kwargs...)
trixi_include(identity, mod, elixir; kwargs...)
end

function trixi_include(elixir::AbstractString; kwargs...)
Expand Down
Loading