@@ -64,7 +64,7 @@ namespace linalg
6464// / @param[in] y
6565void axpy (auto && r, auto alpha, auto && x, auto && y)
6666{
67- std::ranges::transform (x.array (), y.array (), r.mutable_array ().begin (),
67+ std::ranges::transform (x.array (), y.array (), r.array ().begin (),
6868 [alpha](auto x, auto y) { return alpha * x + y; });
6969}
7070
@@ -178,18 +178,18 @@ void solver(MPI_Comm comm)
178178
179179 // Assemble RHS vector
180180 la::Vector<T> b (V->dofmap ()->index_map , V->dofmap ()->index_map_bs ());
181- fem::assemble_vector (b.mutable_array (), L);
181+ fem::assemble_vector (b.array (), L);
182182
183183 // Apply lifting to account for Dirichlet boundary condition
184184 // b <- b - A * x_bc
185- bc->set (ui->x ()->mutable_array (), std::nullopt , T (-1 ));
186- fem::assemble_vector (b.mutable_array (), M);
185+ bc->set (ui->x ()->array (), std::nullopt , T (-1 ));
186+ fem::assemble_vector (b.array (), M);
187187
188188 // Communicate ghost values
189189 b.scatter_rev (std::plus<T>());
190190
191191 // Set BC dofs to zero (effectively zeroes columns of A)
192- bc->set (b.mutable_array (), std::nullopt , T (0 ));
192+ bc->set (b.array (), std::nullopt , T (0 ));
193193
194194 b.scatter_fwd ();
195195
@@ -201,18 +201,18 @@ void solver(MPI_Comm comm)
201201 auto action = [&M, &ui, &bc, &coeff, &constants](auto & x, auto & y)
202202 {
203203 // Zero y
204- y. set ( 0. 0 );
204+ std::ranges::fill (y. array (), 0 );
205205
206206 // Update coefficient ui (just copy data from x to ui)
207- std::ranges::copy (x.array (), ui->x ()->mutable_array ().begin ());
207+ std::ranges::copy (x.array (), ui->x ()->array ().begin ());
208208
209209 // Compute action of A on x
210210 fem::pack_coefficients (M, coeff);
211- fem::assemble_vector (y.mutable_array (), M, std::span<const T>(constants),
211+ fem::assemble_vector (y.array (), M, std::span<const T>(constants),
212212 fem::make_coefficients_span (coeff));
213213
214214 // Set BC dofs to zero (effectively zeroes rows of A)
215- bc->set (y.mutable_array (), std::nullopt , T (0 ));
215+ bc->set (y.array (), std::nullopt , T (0 ));
216216
217217 // Accumulate ghost values
218218 y.scatter_rev (std::plus<T>());
@@ -226,7 +226,7 @@ void solver(MPI_Comm comm)
226226 int num_it = linalg::cg (*u->x (), b, action, 200 , 1e-6 );
227227
228228 // Set BC values in the solution vectors
229- bc->set (u->x ()->mutable_array (), std::nullopt , T (1 ));
229+ bc->set (u->x ()->array (), std::nullopt , T (1 ));
230230
231231 // Compute L2 error (squared) of the solution vector e = (u - u_d, u
232232 // - u_d)*dx
0 commit comments