void ModelComponent::addGeometry(OpenSim::Geometry& geom) { extendAddGeometry(geom); // Check that name exists and is unique as it's used to form PathName if (geom.getName().empty()){ bool nameFound = false; int index = 1; while (!nameFound){ std::stringstream ss; // generate candiate name ss << getName() << "_geom_" << index; std::string candidate = ss.str(); bool exists = false; for (int idx = 0; idx < getProperty_geometry().size() && !exists; idx++){ if (get_geometry(idx).getName() == candidate){ exists = true; break; } } if (!exists){ nameFound = true; geom.setName(candidate); } else index++; } } append_geometry(geom); return; }
void ModelComponent::extendFinalizeFromProperties() { Super::extendFinalizeFromProperties(); int geomSize = getProperty_geometry().size(); if (geomSize > 0){ for (int i = 0; i < geomSize; ++i){ addComponent(&upd_geometry(i)); } } }
const Property<std::string>& HuntCrossleyForce::ContactParameters::getGeometry() const { return getProperty_geometry(); }
const Property<std::string>& ElasticFoundationForce::ContactParameters::getGeometry() const { return getProperty_geometry(); }