Skip to content

Commit

Permalink
manual type inference for bimaterial autodiff
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorMallon committed Sep 21, 2021
1 parent 0172f8e commit 56bea13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Arrays/Autodiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function autodiff_array_hessian(a,i_to_x)
end

function autodiff_array_gradient(a,i_to_x,j_to_i)
i_to_xdual = lazy_map(DualizeMap(ForwardDiff.gradient),i_to_x)
T = Vector{ForwardDiff.Dual{Nothing, Float64, 4}} #,Vector{ForwardDiff.Dual{Nothing, Float64, 0}}}
i_to_xdual = lazy_map(DualizeMap(ForwardDiff.gradient),T,i_to_x)
j_to_ydual = a(i_to_xdual)
j_to_x = lazy_map(Reindex(i_to_x),j_to_i)
j_to_cfg = lazy_map(ConfigMap(ForwardDiff.gradient),j_to_x)
Expand Down
6 changes: 5 additions & 1 deletion src/FESpaces/FEAutodiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ end
function _change_argument(op,f,trian,uh::SingleFieldFEFunction)
U = get_fe_space(uh)
function g(cell_u)
cf = CellField(U,cell_u)
v = get_fe_basis(U)
cell_basis = get_data(v)
T=typeof(cell_u)
cell_field = lazy_map(linear_combination,T,cell_u,cell_basis)
cf = GenericCellField(cell_field,get_triangulation(v),DomainStyle(v))
cell_grad = f(cf)
get_contribution(cell_grad,trian)
end
Expand Down

0 comments on commit 56bea13

Please sign in to comment.