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

Field: make Field.mesh compatible with meshio v5.1+ #227

Merged
merged 13 commits into from
Jan 15, 2022
Merged
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to **GSTools** will be documented in this file.


## [1.3.5] - Pure Pink - ?

### Bugfixes
- `Field.mesh` was not compatible with [meshio](https://github.com/nschloe/meshio) v5.1+ [#227](https://github.com/GeoStat-Framework/GSTools/pull/227)


## [1.3.4] - Pure Pink - 2021-11

### Enhancements
Expand Down Expand Up @@ -321,7 +327,7 @@ See: [#197](https://github.com/GeoStat-Framework/GSTools/issues/197)
First release of GSTools.


[Unreleased]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.4...HEAD
[1.3.5]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.4...HEAD
[1.3.4]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.3...v1.3.4
[1.3.3]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.2...v1.3.3
[1.3.2]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.1...v1.3.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ in memory for immediate 3D plotting in Python.
- [hankel >= 1.0.2](https://github.com/steven-murray/hankel)
- [emcee >= 3.0.0](https://github.com/dfm/emcee)
- [pyevtk >= 1.1.1](https://github.com/pyscience-projects/pyevtk)
- [meshio>=4.0.3, <5.0](https://github.com/nschloe/meshio)
- [meshio>=4.0.3, <6.0](https://github.com/nschloe/meshio)

### Optional

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ Requirements
- `hankel >= 1.0.2 <https://github.com/steven-murray/hankel>`_
- `emcee >= 3.0.0 <https://github.com/dfm/emcee>`_
- `pyevtk >= 1.1.1 <https://github.com/pyscience-projects/pyevtk>`_
- `meshio>=4.0.3, <5.0 <https://github.com/nschloe/meshio>`_
- `meshio>=4.0.3, <6.0 <https://github.com/nschloe/meshio>`_


Optional
Expand Down
6 changes: 5 additions & 1 deletion gstools/field/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
__all__ = ["fmt_mean_norm_trend", "to_vtk_helper", "generate_on_mesh"]


MESHIO_VERSION = list(map(int, meshio.__version__.split(".")[:2]))


def _fmt_func_val(f_cls, func_val): # pragma: no cover
if func_val is None:
return str(None)
Expand Down Expand Up @@ -190,7 +193,8 @@ def generate_on_mesh(
raise ValueError("Field.mesh: mesh dimension too low!")
pnts = np.empty((0, mesh_dim), dtype=np.double)
for cell in mesh.cells:
pnt = np.mean(mesh.points[cell[1]], axis=1)
cell_points = cell[1] if MESHIO_VERSION < [5, 1] else cell.data
pnt = np.mean(mesh.points[cell_points], axis=1)
offset.append(pnts.shape[0])
length.append(pnt.shape[0])
pnts = np.vstack((pnts, pnt))
Expand Down