Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extraction of mesh from array of forms in lifting #2562

Merged
merged 5 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions cpp/dolfinx/fem/assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,18 @@ void apply_lifting(
const std::vector<std::vector<std::shared_ptr<const DirichletBC<T>>>>& bcs1,
const std::vector<std::span<const T>>& x0, T scale)
{
std::shared_ptr<const mesh::Mesh> mesh = a[0]->mesh();
assert(mesh);
std::shared_ptr<const mesh::Mesh> mesh;
for (auto& a_i : a)
{
if (a_i and !mesh)
mesh = a_i->mesh();
if (a_i and mesh and a_i->mesh() != mesh)
throw std::runtime_error("Mismatch between meshes.");
}

if (!mesh)
throw std::runtime_error("Unable to extract a mesh.");

if constexpr (std::is_same_v<double, impl::scalar_value_type_t<T>>)
{
impl::apply_lifting<T>(b, a, mesh->geometry(), constants, coeffs, bcs1, x0,
Expand Down
Loading