File: test_dolfin_import.py

package info (click to toggle)
python-meshio 7.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,604 kB
  • sloc: python: 14,667; makefile: 23
file content (27 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from msh2xdmf import import_mesh
import os
import sys
sys.path.append('.')


def test_import():
    """
    Test the import from the xdmf file.
    """
    # Get the current directory
    current_dir = "{}/{}".format(os.getcwd(), "test/import")
    # Run the import
    mesh, boundaries, subdomains, labels = import_mesh(
        prefix="multidomain",
        dim=2,
        directory=current_dir,
        subdomains=True,
    )
    # Check if the labels are correct
    assert(labels["top_domain"] == 1)
    assert(labels["bot_domain"] == 2)
    assert(labels["middle"] == 3)
    assert(labels["right"] == 4)
    assert(labels["top"] == 5)
    assert(labels["bot"] == 6)
    assert(labels["left"] == 7)