Skip to content

Commit

Permalink
Merge pull request #616 from gridap/issue_614
Browse files Browse the repository at this point in the history
Issue 614
  • Loading branch information
fverdugo authored Jun 14, 2021
2 parents a5d2ce3 + 0dc39c3 commit d1cadf6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/Fields/ApplyOptimizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,17 @@ function lazy_map(k::typeof(axes),a::MemoArray)
end

function lazy_map(k::Reindex{<:MemoArray},::Type{T}, j_to_i::AbstractArray) where T
key = (:reindex,objectid(j_to_i))
if ! haskey(k.values.memo,key)
i_to_v = k.values.parent
j_to_v = lazy_map(Reindex(i_to_v),T,j_to_i)
k.values.memo[key] = MemoArray(j_to_v)
end
k.values.memo[key]
# Commenting in order to fix issue #614
#key = (:reindex,objectid(j_to_i))
#if ! haskey(k.values.memo,key)
# i_to_v = k.values.parent
# j_to_v = lazy_map(Reindex(i_to_v),T,j_to_i)
# k.values.memo[key] = MemoArray(j_to_v)
#end
#k.values.memo[key]
i_to_v = k.values.parent
j_to_v = lazy_map(Reindex(i_to_v),T,j_to_i)
MemoArray(j_to_v)
end

function lazy_map(k::PosNegReindex{<:MemoArray,<:MemoArray},::Type{T},i_to_iposneg::AbstractArray) where T
Expand Down
34 changes: 34 additions & 0 deletions test/GridapTests/issue_614.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module Issue614

using Gridap
using Gridap.CellData

domain = (0,2,0,1)
partition = (2,2)
model = CartesianDiscreteModel(domain,partition)
const k = 2
reffeᵤ = ReferenceFE(lagrangian,VectorValue{2,Float64},k)
reffe_p = ReferenceFE(lagrangian,Float64,k-1)
V₀ = TestFESpace(model, reffeᵤ, conformity=:H1)
U = TrialFESpace(V₀)
Q = TestFESpace(model, reffe_p, conformity=:C0)
P = TrialFESpace(Q)
Y = MultiFieldFESpace([V₀,Q])
X = MultiFieldFESpace([U,P])

Ω = Triangulation(model)

degree = 1
xh = interpolate_everywhere([VectorValue(0.0,1.0),x->x[1]],X)

Γc = BoundaryTriangulation(model)
dΓc = Measure(Γc, degree)
nΓc = get_normal_vector(Γc)

for i in 0:1000
uh, ph = xh
α = ph*nΓc
CD, CL = ( ( α )dΓc )
end

end # module
2 changes: 2 additions & 0 deletions test/GridapTests/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ using Test

@time @testset "PoissonLagrangeMultiplier" begin include("PoissonLagrangeMultiplierTests.jl") end

@time @testset "Issue614" begin include("issue_614.jl") end

end # module

0 comments on commit d1cadf6

Please sign in to comment.