comparison src/Grids/mapped_grid.jl @ 1744:c38eead8be17 feature/grids/curvilinear

Add checks for the size of the jacobian
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 11 Sep 2024 14:11:03 +0200
parents 49bd573ab07f
children 2f7974367cd3
comparison
equal deleted inserted replaced
1743:49bd573ab07f 1744:c38eead8be17
4 jacobian::JT 4 jacobian::JT
5 5
6 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}} 6 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}}
7 if !(size(logicalgrid) == size(physicalcoordinates) == size(jacobian)) 7 if !(size(logicalgrid) == size(physicalcoordinates) == size(jacobian))
8 throw(ArgumentError("Sizes must match")) 8 throw(ArgumentError("Sizes must match"))
9 end
10
11 if size(first(jacobian)) != (length(first(physicalcoordinates)),D)
12 @show size(first(jacobian))
13 @show (length(first(physicalcoordinates)),D)
14 throw(ArgumentError("The size of the jacobian must match the dimensions of the grid and coordinates"))
9 end 15 end
10 16
11 return new{T,D,GT,CT,JT}(logicalgrid, physicalcoordinates, jacobian) 17 return new{T,D,GT,CT,JT}(logicalgrid, physicalcoordinates, jacobian)
12 end 18 end
13 end 19 end