Skip to content

v0.1.2#237

Merged
clemens-fricke merged 32 commits into
mainfrom
develop
Nov 11, 2025
Merged

v0.1.2#237
clemens-fricke merged 32 commits into
mainfrom
develop

Conversation

@clemens-fricke

@clemens-fricke clemens-fricke commented Nov 10, 2025

Copy link
Copy Markdown
Member

New patch version introducing mfem 3D export. Thanks for the work on this @mkofler96.

Summary by CodeRabbit

  • New Features

    • MFEM export now supports both 2D and 3D meshes.
  • Chores

    • Version bumped to 0.1.2.
    • Updated dev tooling and pre-commit configuration (linting/format tooling adjusted; Python target bumped).
    • CI test matrix adjusted (one macOS runner removed).
  • Tests

    • Added comprehensive tests, 2D fixtures, a robust line-comparison helper, and new MFEM test data for 2D/3D cases.
  • Documentation

    • Added a standardized pull request template.

@coderabbitai

coderabbitai Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

Adds MFEM 2D/3D export logic and tests, updates CI and pre-commit tooling, bumps package version to 0.1.2, introduces multiple MFEM test data files and new/updated test fixtures, and adds a PR template.

Changes

Cohort / File(s) Summary
Repository metadata & CI
\.github/pull_request_template.md, \.github/workflows/tests.yml, \.pre-commit-config.yaml, pyproject.toml
Adds a PR template; removes macos-13 from GitHub Actions matrix; pre-commit changes (adds autoupdate_branch: develop, removes end-of-file-fixer and psf/black, updates Ruff to v0.14.4 and adds ruff-check/ruff-format, bumps blackdoc to v0.4.5); Ruff target-version moved to py39 and test-data excluded; dev-deps reordered.
Version
gustaf/_version.py
Bumped package version constant from "0.1.1" to "0.1.2".
MFEM export implementation
gustaf/io/mfem.py
Added format_array(array) and refactored export() to dispatch by vertex dimension; added _export_2d(mesh) and _export_3d(mesh) to produce MFEM v1.0 element/boundary/vertex sections and compose output; raises on unsupported dimensions.
Minor formatting tweaks
gustaf/create/faces.py, gustaf/utils/tictoc.py
Small, functionally neutral string / f-string formatting adjustments.
Test fixtures & helpers
tests/conftest.py
Added 2D fixtures (vertices_2d, tri_connec_2d, faces_tri_2d, quad_connec_2d, faces_quad_2d), volumes_hexa_222, are_stripped_lines_same comparator, and to_tmpf; removed provide_data_to_unittest.
Test data (MFEM meshes)
tests/data/*
Added MFEM v1.0 files: mfem_triangles_2d.mesh, mfem_quadrilaterals_2d.mesh, mfem_tetrahedra_3d.mesh, mfem_hexahedra_3d.mesh, mfem_hexahedra_3d_222.mesh.
Tests
tests/test_export.py, tests/test_vertices_and_element_updates.py
New parametrized test_mfem_export verifying exported files vs. ground-truth; replaced usage of removed volumes_hexa333 with volumes_hexa_222 in update-elements tests and removed the old fixture.

Sequence Diagram(s)

sequenceDiagram
    participant T as test_mfem_export
    participant E as gustaf.io.mfem.export
    participant X2 as _export_2d
    participant X3 as _export_3d
    participant F as filesystem

    T->>E: export(path, mesh)
    E->>E: inspect mesh.vertices → dim
    alt dim == 2
        E->>X2: _export_2d(mesh)
        X2->>X2: build elements, boundaries, vertices strings
        X2-->>E: return component strings
    else dim == 3
        E->>X3: _export_3d(mesh)
        X3->>X3: build elements, faces, vertices strings
        X3-->>E: return component strings
    else unsupported
        E-->>T: raise NotImplementedError
    end
    E->>F: write MFEM header + composed sections
    T->>F: read generated file
    T->>T: compare with ground-truth using are_stripped_lines_same()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on:
    • gustaf/io/mfem.py: element connectivity ordering, MFEM section formatting, BC mapping and indexing conventions between mesh structures and MFEM format.
    • tests/conftest.py: correctness of are_stripped_lines_same() tokenization and numeric tolerance behavior.
    • tests/test_export.py and added ground-truth files: alignment of expected outputs with exporter formatting.

Possibly related PRs

  • added MFEM 3D export feature #215 — Modifies gustaf/io/mfem.py with the same format_array, _export_2d, _export_3d additions and dimension-dispatch logic; directly related.

Poem

🐰 I hopped through vertices, edges, and nodes,

I stitched 2D maps and mapped 3D roads.
MFEM lines tidy, headers in a row,
Tests read, compare, and let exports show.
A nibble, a cheer — the mesh files go! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'v0.1.2' only indicates a version bump but does not describe the actual changes (MFEM 3D export, pre-commit updates, test fixtures, etc.). Consider using a more descriptive title like 'Add MFEM 3D export support and bump to v0.1.2' to better convey the primary changes in the changeset.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fe94e8 and 3a2ad34.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml (3 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1615148 and 9487cce.

📒 Files selected for processing (16)
  • .github/pull_request_template.md (1 hunks)
  • .github/workflows/tests.yml (1 hunks)
  • .pre-commit-config.yaml (3 hunks)
  • gustaf/_version.py (1 hunks)
  • gustaf/create/faces.py (1 hunks)
  • gustaf/io/mfem.py (1 hunks)
  • gustaf/utils/tictoc.py (1 hunks)
  • pyproject.toml (2 hunks)
  • tests/conftest.py (5 hunks)
  • tests/data/mfem_hexahedra_3d.mesh (1 hunks)
  • tests/data/mfem_hexahedra_3d_222.mesh (1 hunks)
  • tests/data/mfem_quadrilaterals_2d.mesh (1 hunks)
  • tests/data/mfem_tetrahedra_3d.mesh (1 hunks)
  • tests/data/mfem_triangles_2d.mesh (1 hunks)
  • tests/test_export.py (1 hunks)
  • tests/test_vertices_and_element_updates.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-10-11T07:01:29.307Z
Learnt from: clemens-fricke
Repo: tataratat/gustaf PR: 215
File: gustaf/io/mfem.py:227-227
Timestamp: 2024-10-11T07:01:29.307Z
Learning: When no boundary conditions are provided in the `export` function of `gustaf/io/mfem.py`, add a comment to explain that a default boundary condition is being generated for all faces.

Applied to files:

  • tests/test_export.py
  • gustaf/io/mfem.py
📚 Learning: 2024-07-03T08:27:40.999Z
Learnt from: clemens-fricke
Repo: tataratat/gustaf PR: 214
File: examples/export_meshio.py:52-52
Timestamp: 2024-07-03T08:27:40.999Z
Learning: The `export` function in the `gus.io.meshio` module accepts arguments in the order `(export_path, mesh, submeshes=None, **kwargs)`.

Applied to files:

  • gustaf/io/mfem.py
🧬 Code graph analysis (3)
tests/test_export.py (5)
tests/conftest.py (3)
  • to_tmpf (340-345)
  • are_stripped_lines_same (245-336)
  • vertices (54-55)
gustaf/faces.py (3)
  • to_edges (302-317)
  • single_faces (282-296)
  • const_faces (229-240)
gustaf/edges.py (2)
  • single_edges (221-235)
  • const_edges (152-163)
gustaf/volumes.py (1)
  • to_faces (266-281)
gustaf/io/mfem.py (1)
  • export (126-159)
gustaf/io/mfem.py (3)
gustaf/vertices.py (3)
  • vertices (127-139)
  • vertices (142-175)
  • whatami (229-241)
gustaf/faces.py (4)
  • whatami (141-152)
  • edges (124-138)
  • faces (183-195)
  • faces (198-226)
gustaf/volumes.py (1)
  • faces (118-136)
tests/conftest.py (2)
gustaf/faces.py (1)
  • Faces (72-338)
gustaf/volumes.py (1)
  • Volumes (75-281)
🪛 Ruff (0.14.3)
gustaf/io/mfem.py

162-162: Missing return type annotation for private function _export_2d

(ANN202)


220-220: Missing return type annotation for private function _export_3d

(ANN202)

tests/conftest.py

246-246: Missing return type annotation for private function _are_stripped_lines_same

(ANN202)


246-246: Boolean default positional argument in function definition

(FBT002)


304-304: Do not catch blind exception: BaseException

(BLE001)


341-341: Missing return type annotation for private function _to_tmpf

(ANN202)

🔇 Additional comments (27)
.github/pull_request_template.md (1)

1-24: LGTM! Well-structured PR template.

The template provides clear sections and checklists to guide contributors in documenting their changes effectively.

pyproject.toml (2)

54-65: LGTM! Dev dependencies and linting configuration updated appropriately.

The addition of pre-commit and reordering of dependencies align well with the pre-commit configuration updates in this PR. The Ruff target-version update to py39 is consistent with the project's minimum Python version requirement.


83-86: LGTM! Ruff configuration appropriately excludes test data.

Excluding tests/data from linting is appropriate since these are data files, not code.

.pre-commit-config.yaml (3)

10-10: LGTM! Autoupdate branch configuration added.

Setting the autoupdate branch to develop ensures pre-commit CI updates are applied to the correct branch.


30-39: LGTM! Ruff configuration modernized.

The upgrade to Ruff v0.14.3 and the introduction of a dedicated ruff-format hook (replacing Black) consolidate formatting and linting under a single tool, which is a sensible improvement.


49-53: LGTM! Blackdoc version updated.

The version bump from v0.4.1 to v0.4.5 keeps the tooling up-to-date.

gustaf/io/mfem.py (2)

110-123: LGTM! Simple and effective array formatter.

The helper correctly converts NumPy arrays to MFEM's string format (space-separated values, newline-separated rows).


126-160: LGTM! Clean dimension-based dispatch.

The export function appropriately determines the mesh dimension and delegates to specialized 2D/3D exporters. The file writing logic is clean and follows the MFEM format specification.

tests/data/mfem_hexahedra_3d_222.mesh (1)

1-73: LGTM! Valid MFEM mesh data for 2×2×2 hexahedral grid.

The test data file correctly represents a 3D hexahedral mesh in MFEM v1.0 format with proper element connectivity, boundary markers, and vertex coordinates.

tests/data/mfem_hexahedra_3d.mesh (1)

1-29: LGTM! Valid MFEM mesh data for single hexahedral element.

The test data file correctly represents a minimal 3D unit cube mesh in MFEM v1.0 format.

tests/data/mfem_quadrilaterals_2d.mesh (1)

1-23: LGTM! Valid MFEM mesh data for single quadrilateral element.

The test data file correctly represents a minimal 2D unit square mesh in MFEM v1.0 format.

tests/test_vertices_and_element_updates.py (1)

14-17: LGTM! Test fixture update aligns with new test data.

The change from volumes_hexa333 to volumes_hexa_222 correctly references the new fixture that corresponds to the added test data files.

tests/data/mfem_tetrahedra_3d.mesh (1)

1-40: LGTM! Ground-truth test data is well-formed.

The MFEM mesh file correctly represents a tetrahedral decomposition of a unit cube with proper header, dimension specification, element connectivity, boundary faces, and vertex coordinates.

tests/test_export.py (5)

1-15: LGTM! Test structure and parametrization are well-organized.

The test parameters comprehensively cover 2D triangle/quad meshes and 3D tetrahedral/hexahedral meshes, with appropriate ground-truth file mappings.


18-29: LGTM! Test setup is correct.

The parametrized test properly retrieves mesh fixtures dynamically and extracts vertices for boundary condition assignment.


30-42: LGTM! 2D boundary condition assignment is well-designed.

The logic correctly identifies boundary edges and assigns different BC values based on x-coordinate thresholds, providing meaningful test coverage for MFEM export validation.


43-58: LGTM! 3D boundary condition assignment is consistent.

The logic appropriately extends the 2D approach to 3D by assigning BC values to boundary faces based on x-coordinate thresholds, maintaining consistency across dimensions.


62-78: LGTM! Test execution and validation are properly structured.

The test correctly exports the mesh and compares against ground-truth files. Note that ignore_order=True means word order within each line is ignored during comparison, but line-to-line correspondence is preserved.

tests/conftest.py (9)

6-8: LGTM! Necessary imports for new utilities.

The added imports support the new comparison and file handling utilities introduced in this file.


39-50: LGTM! 2D vertex fixture is correctly defined.

The fixture properly creates a 2D unit square vertex array with appropriate dtype.


107-116: LGTM! 2D triangle connectivity is correct.

The two triangles properly tessellate the unit square defined by vertices_2d.


124-126: LGTM! Fixture properly combines 2D vertices and triangle connectivity.


145-153: LGTM! 2D quadrilateral connectivity is correct.

The single quad properly defines the unit square.


161-163: LGTM! Fixture properly combines 2D vertices and quad connectivity.


198-241: LGTM! 3D hexahedral grid fixture is correctly defined.

The fixture properly constructs a 2×2×2 subdivision of a unit cube with 27 vertices and 8 hexahedral elements in standard connectivity order.


244-336: Comparison utility is well-designed for mesh file validation.

The function provides robust line-by-line comparison with optional word-order insensitivity and numeric tolerance via np.isclose, making it suitable for validating exported mesh files against ground truth.


339-345: LGTM! Simple utility for generating test file paths.

The fixture provides a straightforward way to generate consistent temporary filenames for testing.

Comment thread gustaf/io/mfem.py
Comment thread gustaf/io/mfem.py
Comment thread tests/conftest.py
Comment thread tests/data/mfem_triangles_2d.mesh
danielwolff1
danielwolff1 previously approved these changes Nov 11, 2025

@danielwolff1 danielwolff1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, let's get this merged! 🚀

mkofler96 and others added 26 commits November 11, 2025 11:28
Co-authored-by: clemens.fricke <clemens.fricke@googlemail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (4)
tests/data/mfem_triangles_2d.mesh (1)

1-24: LGTM!

The MFEM mesh file format is correct for MFEM v1.0, which uses 0-based indexing as confirmed by the MFEM specification. The mesh describes two triangular elements forming a unit square with proper connectivity and boundary definitions.

tests/conftest.py (1)

304-304: Replace overly broad exception handler.

Catching BaseException at line 304 suppresses system-level exceptions like KeyboardInterrupt and SystemExit. Replace with more specific exception types such as (ValueError, LookupError) or just Exception.

Apply this diff:

-                            except BaseException:
+                            except (ValueError, LookupError):
gustaf/io/mfem.py (2)

162-217: Implementation is correct; consider optional documentation improvements.

The 2D export logic correctly handles triangle and quadrilateral meshes, builds appropriate element and boundary arrays, and formats vertices. The boundary construction safely handles mesh.BC because it's initialized as an empty dictionary in the Faces class.

As noted in past review comments, optional improvements include:

  • Adding a return type annotation -> tuple[str, str, str] for documentation
  • Adding a comment clarifying that when mesh.BC is empty, a zero-length boundary section is produced

Based on learnings


220-282: Implementation is correct; consider optional documentation improvements.

The 3D export logic correctly handles tetrahedral and hexahedral meshes, appropriately determines geometry types for body and face elements, and builds the required arrays. Like the 2D exporter, boundary handling is safe due to BC initialization in the base class.

The same optional improvements suggested for _export_2d apply here:

  • Adding a return type annotation -> tuple[str, str, str] for consistency
  • Adding a comment about empty BC behavior

Based on learnings

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9487cce and 3fe94e8.

📒 Files selected for processing (16)
  • .github/pull_request_template.md (1 hunks)
  • .github/workflows/tests.yml (1 hunks)
  • .pre-commit-config.yaml (3 hunks)
  • gustaf/_version.py (1 hunks)
  • gustaf/create/faces.py (1 hunks)
  • gustaf/io/mfem.py (1 hunks)
  • gustaf/utils/tictoc.py (1 hunks)
  • pyproject.toml (2 hunks)
  • tests/conftest.py (5 hunks)
  • tests/data/mfem_hexahedra_3d.mesh (1 hunks)
  • tests/data/mfem_hexahedra_3d_222.mesh (1 hunks)
  • tests/data/mfem_quadrilaterals_2d.mesh (1 hunks)
  • tests/data/mfem_tetrahedra_3d.mesh (1 hunks)
  • tests/data/mfem_triangles_2d.mesh (1 hunks)
  • tests/test_export.py (1 hunks)
  • tests/test_vertices_and_element_updates.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-10-11T07:01:29.307Z
Learnt from: clemens-fricke
Repo: tataratat/gustaf PR: 215
File: gustaf/io/mfem.py:227-227
Timestamp: 2024-10-11T07:01:29.307Z
Learning: When no boundary conditions are provided in the `export` function of `gustaf/io/mfem.py`, add a comment to explain that a default boundary condition is being generated for all faces.

Applied to files:

  • tests/test_export.py
  • gustaf/io/mfem.py
📚 Learning: 2024-07-03T08:27:40.999Z
Learnt from: clemens-fricke
Repo: tataratat/gustaf PR: 214
File: examples/export_meshio.py:52-52
Timestamp: 2024-07-03T08:27:40.999Z
Learning: The `export` function in the `gus.io.meshio` module accepts arguments in the order `(export_path, mesh, submeshes=None, **kwargs)`.

Applied to files:

  • gustaf/io/mfem.py
🧬 Code graph analysis (3)
tests/test_export.py (5)
tests/conftest.py (3)
  • to_tmpf (340-345)
  • are_stripped_lines_same (245-336)
  • vertices (54-55)
gustaf/faces.py (3)
  • to_edges (302-317)
  • single_faces (282-296)
  • const_faces (229-240)
gustaf/edges.py (2)
  • single_edges (221-235)
  • const_edges (152-163)
gustaf/volumes.py (1)
  • to_faces (266-281)
gustaf/io/mfem.py (1)
  • export (126-159)
tests/conftest.py (2)
gustaf/faces.py (1)
  • Faces (72-338)
gustaf/volumes.py (1)
  • Volumes (75-281)
gustaf/io/mfem.py (5)
gustaf/io/meshio.py (1)
  • export (87-189)
gustaf/vertices.py (3)
  • vertices (127-139)
  • vertices (142-175)
  • whatami (229-241)
gustaf/edges.py (5)
  • elements (238-255)
  • elements (258-274)
  • whatami (166-177)
  • edges (111-123)
  • edges (126-149)
gustaf/faces.py (4)
  • whatami (141-152)
  • edges (124-138)
  • faces (183-195)
  • faces (198-226)
gustaf/volumes.py (1)
  • faces (118-136)
🪛 Ruff (0.14.4)
tests/conftest.py

246-246: Missing return type annotation for private function _are_stripped_lines_same

(ANN202)


246-246: Boolean default positional argument in function definition

(FBT002)


304-304: Do not catch blind exception: BaseException

(BLE001)


341-341: Missing return type annotation for private function _to_tmpf

(ANN202)

gustaf/io/mfem.py

162-162: Missing return type annotation for private function _export_2d

(ANN202)


220-220: Missing return type annotation for private function _export_3d

(ANN202)

🔇 Additional comments (23)
gustaf/create/faces.py (1)

127-129: Logging message clarity is fine.

Single literal keeps the debug message identical without changing behavior.

gustaf/utils/tictoc.py (1)

91-92: Cumulative formatting matches elapsed time.

Computing lap - start ensures the summary shows the expected relative values.

gustaf/_version.py (1)

6-6: Version constant updated appropriately.

The module version now matches the v0.1.2 release target.

.github/pull_request_template.md (1)

1-24: Template structure looks solid.

The added sections and checklist should help standardize incoming PRs.

pyproject.toml (2)

55-65: Dev extras update looks good.

Including pre-commit alongside the existing tooling keeps the developer environment complete.


85-87: Ruff configuration aligns with Python requirement.

Setting the target to py39 and excluding tests/data matches the declared requires-python >=3.9 and avoids lint noise from fixtures.

.pre-commit-config.yaml (2)

10-10: LGTM!

Setting autoupdate_branch to develop ensures that pre-commit.ci auto-updates target the correct branch for your workflow.


50-53: LGTM!

The blackdoc version bump from v0.4.1 to v0.4.5 is a routine maintenance update with no functional changes to the configuration.

.github/workflows/tests.yml (1)

14-14: LGTM!

Removing macos-13 from the matrix in favor of macos-latest is appropriate, as GitHub Actions is transitioning away from Intel-based macOS runners. The matrix still provides good coverage across Ubuntu, macOS, and Windows.

tests/data/mfem_hexahedra_3d.mesh (1)

1-29: LGTM!

The 3D hexahedral MFEM mesh file is correctly formatted with one hex element (geometry type 5), six boundary faces, and eight vertices forming a unit cube. The connectivity and vertex coordinates are consistent with MFEM v1.0 specifications.

tests/data/mfem_hexahedra_3d_222.mesh (1)

1-73: LGTM!

The 3D hexahedral mesh with 2×2×2 topology is correctly formatted. It contains 8 hex elements, 27 vertices (3×3×3 grid points), and 24 boundary entries representing the exterior faces. The vertex coordinates progress in 0.5 increments, forming a properly structured grid.

tests/data/mfem_quadrilaterals_2d.mesh (1)

1-23: LGTM!

The 2D quadrilateral MFEM mesh file is correctly formatted with one quad element (geometry type 3), four boundary edges, and four vertices forming a unit square. The format conforms to MFEM v1.0 specifications.

tests/data/mfem_tetrahedra_3d.mesh (1)

1-40: LGTM!

The 3D tetrahedral MFEM mesh file is correctly formatted with six tetrahedral elements (geometry type 4) decomposing a unit cube, twelve boundary triangular faces, and eight vertices. The mesh structure is valid for MFEM v1.0.

tests/test_vertices_and_element_updates.py (1)

16-16: Fixture migration verified successfully.

The new volumes_hexa_222 fixture is properly defined and the old volumes_hexa333 fixture has been completely removed with no remaining references. The change is correctly applied throughout the test suite.

tests/test_export.py (4)

1-15: LGTM!

The imports are appropriate, and the parametrization setup correctly maps test fixtures to their corresponding ground truth files.


28-42: LGTM!

The 2D boundary condition assignment logic is clear and correct. Using single_edges() to identify boundary edges and coordinate-based BC assignment is appropriate for testing.


43-58: LGTM!

The 3D boundary condition assignment correctly mirrors the 2D approach, using single_faces() to identify boundary faces and applying the same coordinate-based BC logic.


60-78: LGTM!

The export and comparison logic is well-structured. Using a temporary directory for isolation and comparing with ignore_order=True is appropriate for validating MFEM format exports.

gustaf/io/mfem.py (2)

110-123: LGTM!

The format_array utility function correctly formats NumPy arrays into space-separated, line-delimited strings suitable for the MFEM format.


126-159: LGTM!

The export function correctly dispatches to dimension-specific exporters and writes the MFEM v1.0 format with proper structure. The dimension detection and error handling for unsupported dimensions are appropriate.

tests/conftest.py (3)

39-50: LGTM!

The new 2D fixtures (vertices_2d, tri_connec_2d, faces_tri_2d, quad_connec_2d, faces_quad_2d) are correctly structured and consistent with their 3D counterparts. These fixtures appropriately support the MFEM 2D export tests.

Also applies to: 107-116, 124-126, 145-153, 161-163


198-241: LGTM!

The volumes_hexa_222 fixture correctly creates a 2×2×2 structured hexahedral mesh with 27 vertices and 8 elements. This provides a more complex test case for 3D export validation.


339-345: LGTM!

The to_tmpf fixture correctly generates a temporary file path within a given directory. The hardcoded filename is sufficient for test isolation.

Comment thread .pre-commit-config.yaml Outdated
@clemens-fricke clemens-fricke merged commit 3a2ad34 into main Nov 11, 2025
17 checks passed
@clemens-fricke clemens-fricke deleted the develop branch November 11, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants