Hello everyone! I just started using dolfinx recently, so I apologize in advance if the question turns out to be silly!
I am using dolfinx version 0.5.2 and am creating a mesh from a list of points and a cell list specifying the connection between the points.
I need the order of dofs (necessarily for a Function Space of type CG1) of the created mesh to match with the order of the specified points.
Taking the simple test as an example (from Create mesh in fenicsx from point and element array):
import dolfinx
import ufl
from mpi4py import MPI
import numpy as np
import matplotlib.pyplot as plt
pp = np.array([[0.5, 1], [2, 1], [3, 1.5], [3.5, 2.5], [2.2, 2], [1, 2.2]])
ee = np.array([[0, 1, 5], [1, 4, 5], [1, 2, 4], [2, 3, 4]])
plt.triplot(pp[:, 0], pp[:, 1], ee)
plt.show()
gdim = 2
shape = “triangle”
degree = 1
cell = ufl.Cell(shape, geometric_dimension=gdim)
domain = ufl.Mesh(ufl.VectorElement(“Lagrange”, cell, degree))
cells = np.array(ee, dtype=np.int32)
mesh = dolfinx.mesh.create_mesh(MPI.COMM_WORLD, cells, pp, domain)
V = dolfinx.fem.FunctionSpace(mesh, (“CG”, 1))
dofs = V.tabulate_dof_coordinates()[:, 0:2]
for ii in range(pp.shape[0]):
print(f “pp[{ii}, :] = {pp[ii, :]}\t\tdofs[{ii}, :] = {dofs[ii, :]}”
f “mesh.geometry.x[{ii}, :] = {mesh.geometry.x[ii, :]}”)
The sorting of dofs results differently than the sorting of pp points.
Could someone help me with this? Thanks in advance!