-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding cleanup logic. * Applying review comments and adding a test. * Applied review suggestions. * Adding format utility. * Renamed formatter. * Removed trixi formatter. * Limited folders to format. * Applie formatter. * Fixed error in code. * Updated formatter. * Formatted examples. * Revised package version. * Downgraded formatter. * Fixed version number of formatter. * Applied formater with version x.x.60. * Fixing compats. * Bumped MPIPreferences. * Update Project.toml Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> * Update test/Project.toml Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> * Refining test. * Added test evals. * Added further test eval. --------- Co-authored-by: Johannes Markert <johannes.markert@dlr.de> Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com>
- Loading branch information
1 parent
4739391
commit 235b47f
Showing
10 changed files
with
165 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@testset "test forestwrapper" begin | ||
|
||
# Clean up t8code before MPI shuts down. | ||
MPI.add_finalize_hook!() do | ||
T8code.clean_up() | ||
@test length(T8code.T8CODE_OBJECT_TRACKER) == 0 | ||
status = T8code.Libt8.sc_finalize_noabort() | ||
# If the following test fails the allocated objects were not cleaned up | ||
# properly before shutting down. | ||
@test status == 0 | ||
end | ||
|
||
@test length(T8code.T8CODE_OBJECT_TRACKER) == 0 | ||
|
||
# Create a forest and wrap by `ForestWrapper` | ||
scheme = t8_scheme_new_default_cxx() | ||
cmesh = t8_cmesh_new_hypercube(T8_ECLASS_QUAD, comm, 0, 0, 0) | ||
forest = t8_forest_new_uniform(cmesh, scheme, 0, 0, comm) | ||
wrapper_A = T8code.ForestWrapper(forest) | ||
|
||
@test length(T8code.T8CODE_OBJECT_TRACKER) == 1 | ||
|
||
# Create another forest and wrap by `ForestWrapper` | ||
scheme = t8_scheme_new_default_cxx() | ||
cmesh = t8_cmesh_new_hypercube(T8_ECLASS_TRIANGLE, comm, 0, 0, 0) | ||
forest = t8_forest_new_uniform(cmesh, scheme, 0, 0, comm) | ||
wrapper_B = T8code.ForestWrapper(forest) | ||
|
||
@test length(T8code.T8CODE_OBJECT_TRACKER) == 2 | ||
|
||
# Finalize the first wrapper. | ||
finalize(wrapper_A) | ||
|
||
@test length(T8code.T8CODE_OBJECT_TRACKER) == 1 | ||
|
||
# The second wrapper should be finalized automatically when Julia shuts down. | ||
# ... finalize(wrapper_B) ... | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env julia | ||
|
||
using Pkg | ||
Pkg.activate(; temp = true, io = devnull) | ||
Pkg.add(PackageSpec(name = "JuliaFormatter", version = "1.0.60"); preserve = PRESERVE_ALL, | ||
io = devnull) | ||
|
||
using JuliaFormatter: format | ||
|
||
function main() | ||
# Show help | ||
if "-h" in ARGS || "--help" in ARGS | ||
println("usage: trixi-format.jl PATH [PATH...]") | ||
println() | ||
println("positional arguments:") | ||
println() | ||
println(" PATH One or more paths (directories or files) to format. Default: '.'") | ||
return nothing | ||
end | ||
|
||
# Set default path if none is given on command line | ||
if isempty(ARGS) | ||
paths = String["./src/T8code.jl", "./test", "./examples"] | ||
else | ||
paths = ARGS | ||
end | ||
|
||
return format(paths) | ||
end | ||
|
||
main() |