void shallowCopyDataBack(const std::vector<unsigned int> & stateful_prop_ids, MaterialProperties & data, MaterialProperties & data_from) { for (unsigned int i=0; i<stateful_prop_ids.size(); ++i) { PropertyValue * prop = data[i]; // do the look-up just once (OPT) PropertyValue * prop_from = data_from[stateful_prop_ids[i]]; // do the look-up just once (OPT) if (prop != NULL && prop_from != NULL) prop->swap(prop_from); } }
/** * Shallow copy the material properties * @param stateful_prop_ids List of IDs with properties to shallow copy * @param data Destination data * @param data_from Source data */ void shallowCopyData(const std::vector<unsigned int> & stateful_prop_ids, MaterialProperties & data, MaterialProperties & data_from) { for (unsigned int i = 0; i < stateful_prop_ids.size(); ++i) { if (i >= data_from.size() || stateful_prop_ids[i] >= data.size()) continue; PropertyValue * prop = data[stateful_prop_ids[i]]; // do the look-up just once (OPT) PropertyValue * prop_from = data_from[i]; // do the look-up just once (OPT) if (prop != nullptr && prop_from != nullptr) prop->swap(prop_from); } }