- # Check that both interfaces of create nonmatching meshes interpolation data returns the same
- fine_mesh_cell_map = mesh1.topology.index_map(mesh1.topology.dim)
- num_cells_on_proc = fine_mesh_cell_map.size_local + fine_mesh_cell_map.num_ghosts
- cells = np.arange(num_cells_on_proc, dtype=np.int32)
- interpolation_data = create_interpolation_data(V1, V0, cells, padding=padding)
- # Interpolate 3D->2D
- u1 = Function(V1, dtype=xtype)
- u1.interpolate_nonmatching(u0, cells, interpolation_data=interpolation_data)
- u1.x.scatter_forward()
- # Exact interpolation on 2D mesh
- u1_ex = Function(V1, dtype=xtype)
- u1_ex.interpolate(f)
- u1_ex.x.scatter_forward()
- assert np.allclose(
- u1_ex.x.array,
- u1.x.array,