# Unable to order quadrilateral cell

**URL:** <https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396>\
**Category:** mesh\
**Created:** [August 25, 2019, 6:59pm UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396 "2019-08-25T18:59:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [August 25, 2019, 6:59pm UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/1 "2019-08-25T18:59:34Z")

</div>

Is the reordering check for `quad` elements completed in `dolfin - 2019.1.0`? The corresponding [issue](https://bitbucket.org/fenics-project/dolfin/issues?title=Quad%2Fhex+meshes+need+ordering+check) is marked as `resolved`. However I seem to get an error trying to import `quad` meshes (and even when trying to manually create one using `MeshEditor`). It is also reported [here](https://bitbucket.org/fenics-project/dolfin/issues?title=Quad%2Fhex+meshes+need+ordering+check)  
MWE:

```auto
from dolfin import *
msh = Mesh()
f = XDMFFile(MPI.comm_world,'test_quadMesh.xdmf')
f.read(msh)

```

Attached is a picture of the sample mesh, if needed.

 ![trialMesh](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/1X/891b517d60f831f50339f3c33731a7ea00c7f099.png)

---

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [August 26, 2019, 3:13am UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/2 "2019-08-26T03:13:22Z")

</div>

Manually creating the mesh using `MeshEditor`:

```auto
nodes, cells = return_points_cells(abaqus_fname)
num_nodes = nodes.shape[0]
num_elems = cells.shape[0]

msh = Mesh()
e = MeshEditor()
e.open(msh,'quadrilateral',2,2)
e.init_vertices(num_nodes)
e.init_cells(num_elems)

for i, nval in enumerate(nodes):
    e.add_vertex(i,nval)

for elem in cells:
    e.add_cell(elem[0],np.array([elem[1], elem[2], elem[4], elem[3]],int))

e.close(order=False)

with XDMFFile(comm,'trialMesh.xdmf') as wf:
    wf.write(msh)

```

results in the following mesh:

 ![trialMeshdolfin](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/1X/be04b0ca0cdc8b6f3c8e4b0ee47eecd40e7556ff.png)

It does not read the complete mesh, however, at least does better than throwing a `ordering` exception.

---

<div class="post-metadata">

**Author:** ![RemDelaporteMathurin](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/remdelaportemathurin/32/4543_2.png) [@RemDelaporteMathurin](https://fenicsproject.discourse.group/u/RemDelaporteMathurin)\
**Post date:** [November 18, 2019, 12:22pm UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/3 "2019-11-18T12:22:28Z")

</div>

Hi ! I ran into this as well ! Have you managed to solve that issue ?

Thanks

---

<div class="post-metadata">

**Author:** ![bleyerj](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bleyerj/32/6020_2.png) [@bleyerj](https://fenicsproject.discourse.group/u/bleyerj)\
**Post date:** [November 18, 2019, 11:02pm UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/4 "2019-11-18T23:02:41Z")

</div>

Hi, I think this will be (or is already) fixed in the `dolfinx` version.

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [November 19, 2019, 8:04am UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/5 "2019-11-19T08:04:38Z")

</div>

There is a lot of work going on in dolfinx in quads/hexes. The idea there is to permutation the dofmap instead of ordering the mesh. I think that the permuting of quad dog maps will appear in a PR in dolfinx later this week and be merged early next week.

---

<div class="post-metadata">

**Author:** ![RemDelaporteMathurin](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/remdelaportemathurin/32/4543_2.png) [@RemDelaporteMathurin](https://fenicsproject.discourse.group/u/RemDelaporteMathurin)\
**Post date:** [November 19, 2019, 12:13pm UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/6 "2019-11-19T12:13:02Z")

</div>

So this won’t be fixed in the current FEniCS ?

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [November 19, 2019, 12:14pm UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/7 "2019-11-19T12:14:20Z")

</div>

I can’t guarantee that it will. Most development of the FEniCS source code is happening in dolfinx (which hopefully will have a stable release during the first quarter of next year).

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [November 19, 2019, 3:43pm UTC](https://fenicsproject.discourse.group/t/unable-to-order-quadrilateral-cell/1396/8 "2019-11-19T15:43:39Z")

</div>

Pull request for dolfinx is now submitted: [https://github.com/FEniCS/dolfinx/pull/654](https://github.com/FEniCS/dolfinx/pull/654)  
Some minor things has to be fixed before its merged, and alleviates the ordering issue for quads and hexes for scalar function-spaces. The next step is to work on permutations of vector spaces instead of ordering the mesh. I guess @mscroggs can give more details
