Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2027

Merged
merged 1 commit into from
Oct 10, 2024
Merged

fix #2027

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading