Skip to content

Commit 6ee96bc

Browse files
committed
Bugfix in pvector!
1 parent af81bf2 commit 6ee96bc

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/p_vector.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ function pvector(f,I,V,rows;
598598
map(map_local_to_global!,I,rows_sa)
599599
end
600600
A = PVector(values_sa,rows_sa)
601-
if assemble
601+
if !assembled && assemble
602602
t = PartitionedArrays.assemble(A,rows;reuse=true)
603603
else
604604
t = @async A,nothing
@@ -631,7 +631,7 @@ function pvector!(B,V,cache)
631631
rows_sa = partition(axes(A,1))
632632
values_sa = partition(A)
633633
map(update!,values_sa,K,V)
634-
if !assembled && assembled
634+
if !assembled && assemble
635635
t = PartitionedArrays.assemble!(B,A,cacheB)
636636
else
637637
t = @async B
@@ -964,7 +964,7 @@ function assemble!(w::PVector,v::PVector,cache)
964964
# for the moment.
965965
# The construction of v2 can (should) be avoided
966966
v2 = cache
967-
map(copy!,local_values(v2),local_values(v))
967+
copy!(v2,v)
968968
t = assemble!(v2)
969969
@async begin
970970
wait(t)

test/fem_example.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,14 @@ function fem_example(distribute)
318318
x = IterativeSolvers.cg(A,b,verbose=i_am_main(rank))
319319
@test norm(x-x̂) < 1.0e-5
320320

321-
psystem!(A,b,V,VV,cache) |> fetch
321+
## Re assembly with different values
322+
V2 = map(i->2*i,V)
323+
VV2 = map(i->2*i,VV)
324+
#display(partition(b))
325+
psystem!(A,b,V2,VV2,cache) |> wait
326+
#display(partition(b))
327+
x = IterativeSolvers.cg(A,b,verbose=i_am_main(rank))
328+
@test norm(x-x̂) < 1.0e-5
322329

323330
# Sub-assembled variant
324331
A,b = psystem(I,J,V,II,VV,dof_partition,dof_partition;assemble=false) |> fetch

0 commit comments

Comments
 (0)