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

Apply new formatter version #1842

Closed
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,22 @@ function initial_condition_kelvin_helmholtz_instability_fjordholm_etal(x, t,

m = 10
a1 = [0.04457096674422902, 0.03891512410182607, 0.0030191053979293433,
0.0993913172320319,
0.1622302137588842, 0.1831383653456182, 0.11758003014101702, 0.07964318348142958,
0.0863245324711805, 0.18518716132585408]
0.0993913172320319,
0.1622302137588842, 0.1831383653456182, 0.11758003014101702, 0.07964318348142958,
0.0863245324711805, 0.18518716132585408]
a2 = [0.061688440856337096, 0.23000237877135882, 0.04453793881833177,
0.19251530387370916,
0.11107917357941084, 0.05898041974649702, 0.09949312336096268, 0.07022276346006465,
0.10670366489014596, 0.02477679264318211]
0.19251530387370916,
0.11107917357941084, 0.05898041974649702, 0.09949312336096268,
0.07022276346006465,
0.10670366489014596, 0.02477679264318211]
b1 = [0.06582340543754152, 0.9857886297001535, 0.8450452205037154, -1.279648120993805,
0.45454198915209526, -0.13359370986823993, 0.07062615913363897, -1.0097986278512623,
1.0810669017430343, -0.14207309803877177]
0.45454198915209526, -0.13359370986823993, 0.07062615913363897,
-1.0097986278512623,
1.0810669017430343, -0.14207309803877177]
b2 = [-1.1376882185131414, -1.4798197129947765, 0.6139290513283818, -0.3319087388365522,
0.14633328999192285, -0.06373231463100072, -0.6270101051216724, 0.13941252226261905,
-1.0337526453303645, 1.0441408867083155]
0.14633328999192285, -0.06373231463100072, -0.6270101051216724,
0.13941252226261905,
-1.0337526453303645, 1.0441408867083155]
Y1 = 0.0
Y2 = 0.0
for n in 1:m
Expand Down
4 changes: 1 addition & 3 deletions src/callbacks_step/alive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ function Base.show(io::IO, ::MIME"text/plain",
else
alive_callback = cb.affect!

setup = [
"interval" => alive_callback.alive_interval,
]
setup = ["interval" => alive_callback.alive_interval]
summary_box(io, "AliveCallback", setup)
end
end
Expand Down
6 changes: 2 additions & 4 deletions src/callbacks_step/averaging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ function Base.show(io::IO, ::MIME"text/plain",
else
averaging_callback = cb.affect!

setup = [
"Start time" => first(averaging_callback.tspan),
"Final time" => last(averaging_callback.tspan),
]
setup = ["Start time" => first(averaging_callback.tspan),
"Final time" => last(averaging_callback.tspan)]
summary_box(io, "AveragingCallback", setup)
end
end
Expand Down
6 changes: 2 additions & 4 deletions src/callbacks_step/glm_speed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ function Base.show(io::IO, ::MIME"text/plain",
else
glm_speed_callback = cb.affect!

setup = [
"GLM wave speed scaling" => glm_speed_callback.glm_scale,
"Expected CFL number" => glm_speed_callback.cfl,
]
setup = ["GLM wave speed scaling" => glm_speed_callback.glm_scale,
"Expected CFL number" => glm_speed_callback.cfl]
summary_box(io, "GlmSpeedCallback", setup)
end
end
Expand Down
11 changes: 5 additions & 6 deletions src/callbacks_step/save_restart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ function Base.show(io::IO, ::MIME"text/plain",
else
save_restart_callback = cb.affect!

setup = [
"interval" => save_restart_callback.interval,
"save final solution" => save_restart_callback.save_final_restart ? "yes" :
"no",
"output directory" => abspath(normpath(save_restart_callback.output_directory)),
]
setup = ["interval" => save_restart_callback.interval,
"save final solution" => save_restart_callback.save_final_restart ?
"yes" :
"no",
"output directory" => abspath(normpath(save_restart_callback.output_directory))]
summary_box(io, "SaveRestartCallback", setup)
end
end
Expand Down
32 changes: 14 additions & 18 deletions src/callbacks_step/save_solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ function Base.show(io::IO, ::MIME"text/plain",
else
save_solution_callback = cb.affect!

setup = [
"interval" => save_solution_callback.interval_or_dt,
"solution variables" => save_solution_callback.solution_variables,
"save initial solution" => save_solution_callback.save_initial_solution ?
"yes" : "no",
"save final solution" => save_solution_callback.save_final_solution ?
"yes" : "no",
"output directory" => abspath(normpath(save_solution_callback.output_directory)),
]
setup = ["interval" => save_solution_callback.interval_or_dt,
"solution variables" => save_solution_callback.solution_variables,
"save initial solution" => save_solution_callback.save_initial_solution ?
"yes" : "no",
"save final solution" => save_solution_callback.save_final_solution ?
"yes" : "no",
"output directory" => abspath(normpath(save_solution_callback.output_directory))]
summary_box(io, "SaveSolutionCallback", setup)
end
end
Expand All @@ -78,15 +76,13 @@ function Base.show(io::IO, ::MIME"text/plain",
else
save_solution_callback = cb.affect!.affect!

setup = [
"dt" => save_solution_callback.interval_or_dt,
"solution variables" => save_solution_callback.solution_variables,
"save initial solution" => save_solution_callback.save_initial_solution ?
"yes" : "no",
"save final solution" => save_solution_callback.save_final_solution ?
"yes" : "no",
"output directory" => abspath(normpath(save_solution_callback.output_directory)),
]
setup = ["dt" => save_solution_callback.interval_or_dt,
"solution variables" => save_solution_callback.solution_variables,
"save initial solution" => save_solution_callback.save_initial_solution ?
"yes" : "no",
"save final solution" => save_solution_callback.save_final_solution ?
"yes" : "no",
"output directory" => abspath(normpath(save_solution_callback.output_directory))]
summary_box(io, "SaveSolutionCallback", setup)
end
end
Expand Down
6 changes: 2 additions & 4 deletions src/callbacks_step/steady_state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ function Base.show(io::IO, ::MIME"text/plain",
else
steady_state_callback = cb.affect!

setup = [
"absolute tolerance" => steady_state_callback.abstol,
"relative tolerance" => steady_state_callback.reltol,
]
setup = ["absolute tolerance" => steady_state_callback.abstol,
"relative tolerance" => steady_state_callback.reltol]
summary_box(io, "SteadyStateCallback", setup)
end
end
Expand Down
4 changes: 1 addition & 3 deletions src/callbacks_step/stepsize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ function Base.show(io::IO, ::MIME"text/plain",
else
stepsize_callback = cb.affect!

setup = [
"CFL number" => stepsize_callback.cfl_number,
]
setup = ["CFL number" => stepsize_callback.cfl_number]
summary_box(io, "StepsizeCallback", setup)
end
end
Expand Down
12 changes: 5 additions & 7 deletions src/callbacks_step/time_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,11 @@ function Base.show(io::IO, ::MIME"text/plain",
else
time_series_callback = cb.affect!

setup = [
"#points" => size(time_series_callback.point_coordinates, 2),
"interval" => time_series_callback.interval,
"solution_variables" => time_series_callback.solution_variables,
"output_directory" => time_series_callback.output_directory,
"filename" => time_series_callback.filename,
]
setup = ["#points" => size(time_series_callback.point_coordinates, 2),
"interval" => time_series_callback.interval,
"solution_variables" => time_series_callback.solution_variables,
"output_directory" => time_series_callback.output_directory,
"filename" => time_series_callback.filename]
summary_box(io, "TimeSeriesCallback", setup)
end
end
Expand Down
16 changes: 7 additions & 9 deletions src/callbacks_step/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ function Base.show(io::IO, ::MIME"text/plain",
else
visualization_callback = cb.affect!

setup = [
"interval" => visualization_callback.interval,
"plot arguments" => visualization_callback.plot_arguments,
"solution variables" => visualization_callback.solution_variables,
"variable names" => visualization_callback.variable_names,
"show mesh" => visualization_callback.show_mesh,
"plot creator" => visualization_callback.plot_creator,
"plot data creator" => visualization_callback.plot_data_creator,
]
setup = ["interval" => visualization_callback.interval,
"plot arguments" => visualization_callback.plot_arguments,
"solution variables" => visualization_callback.solution_variables,
"variable names" => visualization_callback.variable_names,
"show mesh" => visualization_callback.show_mesh,
"plot creator" => visualization_callback.plot_creator,
"plot data creator" => visualization_callback.plot_data_creator]
summary_box(io, "VisualizationCallback", setup)
end
end
Expand Down
10 changes: 4 additions & 6 deletions src/meshes/p4est_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,9 @@ function Base.show(io::IO, ::MIME"text/plain", mesh::P4estMesh)
if get(io, :compact, false)
show(io, mesh)
else
setup = [
"#trees" => ntrees(mesh),
"current #cells" => ncells(mesh),
"polydeg" => length(mesh.nodes) - 1,
]
setup = ["#trees" => ntrees(mesh),
"current #cells" => ncells(mesh),
"polydeg" => length(mesh.nodes) - 1]
summary_box(io,
"P4estMesh{" * string(ndims(mesh)) * ", " * string(real(mesh)) *
"}", setup)
Expand Down Expand Up @@ -503,7 +501,7 @@ function parse_elements(meshfile, n_trees, n_dims)
# Valid element types (that can be processed by p4est) based on dimension
element_types = n_dims == 2 ?
["*ELEMENT, type=CPS4", "*ELEMENT, type=C2D4",
"*ELEMENT, type=S4"] : ["*ELEMENT, type=C3D8"]
"*ELEMENT, type=S4"] : ["*ELEMENT, type=C3D8"]
# 2D quads: 4 nodes + element index, 3D hexes: 8 nodes + element index
expected_content_length = n_dims == 2 ? 5 : 9

Expand Down
38 changes: 15 additions & 23 deletions src/meshes/t8code_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ function Base.show(io::IO, ::MIME"text/plain", mesh::T8codeMesh)
if get(io, :compact, false)
show(io, mesh)
else
setup = [
"#trees" => ntrees(mesh),
"current #cells" => ncells(mesh),
"polydeg" => length(mesh.nodes) - 1,
]
setup = ["#trees" => ntrees(mesh),
"current #cells" => ncells(mesh),
"polydeg" => length(mesh.nodes) - 1]
summary_box(io,
"T8codeMesh{" * string(ndims(mesh)) * ", " * string(real(mesh)) * "}",
setup)
Expand Down Expand Up @@ -819,14 +817,13 @@ function fill_mesh_info!(mesh::T8codeMesh, interfaces, mortars, boundaries,
# Works for quads and hexs only. This mapping is needed in the MPI mortar
# sections below.
map_iface_to_ichild_to_position = [
# 0 1 2 3 4 5 6 7 ichild/iface
[1, 0, 2, 0, 3, 0, 4, 0], # 0
[0, 1, 0, 2, 0, 3, 0, 4], # 1
[1, 2, 0, 0, 3, 4, 0, 0], # 2
[0, 0, 1, 2, 0, 0, 3, 4], # 3
[1, 2, 3, 4, 0, 0, 0, 0], # 4
[0, 0, 0, 0, 1, 2, 3, 4], # 5
]
# 0 1 2 3 4 5 6 7 ichild/iface
[1, 0, 2, 0, 3, 0, 4, 0], # 0
[0, 1, 0, 2, 0, 3, 0, 4], # 1
[1, 2, 0, 0, 3, 4, 0, 0], # 2
[0, 0, 1, 2, 0, 0, 3, 4], # 3
[1, 2, 3, 4, 0, 0, 0, 0], # 4
[0, 0, 0, 0, 1, 2, 3, 4]]
Comment on lines 819 to +826
Copy link
Member

@efaulhaber efaulhaber Feb 12, 2024

Choose a reason for hiding this comment

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

This is absolutely terrible. Why do these things always happen in new versions of JuliaFormatter?

Copy link
Member

Choose a reason for hiding this comment

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


# Helper variables to compute unique global MPI interface/mortar ids.
max_level = t8_forest_get_maxlevel(mesh.forest) #UInt64
Expand Down Expand Up @@ -1077,20 +1074,15 @@ function fill_mesh_info!(mesh::T8codeMesh, interfaces, mortars, boundaries,
push!(visited_global_mortar_ids, global_mortar_id)
global_mortar_id_to_local[global_mortar_id] = local_mpi_mortar_id

mpi_mesh_info.mpi_mortars.local_neighbor_ids[local_mpi_mortar_id] = [
current_index + 1,
]
mpi_mesh_info.mpi_mortars.local_neighbor_positions[local_mpi_mortar_id] = [
map_iface_to_ichild_to_position[iface + 1][t8_element_child_id(eclass_scheme, element) + 1],
]
mpi_mesh_info.mpi_mortars.local_neighbor_ids[local_mpi_mortar_id] = [current_index +
1]
mpi_mesh_info.mpi_mortars.local_neighbor_positions[local_mpi_mortar_id] = [map_iface_to_ichild_to_position[iface + 1][t8_element_child_id(eclass_scheme, element) + 1]]
Copy link
Member Author

@JoshuaLampert JoshuaLampert Feb 10, 2024

Choose a reason for hiding this comment

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

This line gets really long.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you check if a line break behind e.g. the = gets removed from the formater?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, after the =, it does get removed. I've pushed an alternative in f393d48 with a line break after the first closing bracket.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, never mind. This does not work.

Copy link
Contributor

Choose a reason for hiding this comment

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

So none of the tried options work?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately yes. We could, however, give shorter names to map_iface_to_ichild_to_position[iface + 1] and t8_element_child_id(eclass_scheme, element) + 1 before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I would hesitate to change variable names due to formatter issues - probably we have a new formatting in 2-3 months anyway

Copy link
Contributor

@DanielDoehring DanielDoehring Feb 12, 2024

Choose a reason for hiding this comment

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

Maybe we should just push this through to get the other PRs going

init_mortar_node_indices!(mpi_mesh_info.mpi_mortars,
(iface, dual_faces[1]),
orientation, local_mpi_mortar_id)

neighbor_ranks = [
remotes[findlast(ghost_remote_first_elem .<=
neighbor_ielements[1])],
]
neighbor_ranks = [remotes[findlast(ghost_remote_first_elem .<=
neighbor_ielements[1])]]
mpi_mesh_info.neighbor_ranks_mortar[local_mpi_mortar_id] = neighbor_ranks

mpi_mesh_info.global_mortar_ids[local_mpi_mortar_id] = global_mortar_id
Expand Down
14 changes: 6 additions & 8 deletions src/meshes/tree_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,12 @@ function Base.show(io::IO, ::MIME"text/plain",
if get(io, :compact, false)
show(io, mesh)
else
setup = [
"center" => mesh.tree.center_level_0,
"length" => mesh.tree.length_level_0,
"periodicity" => mesh.tree.periodicity,
"current #cells" => mesh.tree.length,
"#leaf-cells" => count_leaf_cells(mesh.tree),
"maximum #cells" => mesh.tree.capacity,
]
setup = ["center" => mesh.tree.center_level_0,
"length" => mesh.tree.length_level_0,
"periodicity" => mesh.tree.periodicity,
"current #cells" => mesh.tree.length,
"#leaf-cells" => count_leaf_cells(mesh.tree),
"maximum #cells" => mesh.tree.capacity]
summary_box(io, "TreeMesh{" * string(NDIMS) * ", " * string(TreeType) * "}",
setup)
end
Expand Down
12 changes: 5 additions & 7 deletions src/semidiscretization/semidiscretization_euler_gravity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ function Base.show(io::IO, ::MIME"text/plain", parameters::ParametersEulerGravit
if get(io, :compact, false)
show(io, parameters)
else
setup = [
"background density (ρ₀)" => parameters.background_density,
"gravitational constant (G)" => parameters.gravitational_constant,
"CFL (gravity)" => parameters.cfl,
"max. #iterations" => parameters.n_iterations_max,
"time integrator" => parameters.timestep_gravity,
]
setup = ["background density (ρ₀)" => parameters.background_density,
"gravitational constant (G)" => parameters.gravitational_constant,
"CFL (gravity)" => parameters.cfl,
"max. #iterations" => parameters.n_iterations_max,
"time integrator" => parameters.timestep_gravity]
summary_box(io, "ParametersEulerGravity", setup)
end
end
Expand Down
24 changes: 6 additions & 18 deletions src/solvers/dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ function Base.show(io::IO, ::MIME"text/plain", integral::VolumeIntegralFluxDiffe
if get(io, :compact, false)
show(io, integral)
else
setup = [
"volume flux" => integral.volume_flux,
]
setup = ["volume flux" => integral.volume_flux]
summary_box(io, "VolumeIntegralFluxDifferencing", setup)
end
end
Expand Down Expand Up @@ -177,9 +175,7 @@ function Base.show(io::IO, ::MIME"text/plain",
if get(io, :compact, false)
show(io, integral)
else
setup = [
"FV flux" => integral.volume_flux_fv,
]
setup = ["FV flux" => integral.volume_flux_fv]
summary_box(io, "VolumeIntegralPureLGLFiniteVolume", setup)
end
end
Expand Down Expand Up @@ -274,9 +270,7 @@ function Base.show(io::IO, ::MIME"text/plain", integral::VolumeIntegralUpwind)
if get(io, :compact, false)
show(io, integral)
else
setup = [
"flux splitting" => integral.splitting,
]
setup = ["flux splitting" => integral.splitting]
summary_box(io, "VolumeIntegralUpwind", setup)
end
end
Expand Down Expand Up @@ -314,9 +308,7 @@ function Base.show(io::IO, ::MIME"text/plain", integral::SurfaceIntegralWeakForm
if get(io, :compact, false)
show(io, integral)
else
setup = [
"surface flux" => integral.surface_flux,
]
setup = ["surface flux" => integral.surface_flux]
summary_box(io, "SurfaceIntegralWeakForm", setup)
end
end
Expand All @@ -340,9 +332,7 @@ function Base.show(io::IO, ::MIME"text/plain", integral::SurfaceIntegralStrongFo
if get(io, :compact, false)
show(io, integral)
else
setup = [
"surface flux" => integral.surface_flux,
]
setup = ["surface flux" => integral.surface_flux]
summary_box(io, "SurfaceIntegralStrongForm", setup)
end
end
Expand Down Expand Up @@ -371,9 +361,7 @@ function Base.show(io::IO, ::MIME"text/plain", integral::SurfaceIntegralUpwind)
if get(io, :compact, false)
show(io, integral)
else
setup = [
"flux splitting" => integral.splitting,
]
setup = ["flux splitting" => integral.splitting]
summary_box(io, "SurfaceIntegralUpwind", setup)
end
end
Expand Down
Loading
Loading