-
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc46ec8
commit b50390f
Showing
4 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ Manifest.toml | |
profile.pb.gz | ||
.*.swp | ||
LocalPreferences.toml | ||
|
||
docs/build |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" | ||
|
||
[compat] | ||
Documenter = "0.27" |
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,50 @@ | ||
function explicit_rk_docstring(description::String) | ||
start_docstring = """ | ||
```julia | ||
$FUNCTIONNAME(; stage_limiter! = OrdinaryDiffEq.trivial_limiter!, | ||
step_limiter! = OrdinaryDiffEq.trivial_limiter!, | ||
thread = OrdinaryDiffEq.False()) | ||
``` | ||
Explicit Runge-Kutta Method. | ||
""" | ||
end_docstring = """ | ||
### Keyword Arguments | ||
- `stage_limiter!`: function of the form `limiter!(u, integrator, p, t)` | ||
- `step_limiter!`: function of the form `limiter!(u, integrator, p, t)` | ||
- `thread`: determines whether internal broadcasting on | ||
appropriate CPU arrays should be serial (`thread = OrdinaryDiffEq.False()`, | ||
default) or use multiple threads (`thread = OrdinaryDiffEq.True()`) when | ||
Julia is started with multiple threads. | ||
""" | ||
start_docstring * description * end_docstring | ||
end | ||
|
||
@doc explicit_rk_docstring("The second order Heun's method. Uses embedded Euler method for adaptivity.") | ||
struct Heun{StageLimiter, StepLimiter, Thread} <: OrdinaryDiffEqAdaptiveAlgorithm | ||
stage_limiter!::StageLimiter | ||
step_limiter!::StepLimiter | ||
thread::Thread | ||
end | ||
|
||
function Heun(; stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!, | ||
thread = False()) | ||
Heun{typeof(stage_limiter!), typeof(step_limiter!), typeof(thread)}(stage_limiter!, | ||
step_limiter!, | ||
thread) | ||
end | ||
|
||
# for backwards compatibility | ||
function Heun(stage_limiter!, step_limiter! = trivial_limiter!) | ||
Heun{typeof(stage_limiter!), typeof(step_limiter!), False}(stage_limiter!, | ||
step_limiter!, | ||
False()) | ||
end | ||
|
||
function Base.show(io::IO, alg::Heun) | ||
print(io, "Heun(stage_limiter! = ", alg.stage_limiter!, | ||
", step_limiter! = ", alg.step_limiter!, | ||
", thread = ", alg.thread, ")") | ||
end |