@@ -527,6 +527,7 @@ struct SplitVectorAssemblyCache{A,B,C,D}
527
527
buffer_snd:: C # NB
528
528
buffer_rcv:: C
529
529
exchange_setup:: D
530
+ reversed:: Bool
530
531
end
531
532
function Base. reverse (a:: SplitVectorAssemblyCache )
532
533
SplitVectorAssemblyCache (
@@ -537,6 +538,7 @@ function Base.reverse(a::SplitVectorAssemblyCache)
537
538
a. buffer_rcv,
538
539
a. buffer_snd,
539
540
a. exchange_setup,
541
+ ! (a. reversed),
540
542
)
541
543
end
542
544
function copy_cache (a:: SplitVectorAssemblyCache )
@@ -549,23 +551,29 @@ function copy_cache(a::SplitVectorAssemblyCache)
549
551
a. own_indices_rcv,
550
552
buffer_snd,
551
553
buffer_rcv,
552
- a. exchange_setup
554
+ a. exchange_setup,
555
+ a. reversed,
553
556
)
554
557
end
555
558
556
559
function p_vector_cache_impl (:: Type{<:SplitVector} ,vector_partition,index_partition)
557
560
neighbors_snd,neighbors_rcv= assembly_neighbors (index_partition)
558
561
indices_snd,indices_rcv = assembly_local_indices (index_partition,neighbors_snd,neighbors_rcv)
559
- map (indices_snd,indices_rcv,index_partition) do ids_snd,ids_rcv,myids
562
+ ghost_indices_snd = map (indices_snd) do ids
563
+ JaggedArray (copy (ids. data),ids. ptrs)
564
+ end
565
+ own_indices_rcv = map (indices_rcv) do ids
566
+ JaggedArray (copy (ids. data),ids. ptrs)
567
+ end
568
+ foreach (ghost_indices_snd,own_indices_rcv,index_partition) do ids_snd,ids_rcv,myids
560
569
map_local_to_ghost! (ids_snd. data,myids)
561
570
map_local_to_own! (ids_rcv. data,myids)
562
571
end
563
- ghost_indices_snd = indices_snd
564
- own_indices_rcv = indices_rcv
565
- buffers_snd,buffers_rcv = map (assembly_buffers,vector_partition,indices_snd,indices_rcv) |> tuple_of_arrays
572
+ buffers_snd,buffers_rcv = map (assembly_buffers,vector_partition,ghost_indices_snd,own_indices_rcv) |> tuple_of_arrays
566
573
graph = ExchangeGraph (neighbors_snd,neighbors_rcv)
567
574
exchange_setup = setup_exchange (buffers_rcv,buffers_snd,graph)
568
- SplitVectorAssemblyCache (neighbors_snd,neighbors_rcv,ghost_indices_snd,own_indices_rcv,buffers_snd,buffers_rcv,exchange_setup)
575
+ reversed = false
576
+ SplitVectorAssemblyCache (neighbors_snd,neighbors_rcv,ghost_indices_snd,own_indices_rcv,buffers_snd,buffers_rcv,exchange_setup,reversed)
569
577
end
570
578
571
579
function p_vector_cache_impl (:: Type{<:SplitVector{<:JaggedArray}} ,vector_partition,index_partition)
@@ -610,6 +618,7 @@ function assemble_impl!(f,vector_partition,cache::JaggedArrayAssemblyCache)
610
618
end
611
619
612
620
function assemble_impl! (f,vector_partition,cache:: SplitVectorAssemblyCache )
621
+ reversed = cache. reversed
613
622
ghost_indices_snd= cache. ghost_indices_snd
614
623
own_indices_rcv= cache. own_indices_rcv
615
624
neighbors_snd= cache. neighbors_snd
@@ -618,7 +627,11 @@ function assemble_impl!(f,vector_partition,cache::SplitVectorAssemblyCache)
618
627
buffer_rcv= cache. buffer_rcv
619
628
exchange_setup= cache. exchange_setup
620
629
foreach (vector_partition,ghost_indices_snd,buffer_snd) do values,ghost_indices_snd,buffer_snd
621
- ghost_vals = values. blocks. ghost
630
+ if reversed
631
+ ghost_vals = values. blocks. own
632
+ else
633
+ ghost_vals = values. blocks. ghost
634
+ end
622
635
for (p,hid) in enumerate (ghost_indices_snd. data)
623
636
buffer_snd. data[p] = ghost_vals[hid]
624
637
end
@@ -629,7 +642,11 @@ function assemble_impl!(f,vector_partition,cache::SplitVectorAssemblyCache)
629
642
@fake_async begin
630
643
wait (t)
631
644
foreach (vector_partition,own_indices_rcv,buffer_rcv) do values,own_indices_rcv,buffer_rcv
632
- own_vals = values. blocks. own
645
+ if reversed
646
+ own_vals = values. blocks. ghost
647
+ else
648
+ own_vals = values. blocks. own
649
+ end
633
650
for (p,oid) in enumerate (own_indices_rcv. data)
634
651
own_vals[oid] = f (own_vals[oid],buffer_rcv. data[p])
635
652
end
0 commit comments