Mercurial > repos > public > sbplib_julia
comparison src/Grids/mapped_grid.jl @ 1773:08e52f442872 feature/grids/curvilinear
Replace AbstractArray{<:Any,2} with AbstractMatrix{<:Any}
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Sun, 15 Sep 2024 18:00:40 +0200 |
| parents | 672897f64d58 |
| children | 035af82f559a |
comparison
equal
deleted
inserted
replaced
| 1768:672897f64d58 | 1773:08e52f442872 |
|---|---|
| 5 coordinates. The physical coordinates and the Jacobian are stored as grid | 5 coordinates. The physical coordinates and the Jacobian are stored as grid |
| 6 functions corresponding to the logical grid. | 6 functions corresponding to the logical grid. |
| 7 | 7 |
| 8 See also: [`logicalgrid`](@ref), [`jacobian`](@ref), [`metric_tensor`](@ref). | 8 See also: [`logicalgrid`](@ref), [`jacobian`](@ref), [`metric_tensor`](@ref). |
| 9 """ | 9 """ |
| 10 struct MappedGrid{T,D, GT<:Grid{<:Any,D}, CT<:AbstractArray{T,D}, JT<:AbstractArray{<:AbstractArray{<:Any, 2}, D}} <: Grid{T,D} | 10 struct MappedGrid{T,D, GT<:Grid{<:Any,D}, CT<:AbstractArray{T,D}, JT<:AbstractArray{<:AbstractMatrix{<:Any}, D}} <: Grid{T,D} |
| 11 logicalgrid::GT | 11 logicalgrid::GT |
| 12 physicalcoordinates::CT | 12 physicalcoordinates::CT |
| 13 jacobian::JT | 13 jacobian::JT |
| 14 | 14 |
| 15 """ | 15 """ |
| 16 MappedGrid(logicalgrid, physicalcoordinates, jacobian) | 16 MappedGrid(logicalgrid, physicalcoordinates, jacobian) |
| 17 | 17 |
| 18 A MappedGrid with the given physical coordinates and jacobian. | 18 A MappedGrid with the given physical coordinates and jacobian. |
| 19 """ | 19 """ |
| 20 function MappedGrid(logicalgrid::GT, physicalcoordinates::CT, jacobian::JT) where {T,D, GT<:Grid{<:Any,D}, CT<:AbstractArray{T,D}, JT<:AbstractArray{<:AbstractArray{<:Any, 2}, D}} | 20 function MappedGrid(logicalgrid::GT, physicalcoordinates::CT, jacobian::JT) where {T,D, GT<:Grid{<:Any,D}, CT<:AbstractArray{T,D}, JT<:AbstractArray{<:AbstractMatrix{<:Any}, D}} |
| 21 if !(size(logicalgrid) == size(physicalcoordinates) == size(jacobian)) | 21 if !(size(logicalgrid) == size(physicalcoordinates) == size(jacobian)) |
| 22 throw(ArgumentError("Sizes must match")) | 22 throw(ArgumentError("Sizes must match")) |
| 23 end | 23 end |
| 24 | 24 |
| 25 if size(first(jacobian)) != (length(first(physicalcoordinates)),D) | 25 if size(first(jacobian)) != (length(first(physicalcoordinates)),D) |
