Skip to content

Commit

Permalink
Merge pull request #360 from sblauth/hotfix/2.0.13
Browse files Browse the repository at this point in the history
Fix a bug when computing the mesh quality in parallel
  • Loading branch information
sblauth authored Dec 6, 2023
2 parents afdaeda + 7f7565a commit 4dd057d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
14 changes: 11 additions & 3 deletions cashocs/geometry/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ def compute(self, mesh: fenics.Mesh) -> np.ndarray:
"""
comm = mesh.mpi_comm()
skewness_array = self._quality_object.skewness(mesh).array()

ghost_offset = mesh.topology().ghost_offset(mesh.topology().dim())
skewness_array = self._quality_object.skewness(mesh).array()[:ghost_offset]
skewness_list: np.ndarray = comm.gather(skewness_array, root=0)
if comm.rank == 0:
skewness_list = np.concatenate(skewness_list, axis=None)
Expand Down Expand Up @@ -330,7 +332,10 @@ def compute(self, mesh: fenics.Mesh) -> np.ndarray:
"""
comm = mesh.mpi_comm()
maximum_angle_array = self._quality_object.maximum_angle(mesh).array()
ghost_offset = mesh.topology().ghost_offset(mesh.topology().dim())
maximum_angle_array = self._quality_object.maximum_angle(mesh).array()[
:ghost_offset
]
maximum_angle_list: np.ndarray = comm.gather(maximum_angle_array, root=0)
if comm.rank == 0:
maximum_angle_list = np.concatenate(maximum_angle_list, axis=None)
Expand Down Expand Up @@ -362,7 +367,10 @@ def compute(self, mesh: fenics.Mesh) -> np.ndarray:
"""
comm = mesh.mpi_comm()
radius_ratios_array = fenics.MeshQuality.radius_ratios(mesh).array()
ghost_offset = mesh.topology().ghost_offset(mesh.topology().dim())
radius_ratios_array = fenics.MeshQuality.radius_ratios(mesh).array()[
:ghost_offset
]
radius_ratios_list: np.ndarray = comm.gather(radius_ratios_array, root=0)
if comm.rank == 0:
radius_ratios_list = np.concatenate(radius_ratios_list, axis=None)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/_static/version_switcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
{
"name": "2.0 (stable)",
"version": "2.0.12",
"url": "https://cashocs.readthedocs.io/en/v2.0.12/",
"version": "2.0.13",
"url": "https://cashocs.readthedocs.io/en/v2.0.13/",
"preferred": true
},
{
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
autodoc_member_order = "alphabetical"
autodoc_mock_imports = [
"fenics",
"numpy",
"petsc4py",
"mpi4py",
"ufl",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"meshio >= 4.1.0",
"numpy",
"typing_extensions",
"matplotlib",
"matplotlib",
]

[project.urls]
Expand Down

0 comments on commit 4dd057d

Please sign in to comment.