This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

importing CGAL generated mesh in medit format

0 votes

Since FEniCS CGAL interface is quite limited, I'm trying to generate 3d mesh using CGAL and then export this file to FEniCS.

The code is like this:

  std::ofstream medit_file("out.mesh");
  CGAL::output_to_medit(medit_file, c3t3);

I'm trying to use dolfin-convert on this file:

dolfin-convert out.mesh out.xml

I get the following error:
Converting from Medit format (.mesh) to DOLFIN XML format
*** Unable to find cell type.

Is there any way to export mesh data from CGAL to FEniCS?

asked Aug 10, 2015 by begemotv2718 FEniCS Novice (380 points)

Did you find a solution to this problem? I think the .mesh format which dolfin-convert is expecting is from "triangle" not from "CGAL".

Did you find a solution to this problem? I think the .mesh format which dolfin-convert is expecting is from "triangle" not from "CGAL".

I think you can fix it by editing the .mesh file. You need to put the Dimension on a separate line:

e.g. instead of "Dimension 3" change to "Dimension" (newline) "3" (newline)

Also, you may have to delete any triangles in the output. This is all a bit annoying and is really a bug in dolfin-convert.

...