MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / assemble_matrix0

Function assemble_matrix0

cpp/demo/custom_kernel/main.cpp:73–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71/// @return Frobenius norm squared of the matrix.
72template <std::floating_point T>
73double 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.

Callers

nothing calls this directly

Calls 11

cellsFunction · 0.85
finalizeMethod · 0.80
mat_add_valuesMethod · 0.80
SparsityPatternClass · 0.50
assemble_matrixFunction · 0.50
meshMethod · 0.45
dofmapMethod · 0.45
commMethod · 0.45
index_map_bsMethod · 0.45
scatter_revMethod · 0.45
squared_normMethod · 0.45

Tested by

no test coverage detected