Creating quad mesh using RectangleMesh

It seems to me that the code that you posted is not completely working with 2019.1.0, and when I looked through the link it seems that you were able to work through it in 2017.2. With some changes to the code, which basically amount to addressing a couple of formatting issues, it at least adds the vertices and cells correctly but fails with an ordering issue, which again is weird because it was apparently resolved as reported here

Here is a MWE that works in 2019.1.0

  • For simplicity assume that v is an object with v.point being the node coordinate(s)
msh = Mesh() 
editr = MeshEditor()
editr.open(msh,'quadrilateral',2,2) 
editr.init_vertices(num_points)
editr.init_cells(num_cells)


for i,v in enumerate(nodes):
    editr.add_vertex(i,[*v.point])

for j,e in enumerate(verts_mio):
    # list_of_nodes = [int(i) for i in np.array(e.points,int)]
    print(e.astype(np.uintp))
    editr.add_cell(j,e.astype(np.uintp))

editr.close()

with XDMFFile(comm,'trial.xdmf') as f:
    f.write(msh)

however fails with the exception

*** Error:   Unable to order quadrilateral cell.
*** Reason:  Cell is not orderable.
*** Where:   This error was encountered inside QuadrilateralCell.cpp.