I have a mesh created in this way
omega = BoxMesh(-6, -4, -4, 6, 4, 4, 10, 10, 10)
and saved is this way
File('temp.xml') << omega
¿how to convert the 'temp.xml' file to gmsh format?
You will need to write a converter by yourself. You can check dolfin/site-packages/dolfin_utils/meshconvert/meshconvert.py for the way a reverse conversion is done. You can also commit your work there. Another way is to stick to io module framework.
dolfin/site-packages/dolfin_utils/meshconvert/meshconvert.py
io
Support for gmsh output will not be supported in DOLFIN.
If you want mesh output against a community standard/specification, use XDMF.
Hi, a simple solution would be to use Octave and the packages msh and fpl. You can do as follow: 1) save the mesh in the .xml file as you are doing in Dolfin 2) load the mesh in Octave using msh 3) save it in a format compatible with gmsh using fpl Quite long but you don't have to write code :-)
I am trying to implement what gedeone has mentioned above: This is a function that receives a mesh, sends it to gmesh, remeshes it, gets it back and returns the refined mesh. When I run this script, there is an error regarding octave library refers to:
oct_msh = octave.mshm_dolfin_read('f1.xml.gz')
Note: I have installed octave, gmsh, etc. other octave commans work but this one.
Moreover, how does the rest of the code look like?
def gmsh_refine(mesh): dolfin.File('f1.xml.gz') << mesh f2 = open('out.geo', 'wb') # writing geo file for gmesh f2.write(''' Mesh.CharacteristicLengthFactor=0.1; Mesh.Algorithm3D = 4; //Frontal (4) Delaunay(1) Mesh.RemeshAlgorithm=1; Merge "f2.stl"; Compound Surface(200)={1}; Surface Loop(300)={200}; Volume(301)={300}; Physical Surface (501)={200}; Physical Volume(502)={301}; ''') #reading in octave oct_msh = octave.mshm_dolfin_read('f1.xml.gz') #writing for gmsh octave.msh3m_gmsh_write('f2.stl', oct_msh) #remeshing os.system('gmsh f2.geo -3') #converting to xml os.system('dolfin-convert f2.msh f3.xml') #reading for dolfin return dolfin.Mesh('f3.xml')