Skip to content

Commit

Permalink
Simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
garth-wells committed Sep 26, 2024
1 parent f8d2e84 commit bc88ca0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cpp/demo/codim_0_assembly/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int main(int argc, char* argv[])
std::map<std::shared_ptr<const mesh::Mesh<U>>,
std::span<const std::int32_t>>
entity_maps
= {{const_ptr, std::span<const std::int32_t>(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`
Expand All @@ -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<const std::int32_t>(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<fem::Form<T>>(
Expand Down
12 changes: 6 additions & 6 deletions cpp/demo/hyperelasticity/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class HyperElasticProblem
return [&](const Vec x, Vec)
{
// Assemble b and update ghosts
std::span<T> b(_b.mutable_array());
std::span b(_b.mutable_array());
std::ranges::fill(b, 0);
fem::assemble_vector<T>(b, *_l);
VecGhostUpdateBegin(_b_petsc, ADD_VALUES, SCATTER_REVERSE);
Expand All @@ -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<const T>(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);
};
}

Expand Down
3 changes: 1 addition & 2 deletions cpp/demo/interpolation_different_meshes/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const std::int32_t>(cells), 1e-8);
*u_tet->function_space()->mesh(), std::span(cells), 1e-8);
u_hex->interpolate(*u_tet, cells, interpolation_data);

#ifdef HAS_ADIOS2
Expand Down

0 comments on commit bc88ca0

Please sign in to comment.