Skip to content

Commit

Permalink
Improve error message (#3267)
Browse files Browse the repository at this point in the history
* Improve error message

* Support pathlib to gmsh
  • Loading branch information
garth-wells committed Jun 12, 2024
1 parent 37e078c commit 3c927f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cpp/dolfinx/fem/DirichletBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ find_local_entity_index(const mesh::Topology& topology,
if (!e_to_c)
{
throw std::runtime_error(
"Entity-to-cell connectivity has not been computed.");
"Entity-to-cell connectivity has not been computed. Missing dims "
+ std::to_string(dim) + "->" + std::to_string(tdim));
}

auto c_to_e = topology.connectivity(tdim, dim);
if (!c_to_e)
{
throw std::runtime_error(
"Cell-to-entity connectivity has not been computed.");
"Cell-to-entity connectivity has not been computed. Missing dims "
+ std::to_string(tdim) + "->" + std::to_string(dim));
}

std::vector<std::pair<std::int32_t, int>> entity_indices;
Expand Down
5 changes: 3 additions & 2 deletions python/dolfinx/io/gmshio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""Tools to extract data from Gmsh models."""

import typing
from pathlib import Path

from mpi4py import MPI as _MPI

Expand Down Expand Up @@ -332,7 +333,7 @@ def model_to_mesh(


def read_from_msh(
filename: str,
filename: typing.Union[str, Path],
comm: _MPI.Comm,
rank: int = 0,
gdim: int = 3,
Expand Down Expand Up @@ -369,7 +370,7 @@ def read_from_msh(
if comm.rank == rank:
gmsh.initialize()
gmsh.model.add("Mesh from file")
gmsh.merge(filename)
gmsh.merge(str(filename))
msh = model_to_mesh(gmsh.model, comm, rank, gdim=gdim, partitioner=partitioner)
gmsh.finalize()
return msh
Expand Down

0 comments on commit 3c927f8

Please sign in to comment.