void ModelObject::validate_outputs() const { if (!get_has_dependencies()) return; IMP_IF_CHECK(USAGE_AND_INTERNAL) { IMP_CHECK_OBJECT(this); ModelObjectsTemp ret = do_get_outputs(); std::sort(ret.begin(), ret.end()); ret.erase(std::unique(ret.begin(), ret.end()), ret.end()); ModelObjectsTemp saved = get_model()->get_dependency_graph_outputs(this); std::sort(saved.begin(), saved.end()); ModelObjectsTemp intersection; std::set_intersection(saved.begin(), saved.end(), ret.begin(), ret.end(), std::back_inserter(intersection)); IMP_USAGE_CHECK( intersection.size() == ret.size(), "Dependencies changed without invalidating dependencies." << " Make sure you call set_has_dependencies(false) any " << "time the list of dependencies changed. Object is " << get_name() << " of type " << get_type_name()); } }
ModelObjectsTemp HelixRestraint::do_get_inputs() const { ModelObjectsTemp ps; Model *m = get_model(); for (IMP::Vector<IMP::PointerMember< core::MultipleBinormalRestraint> >::const_iterator td = dihedral_rs_.begin(); td != dihedral_rs_.end(); ++td){ ModelObjectsTemp bps = (*td)->get_inputs(); ps.insert(ps.end(), bps.begin(), bps.end()); } for (ParticleIndexPairs::const_iterator tb = bonds_ON_.begin(); tb != bonds_ON_.end(); ++tb) { ps.push_back(m->get_particle((*tb)[0])); ps.push_back(m->get_particle((*tb)[1])); } return ps; }