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

Function assemble_vector0

cpp/demo/custom_kernel/main.cpp:103–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101/// @return l2 norm squared of the vector.
102template <std::floating_point T>
103double assemble_vector0(std::shared_ptr<const fem::FunctionSpace<T>> V,
104 auto kernel, const std::vector<std::int32_t>& cells)
105{
106 auto mesh = V->mesh();
107 std::map integrals{
108 std::pair{std::tuple{fem::IntegralType::cell, 0, 0},
109 fem::integral_data<T>(kernel, cells, std::vector<int>{})}};
110 fem::Form<T> L({V}, integrals, mesh, {}, {}, false, {});
111 auto dofmap = V->dofmap();
112 la::Vector<T> b(dofmap->index_map, 1);
113 common::Timer timer("Assembler0 std::function (vector)");
114 fem::assemble_vector(b.array(), L);
115 b.scatter_rev(std::plus<T>());
116 return la::squared_norm(b);
117}
118
119/// @brief Assemble a matrix operator using a lambda kernel function.
120///

Callers

nothing calls this directly

Calls 6

squared_normFunction · 0.85
assemble_vectorFunction · 0.50
meshMethod · 0.45
dofmapMethod · 0.45
arrayMethod · 0.45
scatter_revMethod · 0.45

Tested by

no test coverage detected