-
Notifications
You must be signed in to change notification settings - Fork 156
Fix #1194: Unify signatures of mesh constructors #3000
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e6738a3
swap between mesh types
vincmarks 59a6ae3
add more tests
vincmarks 73c25a5
add keyword-only mesh constructor interface
vincmarks 949f5be
Merge branch 'main' into feature/mesh-swap
vincmarks 083c3b6
add test for elixir_advection_mesh_swap.jl
vincmarks ad76138
rename to refinement_level, document kwargs, add length checks, updat…
vincmarks 60ec745
use refinement_level instead of initial_refinement_level in test/test…
vincmarks ebe65fc
add tests for length checking
vincmarks 1eda211
formatting
vincmarks cdc1c05
Merge remote-tracking branch 'upstream/main' into feature/mesh-swap
vincmarks 8554ea4
update doctrings, docs page, and use n_cell_max = nothing as default
vincmarks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
|
ranocha marked this conversation as resolved.
|
This file contains hidden or 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,34 @@ | ||
| # Unified mesh constructor interface | ||
|
|
||
| Trixi.jl provides several mesh types suited for different scenarios. | ||
| It may be useful to quickly swap between mesh types | ||
| without having to rewrite the mesh construction call. | ||
|
|
||
| ## Keyword-only interface | ||
|
|
||
| All structured mesh types support a keyword-only constructor for rectangular domains | ||
| using `refinement_level`, yielding `2^refinement_level` cells per dimension. | ||
|
|
||
| ```@example mesh-swap | ||
| using Trixi | ||
|
|
||
| for MeshType in (TreeMesh, StructuredMesh, P4estMesh, T8codeMesh) | ||
| mesh = MeshType(coordinates_min = (-1.0, -1.0), coordinates_max = (1.0, 1.0), | ||
| refinement_level = 2) | ||
| display(mesh) | ||
| end | ||
| ``` | ||
|
|
||
| [`DGMultiMesh`](@ref) also supports the same keyword arguments, but requires a solver `dg` | ||
| as the first positional argument: | ||
|
|
||
| ```@example mesh-swap | ||
| dg = DGMulti(polydeg = 1, element_type = Quad()) | ||
| mesh = DGMultiMesh(dg; coordinates_min = (-1.0, -1.0), coordinates_max = (1.0, 1.0), | ||
| refinement_level = 2) | ||
| ``` | ||
|
|
||
| Note: for `StructuredMesh` and `DGMultiMesh`, `refinement_level` directly sets | ||
| `cells_per_dimension = 2^refinement_level`. For `P4estMesh` and `T8codeMesh`, | ||
| a single tree per dimension is created and refined `refinement_level` times, | ||
| which also yields `2^refinement_level` leaf cells per dimension. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.