diff --git a/src/function.jl b/src/function.jl
index 2e001fa600d31e495ff1f9ceb8094a4c27b44fe0..1d00318c2ca9e073688e86fefa4de6207c728f07 100644
--- a/src/function.jl
+++ b/src/function.jl
@@ -13,7 +13,6 @@ ndofs(::P1) = 3
ndofs(::DP0) = 1
ndofs(::DP1) = 3
-# FIXME: should be static vectors
# evaluate all (1-dim) local basis functions against x
evaluate_basis(::P1, x) = SA[1 - x[1] - x[2], x[1], x[2]]
evaluate_basis(::DP0, x) = SA[1]
@@ -29,6 +28,8 @@ struct FeSpace{M, Fe, S}
ndofs::Int # = maximum(dofmap)
end
+# TODO: size should probably be a type argument to make the constructor type
+# safe
function FeSpace(mesh, el::P1, size_=(1,))
# special case for P1: dofs correspond to vertices
rdims = prod(size_)
@@ -321,6 +322,7 @@ end
bind!(f::FacetDivergence, cell) = f.cell[] = cell
+# TODO: get rid of this hack as soon as we use size=() for scalar functions
function sample(f::FeFunction)
out = _sample(f)
return f.space.size == (1,) ?
@@ -444,14 +446,15 @@ function save_csv(path, f::FeFunction)
throw(ArgumentError("non-scalar functions unsupported"))
mesh = f.space.mesh
df = DataFrame()
- X = SA[0 1 0; 0 0 1]
+ X = SA[0 1 0; 0 0 1] # corners in local coordinates
for cell in cells(mesh)
bind!(f, cell)
A = SArray{Tuple{ndims_space(mesh), nvertices_cell(mesh)}}(
view(mesh.vertices, :, view(mesh.cells, :, cell)))
for k in axes(A, 2)
- push!(df, (x = A[1, k], y = A[2, k], c = evaluate(f, X[:, k])[1]))
+ push!(df, (x = A[1, k], y = A[2, k],
+ f_xy = evaluate(f, X[:, k])[1]))
end
end
CSV.write(path, df)
diff --git a/src/image.jl b/src/image.jl
index 081d5e5eebc3c9ec10050e1818f5d45b2d0d0f37..0ea64e5d2601d39f2826e0a3a89449d8a88e85fa 100644
--- a/src/image.jl
+++ b/src/image.jl
@@ -2,6 +2,7 @@ export interpolate_bilinear, halve, warp_backwards
eval_neumann(img, x) = img[clamp.(Tuple(x), axes(img))...]
+# uses native array indexing, i.e. 1:n
function interpolate_bilinear(img, x)
x0 = floor.(Int, x)
x1 = x0 .+ 1
diff --git a/src/operator.jl b/src/operator.jl
index b86afcd8fdc3b184dbde9e50308e48e819b10287..1a21b05ad99d82580ef8a2fabc49eaf92f31b04c 100644
--- a/src/operator.jl
+++ b/src/operator.jl
@@ -261,7 +261,7 @@ function project_img2!(u::FeFunction, img)
# size: nrdims
value = evaluate(f, xhat)
# size: nldofs
- phix = evaluate_basis(space.element, SVector{d}(view(qx, :, k)))
+ phix = evaluate_basis(space.element, xhat)
# size: nrdims × nldofs
gdofs = u.space.dofmap[:, :, cell]