-
Notifications
You must be signed in to change notification settings - Fork 0
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
Initial commit #1
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 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,57 @@ | ||
# Configuration file for code formatting | ||
# see here for default options : https://github.com/domluna/JuliaFormatter.jl#formatting-options | ||
|
||
always_for_in = true | ||
whitespace_typedefs = true | ||
whitespace_ops_in_indices = true | ||
remove_extra_newlines = true | ||
short_to_long_function_def = true | ||
long_to_short_function_def = false | ||
# always_use_return = true | ||
whitespace_in_kwargs = true | ||
format_docstrings = false | ||
conditional_to_if = true | ||
trailing_comma = true | ||
normalize_line_endings = "unix" | ||
join_lines_based_on_source = false | ||
separate_kwargs_with_semicolon = true | ||
align_assignment = true | ||
align_struct_field = true | ||
align_conditional = true | ||
# align_pair_arrow = true | ||
# align_matrix = true | ||
# format_markdown = true | ||
|
||
|
||
# possible style : sciml, blue, yas | ||
|
||
# ### SciML options | ||
# whitespace_ops_in_indices = true | ||
# remove_extra_newlines = true | ||
# always_for_in = true | ||
# whitespace_typedefs = true | ||
# normalize_line_endings = "unix" | ||
|
||
# ### YAS options | ||
# always_for_in = true | ||
# whitespace_ops_in_indices = true | ||
# remove_extra_newlines = true | ||
# import_to_using = true | ||
# pipe_to_function_call = true | ||
# short_to_long_function_def = true | ||
# always_use_return = true | ||
# whitespace_in_kwargs = false | ||
# join_lines_based_on_source = true | ||
# separate_kwargs_with_semicolon = true | ||
|
||
# ### Blue option | ||
# always_use_return = true | ||
# short_to_long_function_def = true | ||
# whitespace_ops_in_indices = true | ||
# remove_extra_newlines = true | ||
# always_for_in = true | ||
# import_to_using = true | ||
# pipe_to_function_call = true | ||
# whitespace_in_kwargs = false | ||
# annotate_untyped_fields_with_any = false | ||
# separate_kwargs_with_semicolon = true |
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,27 @@ | ||
name: Documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: "*" | ||
pull_request: | ||
types: [unlabeled, opened, synchronize, reopened] | ||
|
||
# Only trigger the job when `draft` label is not assigned to the PR | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.pull_request.labels.*.name, 'draft') == false | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: "1.9" | ||
- name: Install dependencies | ||
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' | ||
- name: Build and deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key | ||
run: julia --project=docs/ docs/make.jl |
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,13 @@ | ||
name: TagBot | ||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
jobs: | ||
TagBot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: JuliaRegistries/TagBot@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ssh: ${{ secrets.DOCUMENTER_KEY }} |
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,48 @@ | ||
## from : | ||
## https://github.com/julia-actions/julia-format/blob/a8502d9a6b40ef5da6e88721e253e79981aa26d1/workflows/format_check.yml | ||
|
||
name: format-check | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "release-" | ||
tags: "*" | ||
pull_request: | ||
types: [unlabeled, opened, synchronize, reopened] | ||
|
||
# Only trigger the job when `draft` label is not assigned to the PR | ||
jobs: | ||
format: | ||
runs-on: ${{ matrix.os }} | ||
if: contains(github.event.pull_request.labels.*.name, 'draft') == false | ||
strategy: | ||
matrix: | ||
julia-version: [1.9] | ||
julia-arch: [x86] | ||
os: [ubuntu-latest] | ||
steps: | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: ${{ matrix.julia-version }} | ||
|
||
- uses: actions/checkout@v1 | ||
- name: Install JuliaFormatter and format | ||
# This will use the latest version by default but you can set the version like so: | ||
# | ||
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))' | ||
run: | | ||
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))' | ||
julia -e 'using JuliaFormatter; format(".", verbose=true)' | ||
- name: Format check | ||
run: | | ||
julia -e ' | ||
out = Cmd(`git diff --name-only`) |> read |> String | ||
if out == "" | ||
exit(0) | ||
else | ||
@error "Some files have not been formatted !!!" | ||
write(stdout, out) | ||
exit(1) | ||
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,6 @@ | ||
/docs/build/ | ||
/docs/site/ | ||
/docs/Manifest.toml | ||
/docs/src/example/ | ||
/docs/src/tutorial/ | ||
.vscode |
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,4 @@ | ||
name = "BcubeTutorials" | ||
uuid = "96b9ee7b-4a19-4ce3-a39f-9fbf54b5b072" | ||
authors = ["Ghislain Blanchard, Lokman Bennani and Maxime Bouyges"] | ||
version = "0.1.0" |
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,2 +1,9 @@ | ||
# BcubeTutorials.jl | ||
Tutorials and examples for the Bcube project | ||
|
||
[![](https://img.shields.io/badge/docs-release-blue.svg)](https://bcube-project.github.io/BcubeTutorials.jl) | ||
|
||
Documented tutorials and various examples for the [Bcube.jl](https://github.com/bcube-project/Bcube.jl) project. Browse the [online documentation](https://bcube-project.github.io/BcubeTutorials.jl). | ||
|
||
## Authors | ||
|
||
Ghislain Blanchard, Lokman Bennani and Maxime Bouyges. |
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,4 @@ | ||
[deps] | ||
BcubeTutorials = "96b9ee7b-4a19-4ce3-a39f-9fbf54b5b072" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" |
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,87 @@ | ||
push!(LOAD_PATH, "../src/") | ||
|
||
using BcubeTutorials | ||
using Documenter | ||
using Literate | ||
|
||
# Alias for `Literate.markdown` | ||
function gen_markdown(src, name, dir) | ||
Literate.markdown(joinpath(src, name), dir; documenter = false, execute = false) | ||
end | ||
|
||
""" | ||
Build a markdown file with just the content of the julia file in it. | ||
""" | ||
function julia_to_markdown(src_dir, target_dir, filename, title) | ||
open(joinpath(target_dir, split(filename, ".")[1] * ".md"), "w") do io | ||
println(io, "# " * title) | ||
println(io, "```julia") | ||
f = open(joinpath(src_dir, filename), "r") | ||
lines = readlines(f) | ||
close(f) | ||
map(line -> println(io, line), lines) | ||
println(io, "```") | ||
end | ||
end | ||
|
||
# Generate tutorials | ||
# `documenter = false` to avoid Documenter to execute cells | ||
tutorial_names = | ||
["helmholtz", "heat_equation", "linear_transport", "phase_field_supercooled"] | ||
tutorial_src = joinpath(@__DIR__, "..", "src", "tutorial") | ||
tutorial_dir = joinpath(@__DIR__, "src", "tutorial") | ||
Sys.rm(tutorial_dir; recursive = true, force = true) | ||
map(filename -> gen_markdown(tutorial_src, "$(filename).jl", tutorial_dir), tutorial_names) | ||
|
||
# Generate "commented" examples | ||
# `documenter = false` to avoid Documenter to execute cells | ||
example_src = joinpath(@__DIR__, "..", "src", "example") | ||
example_dir = joinpath(@__DIR__, "src", "example") | ||
Sys.rm(example_dir; recursive = true, force = true) | ||
mkdir(example_dir) | ||
# gen_markdown(example_src, "euler_naca_steady.jl", example_dir) | ||
# gen_markdown(example_src, "covo.jl", example_dir) | ||
# gen_markdown(example_src, "linear_elasticity.jl", example_dir) | ||
|
||
# Generate "uncommented" examples | ||
julia_to_markdown( | ||
example_src, | ||
example_dir, | ||
"euler_naca_steady.jl", | ||
"Euler equations on a NACA0012", | ||
) | ||
julia_to_markdown(example_src, example_dir, "covo.jl", "Euler equations - covo") | ||
julia_to_markdown(example_src, example_dir, "linear_elasticity.jl", "Linear elasticity") | ||
julia_to_markdown( | ||
example_src, | ||
example_dir, | ||
"linear_thermoelasticity.jl", | ||
"Linear thermo-elasticity", | ||
) | ||
|
||
makedocs(; | ||
modules = [BcubeTutorials], | ||
authors = "Ghislain Blanchard, Lokman Bennani and Maxime Bouyges", | ||
sitename = "BcubeTutorials", | ||
clean = true, | ||
doctest = false, | ||
format = Documenter.HTML(; | ||
prettyurls = get(ENV, "CI", "false") == "true", | ||
canonical = "https://bcube-project.github.io/BcubeTutorials.jl", | ||
assets = String[], | ||
), | ||
checkdocs = :none, | ||
pages = [ | ||
"Home" => "index.md", | ||
"Tutorials" => ["tutorial/$(filename).md" for filename in tutorial_names], | ||
"Advanced examples" => Any[ | ||
"example/covo.md", | ||
"example/euler_naca_steady.md", | ||
"example/linear_elasticity.md", | ||
"example/linear_thermoelasticity.md", | ||
], | ||
"How to..." => "howto/howto.md", | ||
], | ||
) | ||
|
||
deploydocs(; repo = "github.com/bcube-project/BcubeTutorials.jl.git", push_preview = true) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,84 @@ | ||
# How to | ||
|
||
To be completed to answer common user questions. | ||
|
||
## Comparing manually the benchmarks with `main` | ||
|
||
Let's say you want to compare the performance of your current branch (named "target" hereafter) with the `main` branch (named "baseline" hereafter). | ||
|
||
Open from `Bcube.jl/` a REPL and type: | ||
|
||
```julia | ||
pkg> activate --temp | ||
pkg> add PkgBenchmark BenchmarkTools | ||
pkg> dev . | ||
using PkgBenchmark | ||
import Bcube | ||
benchmarkpkg(Bcube, BenchmarkConfig(; env = Dict("JULIA_NUM_THREADS" => "1")); resultfile = joinpath(@__DIR__, "result-target.json")) | ||
``` | ||
|
||
This will create a `result-target.json` in the current directory. | ||
|
||
Then checkout the `main` branch. Start a fresh REPL and type (almost the same): | ||
|
||
```julia | ||
pkg> activate --temp | ||
pkg> add PkgBenchmark BenchmarkTools | ||
pkg> dev . | ||
using PkgBenchmark | ||
import Bcube | ||
benchmarkpkg(Bcube, BenchmarkConfig(; env = Dict("JULIA_NUM_THREADS" => "1")); resultfile = joinpath(@__DIR__, "result-baseline.json")) | ||
``` | ||
|
||
This will create a `result-baseline.json` in the current directory. | ||
|
||
You can now "compare" the two files by running (watch-out for the order): | ||
|
||
```julia | ||
target = PkgBenchmark.readresults("result-target.json") | ||
baseline = PkgBenchmark.readresults("result-baseline.json") | ||
judgement = judge(target, baseline) | ||
export_markdown("judgement.md", judgement) | ||
``` | ||
|
||
This will create the markdown file `judgement.md` with the results. | ||
|
||
For more details, once you've built the `judgement` object, you can also type the following code from `https://github.com/tkf/BenchmarkCI.jl`: | ||
|
||
```julia | ||
open("detailed-judgement.md", "w") do io | ||
println(io, "# Judge result") | ||
export_markdown(io, judgement) | ||
println(io) | ||
println(io) | ||
println(io, "---") | ||
println(io, "# Target result") | ||
export_markdown(io, PkgBenchmark.target_result(judgement)) | ||
println(io) | ||
println(io) | ||
println(io, "---") | ||
println(io, "# Baseline result") | ||
export_markdown(io, PkgBenchmark.baseline_result(judgement)) | ||
println(io) | ||
println(io) | ||
println(io, "---") | ||
end | ||
``` | ||
|
||
## Run the benchmark manually | ||
|
||
Let's say you want to run the benchmarks locally (without comparing with `main`) | ||
|
||
Open from `Bcube.jl/` a REPL and type: | ||
|
||
```julia | ||
pkg> activate --temp | ||
pkg> add PkgBenchmark | ||
pkg> dev . | ||
using PkgBenchmark | ||
import Bcube | ||
results = benchmarkpkg(Bcube, BenchmarkConfig(; env = Dict("JULIA_NUM_THREADS" => "1")); resultfile = joinpath(@__DIR__, "result.json")) | ||
export_markdown("results.md", results) | ||
``` | ||
|
||
This will create the markdown file `results.md` with the results. |
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,26 @@ | ||
```@meta | ||
CurrentModule = BcubeTutorials | ||
``` | ||
|
||
# Bcube | ||
|
||
## Purpose of Bcube | ||
|
||
Bcube is a Julia library providing tools for the spatial discretization of partial differential equation(s) (PDE). The main objectives are: | ||
|
||
- to provide a set of tools to quickly assemble an algorithm solving partial differential equation(s) (so the main objective is to help building prototypes without thinking about the numerical core) | ||
- to be completed : efficient/performant PDE resolution? | ||
|
||
This documentation is organised as follow. Checkout the tutorials to see what Bcube is capable of and/or quickly learn how to use it. Then, some more elaborated examples are provided to demonstrate the library capabilities. The "Manual" part explains how the core is organized. Finally, the "API" section is the low level code documentation. | ||
|
||
## Writing documentation | ||
|
||
To write documentation for Bcube, Julia's guidelines should be followed : [https://docs.julialang.org/en/v1/manual/documentation/](https://docs.julialang.org/en/v1/manual/documentation/). Moreover, this project tries to apply the [SciML Style Guide](https://github.com/SciML/SciMLStyle). | ||
|
||
## Conventions | ||
|
||
This documentation follows the following notation or naming conventions: | ||
|
||
- coordinates inside a reference frame are noted $$\hat{x}, \hat{y}$$ or $$\xi, \eta$$ while coordinates in the physical frame are noted $$x,y$$ | ||
- when talking about a mapping, $$F$$ or sometimes $$F_{rp}$$ designates the mapping from the reference element to the physical element. On the other side, $$F^{-1}$$ or sometimes $$F_{pr}$$ designates the physical element to the reference element mapping. | ||
- "dof" means "degree of freedom" |
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,5 @@ | ||
module BcubeTutorials | ||
|
||
# Package is just for auto-docs generation | ||
|
||
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,9 @@ | ||
[deps] | ||
Bcube = "cf06320b-b7f3-4748-8003-81a6b6979792" | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" | ||
Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" | ||
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" | ||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed" | ||
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file should stay in Bcube