Exemple #1
0
def test_volume_quadrilateral_coplanarity_check_2(scaling):

    with pytest.raises(RuntimeError) as error:
        # Unit square cell scaled down by 'scaling' and the first
        # vertex is distorted so that the vertices are clearly non
        # coplanar
        mesh = Mesh(
            MPI.comm_world, CellType.Type.quadrilateral,
            numpy.array([[1.0, 0.5, 0.6], [0.0, scaling, 0.0],
                         [0.0, 0.0, scaling], [0.0, 1.0, 1.0]],
                        dtype=numpy.float64),
            numpy.array([[0, 1, 2, 3]], dtype=numpy.int32), [],
            cpp.mesh.GhostMode.none)
        mesh.init()
        cell = Cell(mesh, 0)
        cell.volume()

    assert "are not coplanar" in str(error.value)
Exemple #2
0
def test_volume_quadrilateralR3(coordinates):

    mesh = Mesh(MPI.comm_world, CellType.Type.quadrilateral,
                numpy.array(coordinates, dtype=numpy.float64),
                numpy.array([[0, 1, 2, 3]], dtype=numpy.int32), [],
                cpp.mesh.GhostMode.none)

    mesh.init()
    cell = Cell(mesh, 0)

    assert cell.volume() == 1.0
Exemple #3
0
def test_volume_quadrilateralR2():

    mesh = UnitSquareMesh(MPI.comm_self, 1, 1, CellType.Type.quadrilateral)
    cell = Cell(mesh, 0)

    assert cell.volume() == 1.0