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

Function create_operator

cpp/test/matrix.cpp:31–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29/// @return The assembled matrix
30template <std::floating_point T>
31la::MatrixCSR<T> create_operator(MPI_Comm comm)
32{
33 auto part = mesh::create_cell_partitioner(mesh::GhostMode::none, 2);
34 auto mesh = std::make_shared<mesh::Mesh<T>>(
35 mesh::create_box(comm, {{{0.0, 0.0, 0.0}, {1.0, 1.0, 1.0}}}, {12, 12, 12},
36 mesh::CellType::tetrahedron, part));
37 auto element = basix::create_element<T>(
38 basix::element::family::P, basix::cell::type::tetrahedron, 2,
39 basix::element::lagrange_variant::unset,
40 basix::element::dpc_variant::unset, false);
41
42 auto V = std::make_shared<fem::FunctionSpace<T>>(fem::create_functionspace<T>(
43 mesh, std::make_shared<fem::FiniteElement<T>>(element)));
44
45 // Prepare and set Constants for the bilinear form
46 auto kappa = std::make_shared<fem::Constant<T>>(2.0);
47 auto a = std::make_shared<fem::Form<T, T>>(fem::create_form<T, T>(
48 *form_poisson_a, {V, V}, {}, {{"kappa", kappa}}, {}, {}));
49
50 la::SparsityPattern sp = fem::create_sparsity_pattern(*a);
51 sp.finalize();
52 la::MatrixCSR<T> A(sp);
53 fem::assemble_matrix(A.mat_add_values(), *a, {});
54 A.scatter_rev();
55
56 return A;
57}
58
59void test_matrix_norm()
60{

Callers

nothing calls this directly

Calls 7

create_cell_partitionerFunction · 0.85
finalizeMethod · 0.80
mat_add_valuesMethod · 0.80
create_boxFunction · 0.50
create_sparsity_patternFunction · 0.50
assemble_matrixFunction · 0.50
scatter_revMethod · 0.45

Tested by

no test coverage detected