diff --git a/cpp/demo/codim_0_assembly/main.cpp b/cpp/demo/codim_0_assembly/main.cpp index c1797e60e66..a042c47745d 100644 --- a/cpp/demo/codim_0_assembly/main.cpp +++ b/cpp/demo/codim_0_assembly/main.cpp @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) std::map>, std::span> entity_maps - = {{const_ptr, std::span(mesh_to_submesh.data(), + = {{const_ptr, std::span(mesh_to_submesh.data(), mesh_to_submesh.size())}}; // Next we compute the integration entities on the integration domain `mesh` @@ -113,8 +113,8 @@ int main(int argc, char* argv[]) fem::IntegralType::cell, *mesh->topology(), cell_marker.find(2), tdim); subdomain_map[fem::IntegralType::cell].push_back( - {3, std::span(integration_entities.data(), - integration_entities.size())}); + {3, + std::span(integration_entities.data(), integration_entities.size())}); // We can now create the bi-linear form auto a_mixed = std::make_shared>( diff --git a/cpp/demo/hyperelasticity/main.cpp b/cpp/demo/hyperelasticity/main.cpp index aa700c16e4a..01790d7408e 100644 --- a/cpp/demo/hyperelasticity/main.cpp +++ b/cpp/demo/hyperelasticity/main.cpp @@ -86,7 +86,7 @@ class HyperElasticProblem return [&](const Vec x, Vec) { // Assemble b and update ghosts - std::span b(_b.mutable_array()); + std::span b(_b.mutable_array()); std::ranges::fill(b, 0); fem::assemble_vector(b, *_l); VecGhostUpdateBegin(_b_petsc, ADD_VALUES, SCATTER_REVERSE); @@ -97,11 +97,11 @@ class HyperElasticProblem VecGhostGetLocalForm(x, &x_local); PetscInt n = 0; VecGetSize(x_local, &n); - const T* x_array = nullptr; - VecGetArrayRead(x_local, &x_array); - auto _x = std::span(x_array, n); - std::ranges::for_each(_bcs, [b, _x](auto& bc) { bc->set(b, _x, -1); }); - VecRestoreArrayRead(x_local, &x_array); + const T* _x = nullptr; + VecGetArrayRead(x_local, &_x); + std::ranges::for_each(_bcs, [b, x = std::span(_x, n)](auto& bc) + { bc->set(b, x, -1); }); + VecRestoreArrayRead(x_local, &_x); }; } diff --git a/cpp/demo/interpolation_different_meshes/main.cpp b/cpp/demo/interpolation_different_meshes/main.cpp index c7d381f4c3c..c83cd0852fc 100644 --- a/cpp/demo/interpolation_different_meshes/main.cpp +++ b/cpp/demo/interpolation_different_meshes/main.cpp @@ -78,8 +78,7 @@ int main(int argc, char* argv[]) = fem::create_interpolation_data( u_hex->function_space()->mesh()->geometry(), *u_hex->function_space()->element(), - *u_tet->function_space()->mesh(), - std::span(cells), 1e-8); + *u_tet->function_space()->mesh(), std::span(cells), 1e-8); u_hex->interpolate(*u_tet, cells, interpolation_data); #ifdef HAS_ADIOS2