<commit_before># -*- coding: utf-8 -*-
#
from helpers import download_mesh, near_equal, run
import pytest
import voropy

import numpy


def test_regular_tri():
    points = numpy.array([
        [0.0, 0.0, 0.0],
        [1.0, 0.0, 0.0],
        [0.0, 1.0, 0.0]
        ])
    cells = numpy.array([[0, 1, 2]])
    mesh = voropy.mesh_tri.MeshTri(points, cells)

    tol = 1.0e-14

    # ce_ratios
    assert near_equal(mesh.get_ce_ratios().T, [0.0, 0.5, 0.5], tol)

    # control volumes
    assert near_equal(
        mesh.get_control_volumes(),
        [0.25, 0.125, 0.125],
        tol
        )

    # cell volumes
    assert near_equal(mesh.cell_volumes, [0.5], tol)

    # circumcenters
    assert near_equal(
        mesh.get_cell_circumcenters(),
        [0.5, 0.5, 0.0],
        tol
        )

    # centroids
    assert near_equal(mesh.get_control_volume_centroids(), [
            [0.25, 0.25, 0.0],
            [2.0/3.0, 1.0/6.0, 0.0],
            [1.0/6.0, 2.0/3.0, 0.0],
            ], tol)

    assert mesh.num_delaunay_violations() == 0

    return


def test_regular_tri_order():
    points = numpy.array([
        [0.0, 0.0, 0.0],
        [1.0, 0.0, 0.0],
        [0.0, 1.0, 0.0]
        ])
    cells = numpy.array([[1, 2, 0]])
    mesh = voropy.mesh_tri.MeshTri(points, cells.copy())
    assert all((mesh.cells['nodes'] == cells).flat)

    tol = 1.0e-14

    # ce_ratios
    assert near_equal(mesh.get_ce_ratios_per_edge().T, [0.5, 0.5, 0.0], tol)

    # control volumes
    assert near_equal(
        mesh.get_control_volumes(),
        [0.25, 0.125, 0.125],
        tol
        )

    # cell volumes
    assert near_equal(mesh.cell_volumes, [0.5], tol)

    # circumcenters
    assert near_equal(
        mesh.get_cell_circumcenters(),
        [0.5, 0.5, 0.0],
        tol
        )

    # centroids
    assert near_equal(mesh.get_control_volume_centroids(), [
            [0.25, 0.25, 0.0],
            [2.0/3.0, 1.0/6.0, 0.0],
            [1.0/6.0, 2.0/3.0, 0.0],
            ], tol)

    assert mesh.num_delaunay_violations() == 0
<commit_msg>fix test<commit_after># -*- coding: utf-8 -*-
#
from helpers import download_mesh, near_equal, run
import pytest
import voropy

import numpy


def test_regular_tri():
    points = numpy.array([
        [0.0, 0.0, 0.0],
        [1.0, 0.0, 0.0],
        [0.0, 1.0, 0.0]
        ])
    cells = numpy.array([[0, 1, 2]])
    mesh = voropy.mesh_tri.MeshTri(points, cells)

    tol = 1.0e-14

    # ce_ratios
    assert near_equal(mesh.get_ce_ratios().T, [0.0, 0.5, 0.5], tol)

    # control volumes
    assert near_equal(
        mesh.get_control_volumes(),
        [0.25, 0.125, 0.125],
        tol
        )

    # cell volumes
    assert near_equal(mesh.cell_volumes, [0.5], tol)

    # circumcenters
    assert near_equal(
        mesh.get_cell_circumcenters(),
        [0.5, 0.5, 0.0],
        tol
        )

    # centroids
    assert near_equal(mesh.get_control_volume_centroids(), [
            [0.25, 0.25, 0.0],
            [2.0/3.0, 1.0/6.0, 0.0],
            [1.0/6.0, 2.0/3.0, 0.0],
            ], tol)

    assert mesh.num_delaunay_violations() == 0

    return


def test_regular_tri_order():
    points = numpy.array([
        [0.0, 1.0, 0.0],
        [0.0, 0.0, 0.0],
        [1.0, 0.0, 0.0],
        ])
    cells = numpy.array([[0, 1, 2]])

    mesh = voropy.mesh_tri.MeshTri(points, cells)
    assert all((mesh.cells['nodes'] == [0, 1, 2]).flat)

    tol = 1.0e-14

    # ce_ratios
    assert near_equal(mesh.get_ce_ratios_per_edge().T, [0.5, 0.0, 0.5], tol)

    # control volumes
    assert near_equal(
        mesh.get_control_volumes(),
        [0.125, 0.25, 0.125],
        tol
        )

    # cell volumes
    assert near_equal(mesh.cell_volumes, [0.5], tol)

    # circumcenters
    assert near_equal(
        mesh.get_cell_circumcenters(),
        [0.5, 0.5, 0.0],
        tol
        )

    # centroids
    assert near_equal(mesh.get_control_volume_centroids(), [
            [1.0/6.0, 2.0/3.0, 0.0],
            [0.25, 0.25, 0.0],
            [2.0/3.0, 1.0/6.0, 0.0],
            ], tol)

    assert mesh.num_delaunay_violations() == 0

{'fraction_non_alphanumeric': 0.16335433834222007, 'fraction_numerical': 0.07779932137663596, 'mean_word_length': 1.815143246930423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3912776', 'n_tokens_mistral': 1828, 'n_tokens_neox': 1658, 'n_words': 313}