Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions python/test/unit/mesh/test_create_mixed_mesh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from mpi4py import MPI

import numpy as np
import pytest

from dolfinx.cpp.mesh import (
GhostMode,
Expand All @@ -10,7 +11,8 @@
from dolfinx.mesh import CellType, create_cell_partitioner


def test_create_mixed_mesh():
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
def test_create_mixed_mesh(dtype):
nx = 7
ny = 11
nz = 8
Expand Down Expand Up @@ -71,14 +73,14 @@ def test_create_mixed_mesh():

if MPI.COMM_WORLD.rank == 0:
cells_np = [np.array(c, dtype=np.int64) for c in cells]
geomx = np.array(geom, dtype=np.float64)
geomx = np.array(geom, dtype=dtype)
else:
cells_np = [np.zeros(0, dtype=np.int64) for c in cells]
geomx = np.zeros((0, 3), dtype=np.float64)
geomx = np.zeros((0, 3), dtype=dtype)

hexahedron = coordinate_element(CellType.hexahedron, 1)
pyramid = coordinate_element(CellType.pyramid, 1, variant=1)
tetrahedron = coordinate_element(CellType.tetrahedron, 1)
hexahedron = coordinate_element(CellType.hexahedron, 1, dtype=dtype)
pyramid = coordinate_element(CellType.pyramid, 1, variant=1, dtype=dtype)
tetrahedron = coordinate_element(CellType.tetrahedron, 1, dtype=dtype)

part = create_cell_partitioner(GhostMode.none, 2)
max_cells_per_facet = 2
Expand Down
9 changes: 5 additions & 4 deletions python/test/unit/mesh/test_mixed_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from dolfinx.mesh import CellType, GhostMode, Mesh, Topology, create_unit_cube


def test_mixed_topology_mesh():
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
def test_mixed_topology_mesh(dtype):
set_log_level(LogLevel.INFO)

cells = [[0, 1, 2, 1, 2, 3], [2, 3, 4, 5]]
Expand Down Expand Up @@ -79,11 +80,11 @@ def test_mixed_topology_mesh():
assert topology.connectivity((2, 1), (0, 0)).num_nodes == 1

# Create dofmaps for Geometry
tri = coordinate_element(CellType.triangle, 1)
quad = coordinate_element(CellType.quadrilateral, 1)
tri = coordinate_element(CellType.triangle, 1, dtype=dtype)
quad = coordinate_element(CellType.quadrilateral, 1, dtype=dtype)
nodes = np.array([0, 1, 2, 3, 4, 5], dtype=np.int64)
xdofs = np.array([0, 1, 2, 1, 2, 3, 2, 3, 4, 5], dtype=np.int64)
x = np.array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 1.0, 2.0, 0.0], dtype=np.float64)
x = np.array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 1.0, 2.0, 0.0], dtype=dtype)
geom = create_geometry(
topology._cpp_object, [tri._cpp_object, quad._cpp_object], nodes, xdofs, x, 2
)
Expand Down
Loading