Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhang95 committed Oct 10, 2024
1 parent 1f1e308 commit 9b40a90
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions projects/CuLagrange/geometry/file_parser/read_vtk_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,15 @@ namespace zeno {
std::vector<zeno::vec3f> read_attr_vec3f(std::ifstream &file, int num_points, bool type_float) {
std::vector<zeno::vec3f> res(num_points);
if (type_float) {
float* data = new float[num_points * 3];
file.read((char*)data, sizeof (float) * num_points * 3);
std::vector<float> data(num_points * 3);
file.read((char*)data.data(), sizeof (float) * num_points * 3);
for (auto i = 0; i < num_points * 3; i++) {
reinterpret_cast<float *>(res.data())[i] = byteswap(data[i]);
}
}
else {
double* data = new double[num_points * 3];
file.read((char*)data, sizeof (double) * num_points * 3);
std::vector<double> data(num_points * 3);
file.read((char*)data.data(), sizeof (double) * num_points * 3);
for (auto i = 0; i < num_points * 3; i++) {
reinterpret_cast<float *>(res.data())[i] = byteswap(data[i]);
}
Expand All @@ -472,15 +472,15 @@ namespace zeno {
std::vector<float> read_attr_float(std::ifstream &file, int num_points, bool type_float) {
std::vector<float> res(num_points);
if (type_float) {
float* data = new float[num_points];
file.read((char*)data, sizeof (float) * num_points);
std::vector<float> data(num_points);
file.read((char*)data.data(), sizeof (float) * num_points);
for (auto i = 0; i < num_points; i++) {
reinterpret_cast<float *>(res.data())[i] = byteswap(data[i]);
}
}
else {
double* data = new double[num_points];
file.read((char*)data, sizeof (double) * num_points);
std::vector<double> data(num_points);
file.read((char*)data.data(), sizeof (double) * num_points);
for (auto i = 0; i < num_points; i++) {
reinterpret_cast<float *>(res.data())[i] = byteswap(data[i]);
}
Expand Down

0 comments on commit 9b40a90

Please sign in to comment.