@@ -73,10 +73,12 @@ void ICavity::saveCavity(const std::string & fname) {
73
73
cnpy::custom::npz_save (fname, " centers" , elementCenter_);
74
74
// Write normals
75
75
cnpy::custom::npz_save (fname, " normals" , elementNormal_);
76
- // Write vertices TODO!!!!
77
- // const unsigned int vertices_shape[] = {dim, 10, 3};
78
- // Write arcs TODO!!!!
79
- // const unsigned int arcs_shape[] = {dim, 10, 3};
76
+ for (PCMSolverIndex i = 0 ; i < nElements_; ++i) {
77
+ // Write vertices
78
+ cnpy::custom::npz_save (fname, " vertices_" + std::to_string (i), elements_[i].vertices ());
79
+ // Write arcs
80
+ cnpy::custom::npz_save (fname, " arcs_" + std::to_string (i), elements_[i].arcs ());
81
+ }
80
82
}
81
83
82
84
void ICavity::loadCavity (const std::string & fname) {
@@ -126,10 +128,17 @@ void ICavity::loadCavity(const std::string & fname) {
126
128
if (i < nIrrElements_)
127
129
irr = true ;
128
130
Sphere sph (elementSphereCenter_.col (i), elementRadius_ (i));
129
- int nv = 3 ; // BOGUS!!!
130
131
Eigen::Matrix3Xd vertices, arcs;
131
- vertices.resize (Eigen::NoChange, nv); // BOGUS!!!
132
- arcs.resize (Eigen::NoChange, nv); // BOGUS!!
132
+ // 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
+ }
139
+ if (arcs.cols () != vertices.cols ())
140
+ PCMSOLVER_ERROR (" Inconsistent number of vertices read from file for element " + to_string (i));
141
+ int nv = vertices.cols ();
133
142
// Populate vertices and arcs
134
143
elements_.push_back (Element (nv,
135
144
0 ,
0 commit comments