Beispiel #1
0
test the class Domain
"""

import pytest
import pylbm

CASES = [
    {
        'box': {'x': [0, 1], 'label': 0},
        'space_step': 0.1,
        'schemes': [{'velocities': list(range(3))}],
    },
    {
        'box': {'x': [0, 2], 'y': [0, 1], 'label': 0},
        'elements': [
            pylbm.Ellipse((0.5, 0.5), (0.25, 0.25), (0.1, -0.1), label=1)
        ],
        'space_step': 0.05,
        'schemes':[{'velocities': list(range(13))}],
    },
    {
        'box': {'x': [0, 2], 'y': [0, 1], 'label': 0},
        'elements':[pylbm.Circle((0.5, 0.5), 0.2, label=1)],
        'space_step': 0.05,
        'schemes':[{'velocities': list(range(13))}],
    },
    {
        'box': {'x': [0, 1], 'y': [0, 1], 'label': [0, 1, 2, 3]},
        'space_step': 0.1,
        'schemes':[{'velocities': list(range(9))}],
    },
Beispiel #2
0
# Authors:
#     Loic Gouarin <*****@*****.**>
#     Benjamin Graille <*****@*****.**>
#
# License: BSD 3 clause
"""
pylbm: tests for the geometry
"""

import pytest
import pylbm

ELEMENTS = [
    [2, pylbm.Circle([0, 0], 1)],
    [2, pylbm.Ellipse([0, 0], [1, 0], [0, 1])],
    [2, pylbm.Triangle([-1, -1], [0, 2], [2, 0])],
    [2, pylbm.Parallelogram([-1, -1], [0, 2], [2, 0])],
    [3, pylbm.CylinderCircle([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.CylinderEllipse([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.CylinderTriangle([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.Parallelepiped([-1, -1, -1], [2, 0, 0], [0, 2, 0], [0, 0, 2])],
    [3, pylbm.Ellipsoid([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.Sphere([0, 0, 0], 1)],
]


@pytest.fixture(params=ELEMENTS,
                ids=[elem[1].__class__.__name__ for elem in ELEMENTS])
def get_element(request):
    """get one element of the geometry"""
    return request.param