Skip to content

Commit ee1c886

Browse files
authored
Merge pull request #37 from SINTEF/dev
ready for 0.5
2 parents 3d323b4 + f6ef728 commit ee1c886

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3973
-1188
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1-
name: CI
1+
name: Running tests on all platforms
22
on:
3-
- pull_request
3+
push:
4+
branches:
5+
- main
6+
- dev
7+
tags: '*'
8+
pull_request:
49
env:
510
JULIA_NUM_THREADS: 2
611
jobs:
712
test:
813
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
914
runs-on: ${{ matrix.os }}
1015
strategy:
11-
fail-fast: false
16+
fail-fast: true
1217
matrix:
1318
version:
14-
- '1.9'
15-
- '^1.9'
19+
- '1.10'
20+
- '^1.10'
1621
os:
1722
- ubuntu-latest
1823
- macOS-latest
1924
- windows-latest
2025
arch:
2126
- x64
2227
steps:
23-
- uses: actions/checkout@v3
24-
- uses: julia-actions/setup-julia@v1
28+
- uses: actions/checkout@v4
29+
- uses: julia-actions/setup-julia@v2
2530
with:
2631
version: ${{ matrix.version }}
2732
arch: ${{ matrix.arch }}
28-
include-all-prereleases: true
29-
- uses: actions/cache@v3
33+
- uses: actions/cache@v4
3034
env:
3135
cache-name: cache-artifacts
3236
with:
@@ -39,30 +43,7 @@ jobs:
3943
- uses: julia-actions/julia-buildpkg@latest
4044
- uses: julia-actions/julia-runtest@latest
4145
- uses: julia-actions/julia-processcoverage@v1
42-
- uses: codecov/codecov-action@v3
46+
- uses: codecov/codecov-action@v4
4347
with:
4448
file: lcov.info
45-
docs:
46-
name: Documentation
47-
runs-on: ubuntu-latest
48-
steps:
49-
- uses: actions/checkout@v3
50-
- uses: julia-actions/setup-julia@v1
51-
with:
52-
version: '1'
53-
- run: |
54-
julia --project=docs -e '
55-
import Pkg; Pkg.add("Documenter")
56-
using Pkg
57-
Pkg.develop(PackageSpec(path=pwd()))
58-
Pkg.instantiate()'
59-
- run: |
60-
julia --project=docs -e '
61-
import Pkg; Pkg.add("Documenter")
62-
using Documenter: doctest
63-
using Muscade
64-
doctest(Muscade)'
65-
- run: julia --project=docs docs/make.jl
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
49+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,46 @@
1-
name: Documentation
2-
# See https://documenter.juliadocs.org/stable/man/hosting/
1+
name: Documentation build and deploy
2+
# See https://documenter.juliadocs.org/stable/man/hosting/
33
# Should host doc at https://sintef.github.io/Muscade.jl/dev
44
# or https://sintef.github.io/Muscade.jl/stable
55
on:
66
push:
77
branches:
88
- main
9+
- dev
910
tags: '*'
1011
pull_request:
12+
branches:
13+
- main
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
1118

1219
jobs:
13-
build:
14-
permissions:
15-
contents: write
20+
build-and-deploy:
1621
runs-on: ubuntu-latest
1722
steps:
18-
- uses: actions/checkout@v2
19-
- uses: julia-actions/setup-julia@v1
23+
- uses: actions/checkout@v4
24+
- uses: julia-actions/setup-julia@latest
2025
with:
2126
version: '1.10'
22-
- name: Install dependencies
23-
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
24-
- name: Build and deploy
27+
- name: Install binary dependencies
28+
run: >
29+
sudo apt-get update &&
30+
sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev xsettingsd x11-xserver-utils
31+
- name: Install Julia dependencies
32+
run: >
33+
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24'
34+
julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
35+
- name: Build and deploy docs
2536
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
27-
# DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
28-
run: julia --project=docs/ docs/make.jl
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: >
39+
cd docs;
40+
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24'
41+
julia --color=yes make.jl
42+
- name: Upload site as artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: Docs build
46+
path: ./docs/build

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2022-2024 SINTEF Ocean
3+
Copyright (c) 2022-2025 SINTEF Ocean
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Project.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
name = "Muscade"
22
uuid = "93488820-1883-11ed-0c34-05177b029e4d"
33
authors = ["Philippe Maincon <philippe.maincon@sintef.no>"]
4-
version = "0.4.0"
4+
version = "0.5.0"
55

66
[deps]
7+
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
89
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
10+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
911
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1012
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1113
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1214
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1315

1416
[compat]
1517
MacroTools = "0.5"
18+
SparseArrays = "1"
1619
SpecialFunctions = "2"
1720
StaticArrays = "1"
18-
SparseArrays = "1"
1921
julia = "1.10,1.11"

docs/Project.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,3 @@ Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
66
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
77
Muscade = "93488820-1883-11ed-0c34-05177b029e4d"
88
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
9-
10-
[compat]
11-
Documenter = "1"
12-
DocumenterCitations = "1"
13-
GLMakie = "0.10"
14-
Interpolations = "0.15"
15-
Literate = "2"
16-
StaticArrays = "1"

docs/build/SharedAnchor.jpg

146 KB
Loading

docs/build/decaysmall.png

240 KB
Loading

docs/build/iFEMsmall.jpg

390 KB
Loading

docs/make.jl

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
nodocstr(str) = replace(str, r"(*ANYCRLF)^\"\"\"$.*?^\"\"\"$"ms => "")
21

32
#Assumes that pwd() is docs
4-
docs = @__DIR__
5-
muscade = normpath(joinpath(docs,".."))
6-
docsrc = joinpath(docs,"src")
7-
examplessrc = normpath(joinpath(docs,"..","examples"))
3+
docs = @__DIR__
4+
muscade = normpath(joinpath(docs,".."))
5+
docsrc = joinpath(docs,"src")
6+
examplesrc(ex) = normpath(joinpath(docs,"..","examples",ex))
7+
examples = ["BeamElements","StaticBeamAnalysis","DynamicBeamAnalysis","DecayAnalysis","DryFriction"]
8+
9+
requiredIncludeFiles = ["BeamElements.jl","Rotations.jl"]
10+
for includeFile requiredIncludeFiles
11+
cp(joinpath(muscade,"examples",includeFile),joinpath(muscade,"docs","src",includeFile),force=true)
12+
end
13+
814

915
using Pkg
1016
Pkg.activate(docs)
@@ -16,37 +22,23 @@ cp(joinpath(muscade,"LICENSE.md"),joinpath(docsrc,"LICENSE.md"),force=true)
1622

1723
## Literate
1824

19-
examples = ["StaticBeamAnalysis","DecayAnalysis","DryFriction"]
20-
21-
function replace_includes(str)
22-
included = ["BeamElements.jl","Rotations.jl"] # in this order
23-
path = "examples/"
24-
for ex in included
25-
content = read(path*ex, String)
26-
str = replace(str, "include(\"$(ex)\")" => content)
27-
end
28-
return nodocstr(str)
29-
end
25+
nodocstr(str) = replace(str, r"(*ANYCRLF)^\"\"\"$.*?^\"\"\"$"ms => "") # Take """ somedocstring """ out of str
3026

27+
@printf "\nLiterate.markdown: *.jl → *.md\n\n"
3128
for ex examples
32-
Literate.markdown(joinpath(examplessrc,@sprintf("%s.jl",ex)),docsrc, preprocess = replace_includes)
29+
Literate.markdown(examplesrc(@sprintf("%s.jl",ex)), docsrc, preprocess = nodocstr)
3330
end
3431

35-
# els = ["DryFriction","BeamElements"]
36-
# for el ∈ els
37-
# Literate.markdown(joinpath(muscade,"examples",@sprintf("%s.jl",el)),docsrc,
38-
# execute=false,codefence= "````julia" => "````", # prevent execution of the code by Literate and Documenter
39-
# preprocess = replace_includes)
40-
# end
41-
4232
## DocumenterCitations
4333

4434
bib = CitationBibliography(joinpath(docsrc, "ref.bib"); style=:authoryear) #:numeric
4535

4636
## Documenter
4737

38+
@printf "\nDocumenter.makedocs: *.md → *.html\n\n"
4839
makedocs(sitename ="Muscade.jl",
4940
modules = [Muscade],
41+
doctest = false, # we do not use doctest, we run Literate.jl on mydemo.jl files that are also included in unit test files
5042
format = Documenter.HTML( prettyurls = false,
5143
sidebar_sitename = false,
5244
size_threshold_warn = 256*1024,
@@ -70,9 +62,9 @@ makedocs(sitename ="Muscade.jl",
7062
build = "build"
7163
)
7264

73-
#deploydocs(muscade = "github.com/SINTEF/Muscade.jl.git",target="build",devbranch="dev")
7465

75-
# https://sintef.github.io/Muscade.jl/v0.3.6/index.html
76-
# https://sintef.github.io/Muscade.jl/stable/index.html
66+
deploydocs(repo = "github.com/SINTEF/Muscade.jl.git",devbranch="dev", devurl="dev", versions = ["stable" => "stable", "dev" => "dev"])
67+
deploydocs(repo = "github.com/SINTEF/Muscade.jl.git",devbranch="main", devurl="stable",versions = ["stable" => "stable", "dev" => "dev"])
7768

78-
Pkg.activate(muscade)
69+
# https://sintef.github.io/Muscade.jl/dev
70+
# https://sintef.github.io/Muscade.jl/stable

docs/src/Adiff.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Automatic differentiation
22

3-
`Muscade` has its own implementation of forward automatic differentiation for historical reasons: Prototypes automaticdifferentiation of `Muscade` where developed in parallel with [`ForwardDiff.jl`](https://juliadiff.org/ForwardDiff.jl/stable/). While the inner workings of [`ForwardDiff.jl`](https://juliadiff.org/ForwardDiff.jl/stable/) and `Muscade`'s version are similar ( with `ForwardDiff.jl` probably having better performance), the API are quite different.
3+
## History
44

5-
`Muscade` evaluates second derivative of the Lagrangian, using dneste *forward* differentiation, which is far from optimal. An ambition is to make use of reverse differentiation (using [`Zygote.jl`](https://fluxml.ai/Zygote.jl/latest/), [`Enzyme.jl`](https://docs.sciml.ai/Enzyme/stable/) or similar).
5+
`Muscade` has its own implementation of forward automatic differentiation for historical reasons: Prototypes automatic differentiation of `Muscade` where developed in parallel with [`ForwardDiff.jl`](https://juliadiff.org/ForwardDiff.jl/stable/). While the inner workings of [`ForwardDiff.jl`](https://juliadiff.org/ForwardDiff.jl/stable/) and `Muscade`'s version are similar ( with `ForwardDiff.jl` probably having better performance), the API are quite different.
6+
7+
`Muscade` evaluates second derivative of the Lagrangian, using nested *forward* differentiation, which is far from optimal. An ambition is to make use of reverse differentiation (using [`Zygote.jl`](https://fluxml.ai/Zygote.jl/latest/), [`Enzyme.jl`](https://docs.sciml.ai/Enzyme/stable/) or similar).
8+
9+
## Usage
610

711
`Muscade`s automatic differentiation is used as follows:
812

@@ -45,3 +49,6 @@ y = value{P}(y1)
4549
yₓ = {P,N}(y2)
4650
```
4751

52+
## Taylor expansions
53+
54+
One way to accelerate automatic differentiation of complicated functions can be to compose the differentiation of simpler functions, in particular function with smaller inputs. Use [`fast`](@ref) for basic applications, and [`revariate`](@ref) and [`compose`](@ref) for advanced usage.

0 commit comments

Comments
 (0)