diff --git a/cpp/dolfinx/fem/DofMap.cpp b/cpp/dolfinx/fem/DofMap.cpp index 01358c20a0a..015200b3bde 100644 --- a/cpp/dolfinx/fem/DofMap.cpp +++ b/cpp/dolfinx/fem/DofMap.cpp @@ -132,8 +132,8 @@ graph::AdjacencyList fem::transpose_dofmap( std::vector num_local_contributions(max_index + 1, 0); for (std::int32_t c = 0; c < num_cells; ++c) { - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t d = 0; d < dofmap.extent(1); ++d) num_local_contributions[dofs[d]]++; } @@ -148,8 +148,8 @@ graph::AdjacencyList fem::transpose_dofmap( int cell_offset = 0; for (std::int32_t c = 0; c < num_cells; ++c) { - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t d = 0; d < dofmap.extent(1); ++d) data[pos[dofs[d]]++] = cell_offset++; } diff --git a/cpp/dolfinx/fem/Expression.h b/cpp/dolfinx/fem/Expression.h index 483315b3eed..105bce38794 100644 --- a/cpp/dolfinx/fem/Expression.h +++ b/cpp/dolfinx/fem/Expression.h @@ -233,9 +233,8 @@ class Expression for (std::size_t e = 0; e < entities.size() / estride; ++e) { const std::int32_t entity = entities[e * estride]; - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, entity, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, entity, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x_g.begin(), 3 * x_dofs[i]), 3, diff --git a/cpp/dolfinx/fem/Function.h b/cpp/dolfinx/fem/Function.h index 274580c4e7e..411a4237e01 100644 --- a/cpp/dolfinx/fem/Function.h +++ b/cpp/dolfinx/fem/Function.h @@ -473,10 +473,9 @@ class Function phi0_shape.begin(), phi0_shape.end(), 1, std::multiplies{})); impl::mdspan_t phi0(phi0_b.data(), phi0_shape); cmap.tabulate(1, std::vector(tdim), {1, tdim}, phi0_b); - auto dphi0 - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(phi0, std::pair(1, tdim + 1), 0, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto dphi0 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi0, std::pair(1, tdim + 1), 0, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); // Data structure for evaluating geometry basis at specific points. // Used in non-affine case. @@ -484,9 +483,9 @@ class Function std::vector phi_b( std::reduce(phi_shape.begin(), phi_shape.end(), 1, std::multiplies{})); impl::mdspan_t phi(phi_b.data(), phi_shape); - auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(phi, std::pair(1, tdim + 1), 0, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi, std::pair(1, tdim + 1), 0, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); // Reference coordinates for each point std::vector Xb(xshape[0] * tdim); @@ -510,10 +509,8 @@ class Function continue; // Get cell geometry (coordinate dofs) - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, cell_index, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell_index, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); assert(x_dofs.size() == num_dofs_g); for (std::size_t i = 0; i < num_dofs_g; ++i) { @@ -525,12 +522,12 @@ class Function for (std::size_t j = 0; j < gdim; ++j) xp(0, j) = x[p * xshape[1] + j]; - auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); std::array Xpb = {0, 0, 0}; MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan< @@ -614,19 +611,16 @@ class Function cell_info, cell_index, reference_value_size); { - auto _U - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(basis_derivatives_reference_values, 0, p, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _J - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _K - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + basis_derivatives_reference_values, 0, p, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); push_forward_fn(basis_values, _U, _J, detJ[p], _K); } diff --git a/cpp/dolfinx/fem/FunctionSpace.h b/cpp/dolfinx/fem/FunctionSpace.h index 1f795093037..00ed430a670 100644 --- a/cpp/dolfinx/fem/FunctionSpace.h +++ b/cpp/dolfinx/fem/FunctionSpace.h @@ -269,16 +269,15 @@ class FunctionSpace std::reduce(phi_shape.begin(), phi_shape.end(), 1, std::multiplies{})); cmdspan4_t phi_full(phi_b.data(), phi_shape); cmap.tabulate(0, X, Xshape, phi_b); - auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); for (int c = 0; c < num_cells; ++c) { // Extract cell geometry - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) for (std::size_t j = 0; j < gdim; ++j) coordinate_dofs(i, j) = x_g[3 * x_dofs[i] + j]; diff --git a/cpp/dolfinx/fem/assemble_matrix_impl.h b/cpp/dolfinx/fem/assemble_matrix_impl.h index 4ff72297a49..ddc5bc094cd 100644 --- a/cpp/dolfinx/fem/assemble_matrix_impl.h +++ b/cpp/dolfinx/fem/assemble_matrix_impl.h @@ -98,9 +98,8 @@ void assemble_cells( std::int32_t c1 = cells1[index]; // Get cell coordinates/geometry - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -228,9 +227,8 @@ void assemble_exterior_facets( std::int32_t local_facet = facets[index + 1]; // Get cell coordinates/geometry - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -365,17 +363,15 @@ void assemble_interior_facets( std::array local_facet{facets[index + 1], facets[index + 3]}; // Get cell geometry - auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs0.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs0[i]), 3, std::next(cdofs0.begin(), 3 * i)); } - auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs1.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs1[i]), 3, diff --git a/cpp/dolfinx/fem/assemble_scalar_impl.h b/cpp/dolfinx/fem/assemble_scalar_impl.h index 748ca9536b9..87384ca05d4 100644 --- a/cpp/dolfinx/fem/assemble_scalar_impl.h +++ b/cpp/dolfinx/fem/assemble_scalar_impl.h @@ -41,9 +41,8 @@ T assemble_cells(mdspan2_t x_dofmap, std::span> x, std::int32_t c = cells[index]; // Get cell coordinates/geometry - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -81,9 +80,8 @@ T assemble_exterior_facets(mdspan2_t x_dofmap, std::int32_t local_facet = facets[index + 1]; // Get cell coordinates/geometry - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -132,17 +130,15 @@ T assemble_interior_facets(mdspan2_t x_dofmap, = {facets[index + 1], facets[index + 3]}; // Get cell geometry - auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs0.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs0[i]), 3, std::next(cdofs0.begin(), 3 * i)); } - auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs1.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs1[i]), 3, diff --git a/cpp/dolfinx/fem/assemble_vector_impl.h b/cpp/dolfinx/fem/assemble_vector_impl.h index cf6653a20a8..d7295dab34b 100644 --- a/cpp/dolfinx/fem/assemble_vector_impl.h +++ b/cpp/dolfinx/fem/assemble_vector_impl.h @@ -67,9 +67,8 @@ void _lift_bc_cells( std::int32_t c = cells[index]; // Get dof maps for cell - auto dmap1 - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dofmap1, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dmap1 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap1, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); // Check if bc is applied to cell bool has_bc = false; @@ -105,9 +104,8 @@ void _lift_bc_cells( continue; // Get cell coordinates/geometry - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -115,9 +113,8 @@ void _lift_bc_cells( } // Size data structure for assembly - auto dmap0 - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dofmap0, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dmap0 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap0, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); const int num_rows = bs0 * dmap0.size(); const int num_cols = bs1 * dmap1.size(); @@ -217,9 +214,8 @@ void _lift_bc_exterior_facets( std::int32_t local_facet = facets[index + 1]; // Get dof maps for cell - auto dmap1 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - dofmap1, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dmap1 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap1, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); // Check if bc is applied to cell bool has_bc = false; @@ -239,9 +235,8 @@ void _lift_bc_exterior_facets( continue; // Get cell coordinates/geometry - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -249,9 +244,8 @@ void _lift_bc_exterior_facets( } // Size data structure for assembly - auto dmap0 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - dofmap0, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dmap0 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap0, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); const int num_rows = bs0 * dmap0.size(); const int num_cols = bs1 * dmap1.size(); @@ -333,17 +327,15 @@ void _lift_bc_interior_facets( = {facets[index + 1], facets[index + 3]}; // Get cell geometry - auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs0.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs0[i]), 3, std::next(cdofs0.begin(), 3 * i)); } - auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs1.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs1[i]), 3, @@ -511,9 +503,8 @@ void assemble_cells(fem::DofTransformKernel auto dof_transform, std::int32_t c = cells[index]; // Get cell coordinates/geometry - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -527,8 +518,8 @@ void assemble_cells(fem::DofTransformKernel auto dof_transform, dof_transform(_be, cell_info, c, 1); // Scatter cell vector to 'global' vector array - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); if constexpr (_bs > 0) { for (std::size_t i = 0; i < dofs.size(); ++i) @@ -578,9 +569,8 @@ void assemble_exterior_facets(fem::DofTransformKernel auto dof_transform, std::int32_t local_facet = facets[index + 1]; // Get cell coordinates/geometry - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs[i]), 3, @@ -595,8 +585,8 @@ void assemble_exterior_facets(fem::DofTransformKernel auto dof_transform, dof_transform(_be, cell_info, cell, 1); // Add element vector to global vector - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); if constexpr (_bs > 0) { for (std::size_t i = 0; i < dofs.size(); ++i) @@ -646,17 +636,15 @@ void assemble_interior_facets( = {facets[index + 1], facets[index + 3]}; // Get cell geometry - auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs0 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[0], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs0.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs0[i]), 3, std::next(cdofs0.begin(), 3 * i)); } - auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs1 = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[1], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs1.size(); ++i) { std::copy_n(std::next(x.begin(), 3 * x_dofs1[i]), 3, diff --git a/cpp/dolfinx/fem/discreteoperators.h b/cpp/dolfinx/fem/discreteoperators.h index b0c8b9e2c7b..94cc68edd3b 100644 --- a/cpp/dolfinx/fem/discreteoperators.h +++ b/cpp/dolfinx/fem/discreteoperators.h @@ -297,9 +297,8 @@ void interpolation_matrix(const FunctionSpace& V0, for (std::int32_t c = 0; c < num_cells; ++c) { // Get cell geometry (coordinate dofs) - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { for (std::size_t j = 0; j < gdim; ++j) @@ -310,17 +309,16 @@ void interpolation_matrix(const FunctionSpace& V0, std::fill(J_b.begin(), J_b.end(), 0); for (std::size_t p = 0; p < Xshape[0]; ++p) { - auto dphi - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(phi, std::pair(1, tdim + 1), p, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); - auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi, std::pair(1, tdim + 1), p, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); cmap.compute_jacobian(dphi, coord_dofs, _J); - auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); cmap.compute_jacobian_inverse(_J, _K); detJ[p] = cmap.compute_jacobian_determinant(_J, det_scratch); } @@ -342,19 +340,18 @@ void interpolation_matrix(const FunctionSpace& V0, for (std::size_t p = 0; p < basis0.extent(0); ++p) { - auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(basis0, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(basis_reference0, p, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + basis0, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + basis_reference0, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); push_forward_fn0(_u, _U, _J, detJ[p], _K); } @@ -368,20 +365,18 @@ void interpolation_matrix(const FunctionSpace& V0, // Pull back the physical values to the reference of output space for (std::size_t p = 0; p < basis_values.extent(0); ++p) { - auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(basis_values, p, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(mapped_values, p, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + basis_values, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + mapped_values, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); pull_back_fn1(_U, _u, _K, 1.0 / detJ[p], _J); } @@ -401,11 +396,9 @@ void interpolation_matrix(const FunctionSpace& V0, { for (std::size_t i = 0; i < mapped_values.extent(1); ++i) { - auto values - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(mapped_values, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, i, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto values = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + mapped_values, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, i, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); impl::interpolation_apply(Pi_1, values, std::span(local1), bs1); for (std::size_t j = 0; j < local1.size(); j++) Ab[space_dim0 * j + i] = local1[j]; diff --git a/cpp/dolfinx/fem/interpolate.h b/cpp/dolfinx/fem/interpolate.h index 259ee75df5e..95073828762 100644 --- a/cpp/dolfinx/fem/interpolate.h +++ b/cpp/dolfinx/fem/interpolate.h @@ -28,6 +28,18 @@ namespace dolfinx::fem template class Function; +template +concept MDSpan = requires(T x, std::size_t idx) { + x(idx, idx); + { + x.extent(0) + } -> std::integral; + + { + x.extent(1) + } -> std::integral; +}; + /// @brief Compute the evaluation points in the physical space at which /// an expression should be computed to interpolate it in a finite /// element space. @@ -62,9 +74,9 @@ std::vector interpolation_coords(const fem::FiniteElement& element, const T, MDSPAN_IMPL_STANDARD_NAMESPACE::dextents> phi_full(phi_b.data(), phi_shape); cmap.tabulate(0, X, Xshape, phi_b); - auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); // Push reference coordinates (X) forward to the physical coordinates // (x) for each cell @@ -73,9 +85,8 @@ std::vector interpolation_coords(const fem::FiniteElement& element, for (std::size_t c = 0; c < cells.size(); ++c) { // Get geometry data for current cell - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cells[c], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells[c], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofs.size(); ++i) { std::copy_n(std::next(x_g.begin(), 3 * x_dofs[i]), gdim, @@ -268,17 +279,7 @@ void scatter_values( /// f1(x0), f0(x1), f1(x1), ...). /// @param[out] coeffs The degrees of freedom to compute. /// @param[in] bs The block size. -template - requires requires { - requires std::convertible_to< - U, MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan< - const typename std::decay_t::value_type, - MDSPAN_IMPL_STANDARD_NAMESPACE::dextents>>; - requires std::convertible_to< - V, MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan< - const typename std::decay_t::value_type, - MDSPAN_IMPL_STANDARD_NAMESPACE::dextents>>; - } +template void interpolation_apply(U&& Pi, V&& data, std::span coeffs, int bs) { using X = typename dolfinx::scalar_value_type_t; @@ -538,9 +539,8 @@ void interpolate_nonmatching_maps(Function& u1, const Function& u0, for (auto c : cells) { // Get cell geometry (coordinate dofs) - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < num_dofs_g; ++i) { const int pos = 3 * x_dofs[i]; @@ -552,20 +552,17 @@ void interpolate_nonmatching_maps(Function& u1, const Function& u0, std::fill(J_b.begin(), J_b.end(), 0); for (std::size_t p = 0; p < Xshape[0]; ++p) { - auto dphi - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(phi, std::pair(1, tdim + 1), p, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); - - auto _J - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi, std::pair(1, tdim + 1), p, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); cmap.compute_jacobian(dphi, coord_dofs, _J); - auto _K - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); cmap.compute_jacobian_inverse(_J, _K); detJ[p] = cmap.compute_jacobian_determinant(_J, det_scratch); } @@ -588,23 +585,18 @@ void interpolate_nonmatching_maps(Function& u1, const Function& u0, for (std::size_t i = 0; i < basis0.extent(0); ++i) { - auto _u - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(basis0, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _U - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(basis_reference0, i, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _K - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(K, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _J - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(J, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + basis0, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + basis_reference0, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); push_forward_fn0(_u, _U, _J, detJ[i], _K); } @@ -634,27 +626,24 @@ void interpolate_nonmatching_maps(Function& u1, const Function& u0, // Pull back the physical values to the u reference for (std::size_t i = 0; i < values0.extent(0); ++i) { - auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(values0, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(mapped_values0, i, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + values0, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + mapped_values0, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); pull_back_fn1(_U, _u, _K, 1.0 / detJ[i], _J); } - auto values - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE :: - submdspan(mapped_values0, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto values = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + mapped_values0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); interpolation_apply(Pi_1, values, std::span(local1), bs1); apply_inverse_dof_transform1(local1, cell_info, c, 1); @@ -928,10 +917,10 @@ void interpolate(Function& u, std::span f, std::reduce(phi_shape.begin(), phi_shape.end(), 1, std::multiplies{})); cmdspan4_t phi(phi_b.data(), phi_shape); cmap.tabulate(1, X, Xshape, phi_b); - auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(phi, std::pair(1, tdim + 1), - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi, std::pair(1, tdim + 1), + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); const std::function, std::span, std::int32_t, int)> @@ -957,9 +946,8 @@ void interpolate(Function& u, std::span f, for (std::size_t c = 0; c < cells.size(); ++c) { const std::int32_t cell = cells[c]; - auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (int i = 0; i < num_dofs_g; ++i) { const int pos = 3 * x_dofs[i]; @@ -971,19 +959,16 @@ void interpolate(Function& u, std::span f, std::fill(J_b.begin(), J_b.end(), 0); for (std::size_t p = 0; p < Xshape[0]; ++p) { - auto _dphi - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dphi, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, p, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _J - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dphi, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, p, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); cmap.compute_jacobian(_dphi, coord_dofs, _J); - auto _K - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, p, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); cmap.compute_jacobian_inverse(_J, _K); detJ[p] = cmap.compute_jacobian_determinant(_J, det_scratch); } @@ -1004,31 +989,24 @@ void interpolate(Function& u, std::span f, // Get element degrees of freedom for block for (std::size_t i = 0; i < Xshape[0]; ++i) { - auto _u - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(_vals, i, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _U - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(ref_data, i, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _K - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(K, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); - auto _J - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(J, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _u = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + _vals, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _U = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + ref_data, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _K = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + K, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto _J = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + J, i, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); pull_back_fn(_U, _u, _K, 1.0 / detJ[i], _J); } - auto ref - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(ref_data, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto ref = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + ref_data, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); impl::interpolation_apply(Pi, ref, std::span(_coeffs), element_bs); apply_inverse_transpose_dof_transformation(_coeffs, cell_info, cell, 1); @@ -1053,15 +1031,15 @@ void interpolate(Function& u, std::span f, /// @param[in] cells Indices of the cells in the destination mesh on /// which to interpolate. Should be the same as the list used when /// calling fem::interpolation_coords. -/// @param[in] padding Absolute padding of bounding boxes of all entities on -/// `mesh1`. This is used avoid floating point issues when an interpolation -/// point from `mesh0` is on the surface of a cell in `mesh1`. This parameter -/// can also be used for extrapolation, i.e. if cells in `mesh0` is not -/// overlapped by `mesh1`. +/// @param[in] padding Absolute padding of bounding boxes of all +/// entities on `mesh1`. This is used avoid floating point issues when +/// an interpolation point from `mesh0` is on the surface of a cell in +/// `mesh1`. This parameter can also be used for extrapolation, i.e. if +/// cells in `mesh0` is not overlapped by `mesh1`. /// -/// @note Setting the `padding` to a large value will increase runtime of this -/// function, as one has to determine what entity is closest if there is no -/// intersection. +/// @note Setting the `padding` to a large value will increase runtime +/// of this function, as one has to determine what entity is closest if +/// there is no intersection. template std::tuple, std::vector, std::vector, std::vector> diff --git a/cpp/dolfinx/geometry/utils.h b/cpp/dolfinx/geometry/utils.h index 0b7682c735c..4d651dd314b 100644 --- a/cpp/dolfinx/geometry/utils.h +++ b/cpp/dolfinx/geometry/utils.h @@ -51,10 +51,8 @@ std::vector shortest_vector(const mesh::Mesh& mesh, int dim, // Check that we have sent in valid entities, i.e. that they exist in the // local dofmap. One gets a cryptical memory segfault if entities is -1 assert(entities[e] >= 0); - auto dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, entities[e], - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, entities[e], MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); std::vector nodes(3 * dofs.size()); for (std::size_t i = 0; i < dofs.size(); ++i) { @@ -91,9 +89,8 @@ std::vector shortest_vector(const mesh::Mesh& mesh, int dim, const int local_cell_entity = std::distance(cell_entities.begin(), it0); // Tabulate geometry dofs for the entity - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); const std::vector entity_dofs = geometry.cmap().create_dof_layout().entity_closure_dofs( dim, local_cell_entity); @@ -519,9 +516,8 @@ std::int32_t compute_first_colliding_cell(const mesh::Mesh& mesh, std::vector coordinate_dofs(num_nodes * 3); for (auto cell : cells) { - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < num_nodes; ++i) { std::copy_n(std::next(geom_dofs.begin(), 3 * dofs[i]), 3, @@ -867,9 +863,8 @@ determine_point_ownership(const mesh::Mesh& mesh, std::span points, std::int32_t closest_cell = -1; for (auto cell : candidate_collisions.links(i)) { - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); std::vector nodes(3 * dofs.size()); for (std::size_t j = 0; j < dofs.size(); ++j) { diff --git a/cpp/dolfinx/io/ADIOS2Writers.h b/cpp/dolfinx/io/ADIOS2Writers.h index 9b86f244ae2..22840f60d6d 100644 --- a/cpp/dolfinx/io/ADIOS2Writers.h +++ b/cpp/dolfinx/io/ADIOS2Writers.h @@ -260,9 +260,8 @@ std::vector pack_function_data(const fem::Function& u) for (std::int32_t c = 0; c < num_cells; ++c) { auto dofs = dofmap->cell_dofs(c); - auto dofs_x - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(dofmap_x, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs_x = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap_x, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); assert(dofs.size() == dofs_x.size()); for (std::size_t i = 0; i < dofs.size(); ++i) for (int j = 0; j < bs; ++j) diff --git a/cpp/dolfinx/io/vtk_utils.h b/cpp/dolfinx/io/vtk_utils.h index 9a9e29296d0..5fff11b5c8f 100644 --- a/cpp/dolfinx/io/vtk_utils.h +++ b/cpp/dolfinx/io/vtk_utils.h @@ -113,9 +113,9 @@ tabulate_lagrange_dof_coordinates(const fem::FunctionSpace& V) std::reduce(phi_shape.begin(), phi_shape.end(), 1, std::multiplies{})); cmdspan4_t phi_full(phi_b.data(), phi_shape); cmap.tabulate(0, X, Xshape, phi_b); - auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); // Loop over cells and tabulate dofs auto map = topology->index_map(tdim); diff --git a/cpp/dolfinx/io/xdmf_function.cpp b/cpp/dolfinx/io/xdmf_function.cpp index 0bbc662dbdb..8a8717eeeec 100644 --- a/cpp/dolfinx/io/xdmf_function.cpp +++ b/cpp/dolfinx/io/xdmf_function.cpp @@ -135,9 +135,8 @@ void xdmf_function::add_function(MPI_Comm comm, const fem::Function& u, for (std::int32_t c = 0; c < num_cells; ++c) { auto dofs = dofmap->cell_dofs(c); - auto dofs_x = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - dofmap_x, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs_x = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + dofmap_x, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); assert(dofs.size() == dofs_x.size()); for (std::size_t i = 0; i < dofs.size(); ++i) { diff --git a/cpp/dolfinx/io/xdmf_mesh.cpp b/cpp/dolfinx/io/xdmf_mesh.cpp index 1eae5c62adf..7ea1f063012 100644 --- a/cpp/dolfinx/io/xdmf_mesh.cpp +++ b/cpp/dolfinx/io/xdmf_mesh.cpp @@ -73,9 +73,8 @@ void xdmf_mesh::add_topology_data(MPI_Comm comm, pugi::xml_node& xml_node, for (std::int32_t c : entities) { assert(c < (std::int32_t)x_dofmap.extent(0)); - auto xdofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto xdofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < x_dofmap.extent(1); ++i) { std::int64_t global_index = xdofs[vtk_map[i]]; @@ -117,9 +116,8 @@ void xdmf_mesh::add_topology_data(MPI_Comm comm, pugi::xml_node& xml_node, // Get geometry dofs for the entity const std::vector& entity_dofs_e = entity_dofs[local_cell_entity]; - auto xdofs = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto xdofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < entity_dofs_e.size(); ++i) { std::int64_t global_index = xdofs[entity_dofs_e[vtk_map[i]]]; diff --git a/cpp/dolfinx/mesh/Geometry.h b/cpp/dolfinx/mesh/Geometry.h index 4b35117ecb3..a9317ad33a3 100644 --- a/cpp/dolfinx/mesh/Geometry.h +++ b/cpp/dolfinx/mesh/Geometry.h @@ -486,8 +486,8 @@ create_subgeometry(const Topology& topology, const Geometry& geometry, assert(it != cell_entities.end()); std::size_t local_entity = std::distance(cell_entities.begin(), it); - auto xc = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(xdofs, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto xc = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + xdofs, cell, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::int32_t entity_dof : closure_dofs[dim][local_entity]) x_indices.push_back(xc[entity_dof]); } diff --git a/cpp/dolfinx/mesh/utils.h b/cpp/dolfinx/mesh/utils.h index 5b36aeb72ed..7a8f17e845d 100644 --- a/cpp/dolfinx/mesh/utils.h +++ b/cpp/dolfinx/mesh/utils.h @@ -135,8 +135,8 @@ compute_vertex_coords_boundary(const mesh::Mesh& mesh, int dim, assert(it != cell_vertices.end()); const int local_pos = std::distance(cell_vertices.begin(), it); - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t j = 0; j < 3; ++j) x_vertices[j * vertices.size() + i] = x_nodes[3 * dofs[local_pos] + j]; vertex_to_pos[v] = i; @@ -434,9 +434,8 @@ compute_vertex_coords(const mesh::Mesh& mesh) std::vector vertex_to_node(num_vertices); for (int c = 0; c < c_to_v->num_nodes(); ++c) { - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); auto vertices = c_to_v->links(c); for (std::size_t i = 0; i < vertices.size(); ++i) vertex_to_node[vertices[i]] = x_dofs[i]; diff --git a/cpp/dolfinx/refinement/plaza.h b/cpp/dolfinx/refinement/plaza.h index 6d86cfbac08..5e17771177c 100644 --- a/cpp/dolfinx/refinement/plaza.h +++ b/cpp/dolfinx/refinement/plaza.h @@ -193,10 +193,8 @@ face_long_edge(const mesh::Mesh& mesh) assert(it1 != cell_vertices.end()); const std::size_t local1 = std::distance(cell_vertices.begin(), it1); - auto x_dofs - = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, cells.front(), - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto x_dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, cells.front(), MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); std::span x0(mesh.geometry().x().data() + 3 * x_dofs[local0], 3); std::span x1(mesh.geometry().x().data() + 3 * x_dofs[local1], diff --git a/cpp/dolfinx/refinement/utils.h b/cpp/dolfinx/refinement/utils.h index 8f842e3d966..e4cc6ce5fe3 100644 --- a/cpp/dolfinx/refinement/utils.h +++ b/cpp/dolfinx/refinement/utils.h @@ -71,8 +71,8 @@ std::pair, std::array> create_new_geometry( for (int c = 0; c < map_c->size_local() + map_c->num_ghosts(); ++c) { auto vertices = c_to_v->links(c); - auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE:: - submdspan(x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); + auto dofs = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + x_dofmap, c, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent); for (std::size_t i = 0; i < vertices.size(); ++i) { auto vertex_pos = entity_dofs_all[0][i][0]; diff --git a/python/dolfinx/wrappers/fem.cpp b/python/dolfinx/wrappers/fem.cpp index 5bf6f2d4c22..6b3b25124c3 100644 --- a/python/dolfinx/wrappers/fem.cpp +++ b/python/dolfinx/wrappers/fem.cpp @@ -749,10 +749,9 @@ void declare_cmap(nb::module_& m, std::string type) 1, std::multiplies{})); cmdspan4_t phi_full(phi_b.data(), phi_shape); self.tabulate(0, std::span(X.data(), X.size()), Xshape, phi_b); - auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto phi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi_full, 0, MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); std::array shape = {X.shape(0), cell_x.shape(1)}; std::vector xb(shape[0] * shape[1]); @@ -803,10 +802,9 @@ void declare_cmap(nb::module_& m, std::string type) cmdspan4_t phi(phi_b.data(), phi_shape); self.tabulate(1, std::vector(tdim), {1, tdim}, phi_b); - auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE:: - MDSPAN_IMPL_PROPOSED_NAMESPACE::submdspan( - phi, std::pair(1, tdim + 1), 0, - MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); + auto dphi = MDSPAN_IMPL_STANDARD_NAMESPACE::submdspan( + phi, std::pair(1, tdim + 1), 0, + MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent, 0); self.compute_jacobian(dphi, g, J); self.compute_jacobian_inverse(J, K);