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

improve performance somewhat

parent 8beee843
No related branches found
No related tags found
No related merge requests found
......@@ -214,9 +214,10 @@ function integrate(mesh::Mesh, expr; params...)
end
function bind!(f::FeFunction, cell)
gdofs_view = view(f.space.dofmap, :, :, cell)
gdofs = SArray{Tuple{prod(f.space.size) * ndofs(f.space.element)}}(gdofs_view)
f.ldata .= f.data[gdofs]
@boundscheck cell in axes(f.space.dofmap, 3)
gdofs = SArray{Tuple{prod(f.space.size) * ndofs(f.space.element)}}(
@inbounds view(f.space.dofmap, :, :, cell))
f.ldata .= @inbounds f.data[gdofs]
return f
end
......
......@@ -378,7 +378,7 @@ function area(mesh, cell)
return det(A[:, 2:3] .- A[:, 1]) / 2
end
area(mesh) = mapreduce(cell -> area(mesh, cell), +, cells(mesh))
area(mesh) = mapfoldl(cell -> area(mesh, cell), +, cells(mesh))
function diam(mesh, cell)
A = SArray{Tuple{ndims_space(mesh), nvertices_cell(mesh)}}(
......@@ -392,9 +392,10 @@ end
mesh_size(mesh) = mapreduce(cell -> diam(mesh, cell), max, cells(mesh))
function elmap(mesh, cell)
# TODO: can be improved
@boundscheck cell in axes(mesh.cells, 2)
# TODO: can be improved, how?
A = SArray{Tuple{ndims_space(mesh), nvertices_cell(mesh)}}(
view(mesh.vertices, :, view(mesh.cells, :, cell)))
@inbounds view(mesh.vertices, :, view(mesh.cells, :, cell)))
return x -> A * SA[1 - x[1] - x[2], x[1], x[2]]
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment