Mercurial > repos > public > sbplib_julia
comparison src/Grids/mapped_grid.jl @ 1868:81559cb7b11c feature/grids/manifolds
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 23 Jan 2025 23:22:11 +0100 |
parents | f2b32da29b73 a57cd6fa4ecb |
children | edee7d677efb |
comparison
equal
deleted
inserted
replaced
1867:de4b4f2aee4f | 1868:81559cb7b11c |
---|---|
90 boundary_physicalcoordinates, | 90 boundary_physicalcoordinates, |
91 boundary_jacobian, | 91 boundary_jacobian, |
92 ) | 92 ) |
93 end | 93 end |
94 | 94 |
95 | 95 # TODO: Make sure all methods of `mapped_grid` are implemented correctly and tested. |
96 """ | 96 """ |
97 mapped_grid(x, J, size::Vararg{Int}) | 97 mapped_grid(x, J, size::Vararg{Int}) |
98 | 98 |
99 A `MappedGrid` with a default logical grid on the D-dimensional unit hyper | 99 A `MappedGrid` with a default logical grid on the D-dimensional unit hyper |
100 box [0,1]ᴰ. `x` and `J`are functions to be evaluated on the logical grid | 100 box [0,1]ᴰ. `x` and `J` are functions to be evaluated on the logical grid |
101 and `size` determines the size of the logical grid. | 101 and `size` determines the size of the logical grid. |
102 """ | 102 """ |
103 function mapped_grid(x, J, size::Vararg{Int}) | 103 function mapped_grid(x, J, size::Vararg{Int}) |
104 D = length(size) | 104 D = length(size) |
105 lg = equidistant_grid(ntuple(i->0., D), ntuple(i->1., D), size...) | 105 lg = equidistant_grid(ntuple(i->0., D), ntuple(i->1., D), size...) # TODO: Clean this up with ParamaterSpace once feature/grids/manifolds is merged |
106 return mapped_grid(lg, x, J) | 106 return mapped_grid(x, J, lg) |
107 end | 107 end |
108 | 108 |
109 """ | 109 """ |
110 mapped_grid(lg::Grid, x, J) | 110 mapped_grid(x, J, lg::Grid) |
111 | 111 |
112 A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are | 112 A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are |
113 determined by the functions `x` and `J`. | 113 determined by the functions `x` and `J`. |
114 """ | 114 """ |
115 function mapped_grid(lg::Grid, x, J) | 115 function mapped_grid(x, J, lg::Grid) |
116 return MappedGrid( | 116 return MappedGrid( |
117 lg, | 117 lg, |
118 map(x,lg), | 118 map(x,lg), |
119 map(J,lg), | 119 map(J,lg), |
120 ) | 120 ) |
126 A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are | 126 A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are |
127 determined by the functions `x` and `J`. | 127 determined by the functions `x` and `J`. |
128 """ | 128 """ |
129 function mapped_grid(x, J, ps::ParameterSpace, size::Vararg{Int}) | 129 function mapped_grid(x, J, ps::ParameterSpace, size::Vararg{Int}) |
130 lg = equidistant_grid(ps, size...) | 130 lg = equidistant_grid(ps, size...) |
131 return mapped_grid(lg, x, J) | 131 return mapped_grid(x, J, lg) |
132 end | 132 end |
133 | 133 |
134 """ | 134 """ |
135 metric_tensor(g::MappedGrid) | 135 metric_tensor(g::MappedGrid) |
136 | 136 |