Speed up String2Vector.

PiperOrigin-RevId: 612767185
Change-Id: I4a4de5e03bbd6653be7ccb3e730ad64a335e17b0
This commit is contained in:
Kyle Bayes
2024-03-05 02:49:22 -08:00
committed by Copybara-Service
parent 9efa4ebe0b
commit 31384bdfeb
6 changed files with 132 additions and 111 deletions
+1 -1
View File
@@ -490,7 +490,7 @@ mjtByte mjm_setInStringVec(mjStringVec dest, int i, const char* text) {
// split text and copy into string array
void mjm_setStringVec(mjStringVec dest, const char* text) {
std::vector<std::string>* v = reinterpret_cast<std::vector<std::string>*>(dest);
mjXUtil::String2Vector(text, *v);
*v = mjXUtil::String2Vector<std::string>(text);
}
+4 -4
View File
@@ -420,9 +420,9 @@ bool mjCComposite::MakeParticle(mjCModel* model, mjmBody* body, char* error, int
}
}
mjXUtil::Vector2String(userface, face);
} else {
} else {
dim = 2; // can only load a surface for now
mjXUtil::String2Vector(userface, face);
face = mjXUtil::String2Vector<int>(userface);
for (int i=0; i<face.size(); face[i++]--) {};
mjXUtil::Vector2String(userface, face);
}
@@ -439,7 +439,7 @@ bool mjCComposite::MakeParticle(mjCModel* model, mjmBody* body, char* error, int
}
}
if (!userface.empty()) {
mjXUtil::String2Vector(userface, face);
face = mjXUtil::String2Vector<int>(userface);
for (int j=0; j<face.size()/3; j++) {
mjtNum area[3];
mjtNum edge1[3];
@@ -1306,7 +1306,7 @@ void mjCComposite::MakeSkin2(mjCModel* model, mjtNum inflate) {
// copy skin from existing mesh
if (type==mjCOMPTYPE_PARTICLE && username.empty()) {
std::vector<int> skinface;
mjXUtil::String2Vector(userface, skinface);
skinface = mjXUtil::String2Vector<int>(userface);
int nvert = uservert.size()/3;
for (int j=0; j<2; j++) {