9 #ifndef IMPDOMINO_SUBSET_H
10 #define IMPDOMINO_SUBSET_H
12 #include <IMP/domino/domino_config.h>
21 IMPDOMINO_BEGIN_NAMESPACE
37 static const ParticlesTemp &get_sorted(ParticlesTemp &ps) {
38 std::sort(ps.begin(), ps.end());
44 Subset(
const ParticlesTemp &ps,
bool):
45 P(ps.begin(), ps.end()) {
47 for (
unsigned int i=0; i< size(); ++i) {
50 for (
unsigned int i=1; i< ps.size(); ++i) {
59 explicit Subset(ParticlesTemp ps):
P(get_sorted(ps)) {
62 std::sort(ps.begin(), ps.end());
64 "Duplicate particles in set");
65 for (
unsigned int i=0; i< ps.size(); ++i) {
70 Model *get_model()
const {
71 return operator[](0)->get_model();
73 std::string get_name()
const;
74 bool get_contains(
const Subset &o)
const {
75 return std::includes(begin(), end(), o.begin(), o.end());
85 set_union(a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(pt));
92 set_intersection(a.begin(), a.end(), b.begin(), b.end(),
93 std::back_inserter(pt));
97 return Subset(pt,
true);
102 inline Subset get_difference(
const Subset &a,
const Subset &b) {
104 std::set_difference(a.begin(), a.end(),
106 std::back_inserter(rs));
107 Subset ret(rs,
true);
111 IMPDOMINO_END_NAMESPACE