Skip to content

Commit abb8b38

Browse files
committedJun 25, 2020
Fixed tests after changes introduced in 1aae8ae
1 parent 86f85cd commit abb8b38

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed
 

‎Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PETSc = "743b6f9b-fae8-55fc-a981-4e9a2885e829"
1111
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1212

1313
[compat]
14-
Gridap = "0.10.0"
14+
Gridap = "~0.10.0"
1515
julia = "1"
1616

1717
[extras]

‎src/SequentialDistributedVectors.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ end
7777

7878
# Julia vectors
7979
function Base.getindex(a::Vector,indices::SequentialDistributedIndexSet)
80-
DistributedVector(indices,indices,a) do part, indices, a
81-
a[indices.lid_to_gid]
80+
dv = DistributedVector{eltype(a)}(indices)
81+
do_on_parts(dv,indices,a) do part, v, indices, a
82+
for i=1:length(v)
83+
v[i]=a[indices.lid_to_gid[i]]
84+
end
8285
end
86+
dv
8387
end
8488

8589
#function exchange!(a::Vector)

‎test/DistributedVectorsTests.jl

+8-4
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,20 @@ indices = DistributedIndexSet(comm,n) do part
2020
IndexSet(n,lid_to_gid,lid_to_owner)
2121
end
2222

23-
a = DistributedVector(indices) do part
24-
fill(10*part,6)
23+
a = DistributedVector{Int}(indices)
24+
do_on_parts(a) do part, a
25+
for i=1:length(a)
26+
a[i]=10*part
27+
end
2528
end
2629

2730
exchange!(a)
2831

2932
@test a.parts == [[10, 10, 10, 10, 10, 20], [10, 20, 20, 20, 20, 20]]
3033

31-
b = DistributedVector{Int}(indices,a) do part, a
32-
a .+ part
34+
b = DistributedVector{Int}(indices)
35+
do_on_parts(b,a) do part, b, a
36+
b .= a .+ part
3337
end
3438

3539
c = b[indices]

0 commit comments

Comments
 (0)
Please sign in to comment.