I am asking myself if there is any simple option for choosing the element type for the mesh generation WITHOUT explicitly creating coordinates and then the mesh.

Minimal example: here I would like to mesh to cuboid with hexahedral elements

DiscretizeRegion[Cuboid[{0, 0, 0}, {1, 1, 1}], MaxCellMeasure -> 1/4^3]

but, well, the output is a mesh with tetrahedral elements

Meshed cube

I have searched for an option within the commands but I have not been very succesful. Does anybody happend to know what option I have to use? Or do I really have to create the list of positions and then create the mesh? I know its not that hard, but before I begin doing that for complicated geometries I just wanted to asked. Thanks!

  • $\begingroup$ consider every single example in the docs is either 3d tets or 2d triangles... $\endgroup$ – george2079 Mar 13 '15 at 17:20

There is good news and bad news. So right now there is no option to make MeshRegion use Hex elements. However, you can use ElementMesh to do that:

em = ToElementMesh[Cuboid[{0, 0, 0}, {1, 1, 1}], 
  MaxCellMeasure -> 1/4^3]

(* ElementMesh[{{0., 1.}, {0., 1.}, {0., 1.}}, {HexahedronElement[
   "<" 64 ">"]}] *)

The bad news is that the conversion of the ElementMesh to a MeshRegion only works for first order element meshes.

 ToElementMesh[Cuboid[{0, 0, 0}, {1, 1, 1}], MaxCellMeasure -> 1/4^3, 
  "MeshOrder" -> 1]]

enter image description here

Which may be OK, since DiscretizeRegion gives a first order mesh anyways. I filed the not converting issue as a bug.

Hex elements only work for rectangular regions. In case you decide otherwise and want to tetrahedralize such a region you could specify the "MeshElementType" option to ToElementMesh.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.