# Assemble dirac delta in all nodes

Hi, I have a problem in assembling matrix of o in all nodes. can anyone help me? below is s sample which assemble o in domain for one point

``````function MatrixOf(fem_params)
x0 = VectorValue(0,300)  # Position of the field to be optimized
δ = 1
return assemble_matrix(fem_params.U, fem_params.V) do u, v
∫((x->(1/(2*π)*exp(-norm(x - x0)^2 / 2 / δ^2))) * (∇(u) ⋅ ∇(v)) )fem_params.dΩ_c
end
end
``````

i want to do this for all nodes not just x0. i write the code as below

``````co=Gridap.ReferenceFEs.get_node_coordinates(Ω)
function MatrixOf(fem_params)
δ = 1
return assemble_matrix(fem_params.U0_Disp, fem_params.V0_Disp) do u, v
0.5*sum(∫((x->(1/(2*π)*exp(-norm(x-x_i)^2 / 2 / δ^2))) * (∇(u))' ⊙ (C_mat ⊙ ∇(v))) for x_i in fem_params.co)fem_params.dΩ
end
end
and the error is
``````

MethodError: no method matching +(::Integrand, ::Integrand)
Closest candidates are:
+(::Any, ::Any, ::Any, ::Any…) at operators.jl:591
+(::Union{MathOptInterface.ScalarAffineFunction{T}, MathOptInterface.ScalarQuadraticFunction{T}}, ::T) where T at C:\Users\marya.julia\packages\MathOptInterface\goW8i\src\Utilities\functions.jl:1783
+(::Tangent{P}, ::P) where P at C:\Users\marya.julia\packages\ChainRulesCore\0t04l\src\tangent_arithmetic.jl:146

Stacktrace:
@ Base .\reduce.jl:24
[2] BottomRF
@ .\reduce.jl:81 [inlined]
[3] MappingRF
@ .\reduce.jl:95 [inlined]
[4] _foldl_impl
@ .\reduce.jl:62 [inlined]
[5] foldl_impl
@ .\reduce.jl:48 [inlined]
[6] mapfoldl_impl
@ .\reduce.jl:44 [inlined]
[7] #mapfoldl#259
@ .\reduce.jl:170 [inlined]
[8] mapfoldl
@ .\reduce.jl:170 [inlined]
[9] #mapreduce#263
@ .\reduce.jl:302 [inlined]
[10] mapreduce
@ .\reduce.jl:302 [inlined]
[11] sum#266
@ .\reduce.jl:528 [inlined]
[12] sum
@ .\reduce.jl:528 [inlined]
[13] sum#267
@ .\reduce.jl:557 [inlined]
[14] sum
@ .\reduce.jl:557 [inlined]
[15] (::var"#784#787"{NamedTuple{(:V0_Disp, :U0_Disp, :Q, :P, :Qf, :Pf, :np, :Ω, :dΩ, :n_Γ_Load, :dΓ_Load, :co), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, GenericCellField{ReferenceDomain}, Gridap.CellData.GenericMeasure, Vector{VectorValue{2, Float64}}}}, Int64})(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain})
@ Main .\In[228]:4
[16] assemble_matrix(f::var"#784#787"{NamedTuple{(:V0_Disp, :U0_Disp, :Q, :P, :Qf, :Pf, :np, :Ω, :dΩ, :n_Γ_Load, :dΓ_Load, :co), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, GenericCellField{ReferenceDomain}, Gridap.CellData.GenericMeasure, Vector{VectorValue{2, Float64}}}}, Int64}, a::Gridap.FESpaces.GenericSparseMatrixAssembler, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\marya.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:285
[17] assemble_matrix
@ C:\Users\marya.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:342 [inlined]
[18] MatrixOf(fem_params::NamedTuple{(:V0_Disp, :U0_Disp, :Q, :P, :Qf, :Pf, :np, :Ω, :dΩ, :n_Γ_Load, :dΓ_Load, :co), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, GenericCellField{ReferenceDomain}, Gridap.CellData.GenericMeasure, Vector{VectorValue{2, Float64}}}})
@ Main .\In[228]:3
[19] top-level scope
@ show.jl:1047

``````to be more clear i want to do optimization at each node not just one specified point
thank you``````