Mercurial > repos > public > sbplib_julia
annotate src/Grids/manifolds.jl @ 1919:71d218593cac feature/grids/manifolds
Add implementation for size to CartesianAtlas
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 05 Feb 2025 09:05:46 +0100 |
parents | e7f8d11c4670 |
children | ae83c91286a2 |
rev | line source |
---|---|
1558 | 1 """ |
1581
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
2 Chart{D} |
1558 | 3 |
4 A parametrized description of a manifold or part of a manifold. | |
5 """ | |
1581
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
6 struct Chart{D, PST<:ParameterSpace{D}, MT} |
1564
35fe4375b35f
Export things and fix ConcreteChart and Simplex
Jonatan Werpers <jonatan@werpers.com>
parents:
1558
diff
changeset
|
7 mapping::MT |
1558 | 8 parameterspace::PST |
9 end | |
10 | |
1781
a73838c9ef94
Let Chart implement Base.ndims instead of domain_dim
Jonatan Werpers <jonatan@werpers.com>
parents:
1780
diff
changeset
|
11 Base.ndims(::Chart{D}) where D = D |
1581
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
12 (c::Chart)(ξ) = c.mapping(ξ) |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
13 parameterspace(c::Chart) = c.parameterspace |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
14 |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
15 """ |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
16 jacobian(c::Chart, ξ) |
1558 | 17 |
1581
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
18 The jacobian of the mapping evaluated at `ξ`. This defers to the |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
19 implementation of `jacobian` for the mapping itself. If no implementation is |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
20 available one can easily be specified for either the mapping function or the |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
21 chart itself. |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
22 ```julia |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
23 c = Chart(f, ps) |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
24 jacobian(f::typeof(f), ξ) = f′(ξ) |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
25 ``` |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
26 or |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
27 ```julia |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
28 c = Chart(f, ps) |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
29 jacobian(c::typeof(c),ξ) = f′(ξ) |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
30 ``` |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
31 which will both allow calling `jacobian(c,ξ)`. |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
32 """ |
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
33 jacobian(c::Chart, ξ) = jacobian(c.mapping, ξ) |
1644
e213bd857f3f
Add some todos and tbds
Jonatan Werpers <jonatan@werpers.com>
parents:
1625
diff
changeset
|
34 # TBD: Can we register a error hint for when jacobian is called with a function that doesn't have a registered jacobian? |
1581
f77c5309dd2b
Rename ConcreteChart to Chart and remove the abstarct chart type
Jonatan Werpers <jonatan@werpers.com>
parents:
1580
diff
changeset
|
35 |
1558 | 36 |
1867
de4b4f2aee4f
Add some tests for CartesianAtlas
Jonatan Werpers <jonatan@werpers.com>
parents:
1844
diff
changeset
|
37 # TBD: Should Charts, parameterspaces, Atlases, have boundary names? |
1644
e213bd857f3f
Add some todos and tbds
Jonatan Werpers <jonatan@werpers.com>
parents:
1625
diff
changeset
|
38 |
1558 | 39 """ |
40 Atlas | |
41 | |
42 A collection of charts and their connections. | |
1844
1987347752ef
Add stub for connections(::Atlas)
Jonatan Werpers <jonatan@werpers.com>
parents:
1782
diff
changeset
|
43 Should implement methods for `charts` and `connections`. |
1558 | 44 """ |
45 abstract type Atlas end | |
46 | |
47 """ | |
48 charts(::Atlas) | |
49 | |
50 The colloction of charts in the atlas. | |
51 """ | |
52 function charts end | |
53 | |
54 """ | |
1844
1987347752ef
Add stub for connections(::Atlas)
Jonatan Werpers <jonatan@werpers.com>
parents:
1782
diff
changeset
|
55 connections(::Atlas) |
1558 | 56 |
57 TBD: What exactly should this return? | |
58 """ | |
1844
1987347752ef
Add stub for connections(::Atlas)
Jonatan Werpers <jonatan@werpers.com>
parents:
1782
diff
changeset
|
59 function connections end |
1558 | 60 |
61 struct CartesianAtlas <: Atlas | |
62 charts::Matrix{Chart} | |
63 end | |
64 | |
65 charts(a::CartesianAtlas) = a.charts | |
1782
614f731af685
Add stubs for connections method
Jonatan Werpers <jonatan@werpers.com>
parents:
1781
diff
changeset
|
66 connections(a::CartesianAtlas) = nothing |
1919
71d218593cac
Add implementation for size to CartesianAtlas
Jonatan Werpers <jonatan@werpers.com>
parents:
1914
diff
changeset
|
67 Base.size(a::CartesianAtlas) = size(a.charts) |
71d218593cac
Add implementation for size to CartesianAtlas
Jonatan Werpers <jonatan@werpers.com>
parents:
1914
diff
changeset
|
68 |
1558 | 69 |
70 struct UnstructuredAtlas <: Atlas | |
71 charts::Vector{Chart} | |
72 connections | |
73 end | |
74 | |
75 charts(a::UnstructuredAtlas) = a.charts | |
1782
614f731af685
Add stubs for connections method
Jonatan Werpers <jonatan@werpers.com>
parents:
1781
diff
changeset
|
76 connections(a::UnstructuredAtlas) = nothing |