It would be great if you could supply a minimal code example that shows the input ordering of your mesh (i.e. the cell topology) and how the resulting cell topology looks like in dolfin.
dolfin re-orders the mesh when it is read in (The reasons for this is explained in this preprint).
You can avoid reodering by explicitly using the mesh editor, see minimal example below:
from dolfin import *
import numpy as np
outfile = File("mesh.pvd")
points = np.array([[0,0],[1,0],[0,1], [1,1]])
cells = np.array([[0,1,2],[1,3,2]], dtype=np.int32)
def create_mesh(order):
# Initialize mesh and mesh editor for a 2D mesh of first order triangles
mesh = Mesh(MPI.comm_world)
editor = MeshEditor()
editor.open(mesh, "triangle", gdim=2, tdim=2, degree=1)
# Add vertices
editor.init_vertices(points.shape[0]);
for i, point in enumerate(points):
editor.add_vertex(i, point)
# Add cells
editor.init_cells(cells.shape[0]);
for i, cell in enumerate(cells):
editor.add_cell(i, cell)
# Finalize and possibly reorder mesh
editor.close(order=order)
# Print cell ordering
print("-"*5, "Order:{0:b}".format(order), "-"*5 )
print("Input")
print(cells)
print("In dolfin")
print(mesh.cells())
outfile << mesh
create_mesh(True)
create_mesh(False)
which generates the output:
----- Order:1 -----
Input
[[0 1 2]
[1 3 2]]
In dolfin
[[0 1 2]
[1 2 3]]
----- Order:0 -----
Input
[[0 1 2]
[1 3 2]]
In dolfin
[[0 1 2]
[1 3 2]]