Skip to content

Commit

Permalink
fix export_points
Browse files Browse the repository at this point in the history
  • Loading branch information
tf17270 committed May 9, 2024
1 parent d873543 commit 3680ce2
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions lyceanem/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ def export_points(self, point_index=None):
for item in range(len(self.points)):
if item == 0:
points = np.array(self.points[item].points)
points = np.append(points, self.points[item].points, axis=0)
point_data = np.array(len(self.points[0].point_data), points.shape[0])
else:
points = np.append(points, self.points[item].points, axis=0)
point_data = {}
for key in self.points[0].point_data.keys():
point_data[key] = np.array(points.shape[0])
pointssofar = 0
for item in range(len(self.points)):
point_data_element = np.array(self.point_data[item][key])
point_data[key][pointssofar:(pointssofar+point_data_element.shape[0])] = point_data_element
pointssofar+= point_data_element.shape[0]
combinded_points = meshio.Mesh(points, point_data=point_data)
for item in range(len(self.points)):
if item == 0:
point_data[key] = np.array(self.points[item].point_data[key])
else:
point_data_element = np.array(self.points[item].point_data[key])
point_data[key] = np.append(point_data[key], point_data_element, axis=0)

combinded_points = meshio.Mesh(points, cells = [], point_data=point_data)
combinded_points = GF.mesh_transform(combinded_points, self.pose, False)
return combinded_points

Expand All @@ -197,15 +199,16 @@ def export_points(self, point_index=None):
for item in point_index:
if item == 0:
points = np.array(self.points[item].points)
points = np.append(points, self.points[item].points, axis=0)
else:
points = np.append(points, self.points[item].points, axis=0)
point_data = {}
for key in self.points[0].point_data.keys():
point_data[key] = np.array(points.shape[0])
pointssofar = 0
for item in point_index:
point_data_element = np.array(self.point_data[item][key])
point_data[key][pointssofar:(pointssofar+point_data_element.shape[0])] = point_data_element
pointssofar+= point_data_element.shape[0]
for item in point_index:
if item == 0:
point_data[key] = np.array(self.points[item].point_data[key])
else:
point_data_element = np.array(self.points[item].point_data[key])
point_data[key] = np.append(point_data[key], point_data_element, axis=0)


combinded_points = meshio.Mesh(points, point_data=point_data)
Expand Down

0 comments on commit 3680ce2

Please sign in to comment.