I’m having trouble determining if I’ve completed all the necessary steps for importing a .xml mesh into fenics.
I have a .xml mesh. I am importing it using this code:
from dolfin import * mesh = Mesh('mesh.xml')
Simple enough. However, I started poking around and called the num_edges() and num_faces() methods which returned zero. This did not seem correct. I now know that I need to initialize entities of a certain dimension with the init() method. Here is me doing that.
# Printing values before calling init print('Edges = %d'%mesh.num_edges()) # returns 0 print('Faces = %d'%mesh.num_faces()) # returns 0 mesh.init(1) mesh.init(2) # Printing values after calling init print('Edges = %d'%mesh.num_edges()) # returns correct, non-zero value print('Faces = %d'%mesh.num_faces()) # returns correct, non-zero value
My question is: am I through importing the .xml mesh after i’ve initialized those entities? Should it be ready to use in fenics at this point?
Thanks in advance for any feedback.