Skip to content

Commit 999281b

Browse files
robertodrilfreddy
authored andcommitted
Fix erroneous loop construct in loadCavity
1 parent 32e1b8c commit 999281b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/cavity/ICavity.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ void ICavity::saveCavity(const std::string & fname) {
7575
cnpy::custom::npz_save(fname, "normals", elementNormal_);
7676
for (PCMSolverIndex i = 0; i < nElements_; ++i) {
7777
// Write vertices
78-
cnpy::custom::npz_save(fname, "vertices_" + std::to_string(i), elements_[i].vertices());
78+
cnpy::custom::npz_save(
79+
fname, "vertices_" + pcm::to_string(i), elements_[i].vertices());
7980
// Write arcs
80-
cnpy::custom::npz_save(fname, "arcs_" + std::to_string(i), elements_[i].arcs());
81+
cnpy::custom::npz_save(fname, "arcs_" + pcm::to_string(i), elements_[i].arcs());
8182
}
8283
}
8384

@@ -130,14 +131,13 @@ void ICavity::loadCavity(const std::string & fname) {
130131
Sphere sph(elementSphereCenter_.col(i), elementRadius_(i));
131132
Eigen::Matrix3Xd vertices, arcs;
132133
// 6. Get vertices and arcs
133-
for (PCMSolverIndex i = 0; i < nElements_; ++i) {
134-
cnpy::NpyArray raw_vertices = loaded_cavity["vertices_" + std::to_string(i)];
135-
vertices = cnpy::custom::npy_to_eigen<double>(raw_vertices);
136-
cnpy::NpyArray raw_arcs = loaded_cavity["arcs_" + std::to_string(i)];
137-
arcs = cnpy::custom::npy_to_eigen<double>(raw_arcs);
138-
}
134+
cnpy::NpyArray raw_vertices = loaded_cavity["vertices_" + pcm::to_string(i)];
135+
vertices = cnpy::custom::npy_to_eigen<double>(raw_vertices);
136+
cnpy::NpyArray raw_arcs = loaded_cavity["arcs_" + pcm::to_string(i)];
137+
arcs = cnpy::custom::npy_to_eigen<double>(raw_arcs);
139138
if (arcs.cols() != vertices.cols())
140-
PCMSOLVER_ERROR("Inconsistent number of vertices read from file for element " + to_string(i));
139+
PCMSOLVER_ERROR("Inconsistent number of vertices read from file for element " +
140+
pcm::to_string(i));
141141
int nv = vertices.cols();
142142
// Populate vertices and arcs
143143
elements_.push_back(Element(nv,

0 commit comments

Comments
 (0)