comparison src/Grids/mapped_grid.jl @ 1817:d91a9f47380f feature/jet_aqua

Resolve ambiguity of mapped_grid and improve its signature
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Oct 2024 23:28:12 +0200
parents f21bfc5f21aa
children bddcae938ded
comparison
equal deleted inserted replaced
1816:77f1b027d134 1817:d91a9f47380f
92 ) 92 )
93 end 93 end
94 94
95 95
96 """ 96 """
97 mapped_grid(x,J,size...)
98 mapped_grid(x,J,size...)
99 """
100 function mapped_grid end
101 """
97 mapped_grid(x, J, size::Vararg{Int}) 102 mapped_grid(x, J, size::Vararg{Int})
98 103
99 A `MappedGrid` with a default logical grid on the D-dimensional unit hyper 104 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 105 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. 106 and `size` determines the size of the logical grid.
102 """ 107 """
103 function mapped_grid(x, J, size::Vararg{Int}) 108 function mapped_grid(x, J, size::Vararg{Int})
104 D = length(size) 109 D = length(size)
105 lg = equidistant_grid(ntuple(i->0., D), ntuple(i->1., D), size...) 110 lg = equidistant_grid(ntuple(i->0., D), ntuple(i->1., D), size...)
106 return mapped_grid(lg, x, J) 111 return mapped_grid(x, J, lg)
107 end 112
108 113 # parameterspace = ...
109 """ 114 # return mapped_grid(x, J, parameterspace, size...)
110 mapped_grid(lg::Grid, x, J) 115 end
116
117 """
118 mapped_grid(x, J, lg::Grid)
111 119
112 A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are 120 A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are
113 determined by the functions `x` and `J`. 121 determined by the functions `x` and `J`.
114 """ 122 """
115 function mapped_grid(lg::Grid, x, J) 123 function mapped_grid(x, J, lg::Grid)
116 return MappedGrid( 124 return MappedGrid(
117 lg, 125 lg,
118 map(x,lg), 126 map(x,lg),
119 map(J,lg), 127 map(J,lg),
120 ) 128 )
129 end
130
131 """
132 mapped_grid(x, J, lg::Grid)
133
134 A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are
135 determined by the functions `x` and `J`.
136 """
137 function mapped_grid(x, J, parameterspace, size::Vararg{Int})
138 lg = equidistant_grid(parameterspace, size...)
139 return mapped_grid(x, J, lg)
121 end 140 end
122 141
123 """ 142 """
124 metric_tensor(g::MappedGrid) 143 metric_tensor(g::MappedGrid)
125 144