Hi all, this is my first post and in fact my first week with fenicsx
I used meshio to transform an ABQ .inp file into a xdmf. To preserve nsets, elsets and surfaces, I used point_data and cell_data of the meshio.Mesh constructor. I read what meshio stored in cell_sets_dict and point_sets and ended up saving as point_data and cell_data arrays with 1 if the element or point belongs to the set or not. The fact is: in Paraview, I can open the xdmf and see the sets, both point and cell, with their names, and everything is correct.
As an example
point_data = {}
for set_name, indices in msh_inp.point_sets.items(): #e.g. 'pointset_1': np.array([pt_idx_1, pt_idx_2, ...]), these indices are global
mask = np.zeros(len(msh_inp.points), dtype=np.int32) #array with as many 0 as points in the mesh
mask[np.array(indices, dtype=int)] = 1 #set 1 in the positions determined by the indices
point_data[set_name] = mask
If this was not the canonical way, I am sorry and eager to hear how could this be done. The thing now is: how to save that information as tags when doing
with XDMFFile(comm, xdmf_file, "r") as xdmf:
mesh = xdmf.read_mesh(name="Grid")
Seems like the regular way of loading tags does not recognize the way I created the sets. Any help is useful!
Thanks!