@@ -50,3 +50,43 @@ function Adapt.adapt_structure(to,v::PSparseMatrix)
5050 row_par = v. row_partition
5151 PSparseMatrix (matrix_partition,row_par,col_par,v. assembled)
5252end
53+
54+ function Adapt. adapt_structure (to,v:: PVector )
55+ new_local_values = map (local_values (v)) do myvals
56+ Adapt. adapt_structure (to,myvals)
57+ end
58+ new_cache = Adapt. adapt_structure (to,v. cache)
59+ new_v = PVector (new_local_values,v. index_partition, new_cache)
60+ new_v
61+ end
62+
63+ function Adapt. adapt_structure (to, cache:: SplitVectorAssemblyCache )
64+ # Adapt all the components
65+ neighbors_snd = cache. neighbors_snd
66+ neighbors_rcv = cache. neighbors_rcv
67+ buffer_snd = map (cache. buffer_snd) do ja
68+ Adapt. adapt_structure (to, ja)
69+ end
70+ buffer_rcv = map (cache. buffer_rcv) do ja
71+ Adapt. adapt_structure (to, ja)
72+ end
73+ exchange_setup = cache. exchange_setup
74+ ghost_indices_snd = map (cache. ghost_indices_snd) do ja
75+ Adapt. adapt_structure (to, ja)
76+ end
77+ own_indices_rcv = map (cache. own_indices_rcv) do ja
78+ Adapt. adapt_structure (to, ja)
79+ end
80+
81+ # Create new cache with adapted components
82+ SplitVectorAssemblyCache (
83+ neighbors_snd,
84+ neighbors_rcv,
85+ ghost_indices_snd,
86+ own_indices_rcv,
87+ buffer_snd,
88+ buffer_rcv,
89+ exchange_setup,
90+ false
91+ )
92+ end
0 commit comments