comparison src/Grids/mapped_grid.jl @ 1584:d7483e8af705 feature/sbp_operators/laplace_curvilinear

Merge feature/grids/manifolds
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 26 Apr 2024 08:45:54 +0200
parents d5aa72662161
children d4a6f9effcdd
comparison
equal deleted inserted replaced
1563:6e910408c51a 1584:d7483e8af705
51 # TBD: refine and coarsen could be implemented once we have a simple manifold implementation. 51 # TBD: refine and coarsen could be implemented once we have a simple manifold implementation.
52 # Before we do, we should consider the overhead of including such a field in the mapped grid struct. 52 # Before we do, we should consider the overhead of including such a field in the mapped grid struct.
53 53
54 function mapped_grid(x, J, size...) 54 function mapped_grid(x, J, size...)
55 D = length(size) 55 D = length(size)
56 lg = equidistant_grid(size, ntuple(i->0., D), ntuple(i->1., D)) 56 lg = equidistant_grid(ntuple(i->0., D), ntuple(i->1., D), size...)
57 return MappedGrid( 57 return MappedGrid(
58 lg, 58 lg,
59 map(x,lg), 59 map(x,lg),
60 map(J,lg), 60 map(J,lg),
61 )
62 end
63
64 function mapped_grid(c::Chart, size...)
65 lg = equidistant_grid(parameterspace(c), size...)
66 return MappedGrid(
67 lg,
68 map(c,lg),
69 map(ξ->jacobian(c, ξ), lg),
61 ) 70 )
62 end 71 end
63 72
64 function jacobian_determinant(g::MappedGrid) 73 function jacobian_determinant(g::MappedGrid)
65 return map(jacobian(g)) do ∂x∂ξ 74 return map(jacobian(g)) do ∂x∂ξ