/** Constrain all the particles. */ void init_allParticlesConstrained() { indices.clear(); for(unsigned i = 0; i<numNodes; i++) indices.push_back(i); projection->f_indices.setValue(indices); /// Init sofa::simulation::getSimulation()->init(root.get()); }
/** Constrain one particle, and not the last one. Detects bugs like not setting the projection matrix entries beyond the last constrained particle */ void init_oneConstrainedParticle() { indices.clear(); indices.push_back(1); std::sort(indices.begin(),indices.end()); // checking vectors in linear time requires sorted indices projection->f_indices.setValue(indices); /// Init sofa::simulation::getSimulation()->init(root.get()); }