Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #905, replicating the PR #906 #990

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Arrays/CompressedArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function _find_compressed_ones(g)
end

function _lazy_map_compressed(g::CompressedArray...)
vals = map(evaluate, map(gi->gi.values,g)...)
vals = lazy_map(evaluate, map(gi->gi.values,g)...)
ptrs = first(g).ptrs
CompressedArray(vals,ptrs)
end
Expand Down
59 changes: 59 additions & 0 deletions test/GridapTests/issue_905.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module Issue905

using Gridap
using FillArrays
using Test

ptr = [ 1, 5, 9, 13, 17 ]
data = [ 1,2,4,5, 2,3,5,6, 4,5,7,8, 5,6,8,9 ]
cell_vertex_lids = Gridap.Arrays.Table(data,ptr)
node_coordinates = Vector{Point{2,Float64}}(undef,11)

for j in 1:3
for i in 1:3
node_coordinates[3*(j-1)+i]=Point{2,Float64}((i-1)/2.0,(j-1)/2.0)
end
end

polytope = QUAD
scalar_reffe = Gridap.ReferenceFEs.ReferenceFE(polytope,Gridap.ReferenceFEs.lagrangian,Float64,1)
cell_types = collect(Fill(1,length(cell_vertex_lids)))
cell_reffes = [scalar_reffe]
grid = Gridap.Geometry.UnstructuredGrid(node_coordinates,
cell_vertex_lids,
cell_reffes,
cell_types,
Gridap.Geometry.NonOriented())
model = Gridap.Geometry.UnstructuredDiscreteModel(grid)

Ω = Triangulation(model)
dΩ = Measure(Ω,2)

@test dΩ.quad.cell_point === dΩ.quad.cell_point # true
@test get_cell_points(dΩ) === get_cell_points(dΩ) # this was failing in the issue #905

# related application, taken from issue #905
order = 1
function project(order,Ω)
degree = 2*order
dΩ = Measure(Ω,degree)
f = CellState(1.0,dΩ)
reffe = ReferenceFE(lagrangian,Float64,order)
V = FESpace(model,reffe,conformity=:L2)
a(u,v) = ∫( u*v )dΩ
l(v) = ∫( v*f )*dΩ
op = AffineFEOperator(a,l,V,V)
fh = solve(op)
fh
end

# @test project(order,Ω) isa Any

@test try project(order,Ω)
true
catch e
rethrow(e)
false
end

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

@time @testset "Issue869" begin include("issue_869.jl") end

@time @testset "Issue905" begin include("issue_905.jl") end

end # module
Loading