def test_volume_quadrilateralR3(coordinates): mesh = Mesh(MPI.comm_world, CellType.quadrilateral, numpy.array(coordinates, dtype=numpy.float64), numpy.array([[0, 1, 2, 3]], dtype=numpy.int32), [], cpp.mesh.GhostMode.none) mesh.create_connectivity_all() assert cpp.mesh.volume_entities(mesh, [0], mesh.topology.dim) == 1.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.create_connectivity_all() cell = Cell(mesh, 0) assert cell.volume() == 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.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.create_connectivity_all() cpp.mesh.volume_entities(mesh, [0], mesh.topology.dim) assert "Not coplanar" in str(error.value)