| 71 | /// @return Frobenius norm squared of the matrix. |
| 72 | template <std::floating_point T> |
| 73 | double assemble_matrix0(std::shared_ptr<const fem::FunctionSpace<T>> V, |
| 74 | auto kernel, const std::vector<std::int32_t>& cells) |
| 75 | { |
| 76 | // Kernel data (ID, kernel function, cell indices to execute over) |
| 77 | std::map integrals{ |
| 78 | std::pair{std::tuple{fem::IntegralType::cell, 0, 0}, |
| 79 | fem::integral_data<T>(kernel, cells, std::vector<int>{})}}; |
| 80 | |
| 81 | fem::Form<T, T> a({V, V}, integrals, V->mesh(), {}, {}, false, {}); |
| 82 | auto dofmap = V->dofmap(); |
| 83 | auto sp = la::SparsityPattern( |
| 84 | V->mesh()->comm(), {dofmap->index_map, dofmap->index_map}, |
| 85 | {dofmap->index_map_bs(), dofmap->index_map_bs()}); |
| 86 | fem::sparsitybuild::cells(sp, std::pair{cells, cells}, {*dofmap, *dofmap}); |
| 87 | sp.finalize(); |
| 88 | la::MatrixCSR<T> A(sp); |
| 89 | common::Timer timer("Assembler0 std::function (matrix)"); |
| 90 | assemble_matrix(A.mat_add_values(), a, {}); |
| 91 | A.scatter_rev(); |
| 92 | return A.squared_norm(); |
| 93 | } |
| 94 | |
| 95 | /// @brief Assemble a RHS vector using a `std::function` kernel |
| 96 | /// function. |
nothing calls this directly
no test coverage detected