File: test_helpers.py

package info (click to toggle)
pygmsh 7.1.17-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 684 kB
  • sloc: python: 3,070; makefile: 164; sh: 7
file content (23 lines) | stat: -rw-r--r-- 555 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Tests module for helpers in tests."""
import numpy as np
from helpers import compute_volume

import pygmsh


def test():
    with pygmsh.geo.Geometry() as geom:
        geom.add_circle([0, 0, 0], 1, 0.1, make_surface=False)
        mesh = geom.generate_mesh()
    ref = 2 * np.pi
    assert np.abs(compute_volume(mesh) - ref) < 1e-2 * ref


def test_save_geo():
    with pygmsh.geo.Geometry() as geom:
        geom.add_circle([0, 0, 0], 1, 0.1, make_surface=False)
        geom.save_geometry("out.geo_unrolled")


if __name__ == "__main__":
    test()