Skip to content
Snippets Groups Projects
Commit bbdd177f authored by Stephan Hilb's avatar Stephan Hilb
Browse files

fix l2_pixel projection for non-square images

parent 7ca0ba59
No related branches found
No related tags found
No related merge requests found
...@@ -310,6 +310,7 @@ Base.eltype(it::PixelIterator) = eltype(it.grid) ...@@ -310,6 +310,7 @@ Base.eltype(it::PixelIterator) = eltype(it.grid)
Return an iterator over all integer cartesian indices (corresponding to pixel Return an iterator over all integer cartesian indices (corresponding to pixel
centers) intersecting a given `cell` or geometry `A`. centers) intersecting a given `cell` or geometry `A`.
The returned indices represent coordinates in the given mesh.
""" """
function PixelIterator(mesh::Mesh, cell::Int) function PixelIterator(mesh::Mesh, cell::Int)
A = SArray{Tuple{ndims_space(mesh), nvertices_cell(mesh)}}( A = SArray{Tuple{ndims_space(mesh), nvertices_cell(mesh)}}(
...@@ -359,7 +360,7 @@ function project_l2_pixel!(u::FeFunction, img) ...@@ -359,7 +360,7 @@ function project_l2_pixel!(u::FeFunction, img)
# first loop to count number of triangles intersecting pixel evaluation # first loop to count number of triangles intersecting pixel evaluation
# points # points
ncells = zeros(axes(img)) ncells = zeros(axes(img, 2), axes(img, 1))
for cell in cells(mesh) for cell in cells(mesh)
pixels = PixelIterator(mesh, cell) pixels = PixelIterator(mesh, cell)
for I in pixels for I in pixels
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment