@@ -527,35 +527,28 @@ def write(filename, mesh, float_fmt=".16e", binary=False):
527
527
# rest is actual cell data.
528
528
tag_data = {}
529
529
other_data = {}
530
- for cell_type , a in mesh .cell_data .items ():
531
- tag_data [cell_type ] = {}
532
- other_data [cell_type ] = {}
533
- for key , data in a .items ():
534
- if key in ["gmsh:physical" , "gmsh:geometrical" ]:
535
- tag_data [cell_type ][key ] = data .astype (numpy .int32 )
536
- else :
537
- other_data [cell_type ][key ] = data
538
-
539
- # We identity which dimension are we
530
+ for key , data in mesh .cell_data .items ():
531
+ if key in ["gmsh:physical" , "gmsh:geometrical" ]:
532
+ tag_data [key ] = [entry .astype (numpy .int32 ) for entry in data ]
533
+ else :
534
+ other_data [key ] = data
535
+
536
+ # identity dimension
540
537
dimension = 2
541
538
for c in cells :
542
539
name_elem = _meshio_to_mdpa_type [c .type ]
543
540
if local_dimension_types [name_elem ] == 3 :
544
541
dimension = 3
545
542
break
546
543
547
- # We identify the entities
544
+ # identify entities
548
545
_write_nodes (fh , mesh .points , float_fmt , binary )
549
546
_write_elements_and_conditions (fh , cells , tag_data , binary , dimension )
550
547
for name , dat in mesh .point_data .items ():
551
548
_write_data (fh , "NodalData" , name , dat , binary )
552
549
cell_data_raw = raw_from_cell_data (other_data )
553
- for (
554
- name ,
555
- dat ,
556
- ) in (
557
- cell_data_raw .items ()
558
- ): # NOTE: We will assume always when writing that the components are elements (for now)
550
+ for name , dat in cell_data_raw .items ():
551
+ # assume always that the components are elements (for now)
559
552
_write_data (fh , "ElementalData" , name , dat , binary )
560
553
561
554
0 commit comments