| 99 | |
| 100 | template<class SView, class RView> |
| 101 | ExecStatus |
| 102 | ElementDisjoint<SView,RView>::propagate(Space& home, const ModEventDelta&) { |
| 103 | int n = iv.size(); |
| 104 | |
| 105 | Region r; |
| 106 | |
| 107 | bool fix_flag = false; |
| 108 | do { |
| 109 | fix_flag = false; |
| 110 | // Compute union of all selected elements' lower bounds |
| 111 | GlbRanges<RView> x1lb(x1); |
| 112 | Iter::Ranges::ToValues<GlbRanges<RView> > vx1lb(x1lb); |
| 113 | GLBndSet unionOfSelected(home); |
| 114 | for(int i=0; vx1lb(); ++vx1lb) { |
| 115 | while (iv[i].idx < vx1lb.val()) i++; |
| 116 | GlbRanges<SView> clb(iv[i].view); |
| 117 | unionOfSelected.includeI(home,clb); |
| 118 | } |
| 119 | |
| 120 | { |
| 121 | LubRanges<RView> x1ub(x1); |
| 122 | Iter::Ranges::ToValues<LubRanges<RView> > vx1ub(x1ub); |
| 123 | int i=0; |
| 124 | int j=0; |
| 125 | // Cancel all elements that are no longer in the upper bound |
| 126 | while (vx1ub()) { |
| 127 | if (iv[i].idx < vx1ub.val()) { |
| 128 | iv[i].view.cancel(home,*this, PC_SET_ANY); |
| 129 | i++; |
| 130 | continue; |
| 131 | } |
| 132 | iv[j] = iv[i]; |
| 133 | ++vx1ub; |
| 134 | ++i; ++j; |
| 135 | } |
| 136 | |
| 137 | // cancel the variables with index greater than |
| 138 | // max of lub(x1) |
| 139 | for (int k=i; k<n; k++) { |
| 140 | iv[k].view.cancel(home,*this, PC_SET_ANY); |
| 141 | } |
| 142 | n = j; |
| 143 | iv.size(n); |
| 144 | } |
| 145 | |
| 146 | { |
| 147 | UnknownRanges<RView> x1u(x1); |
| 148 | Iter::Ranges::Cache x1uc(r,x1u); |
| 149 | Iter::Ranges::ToValues<Iter::Ranges::Cache> |
| 150 | vx1u(x1uc); |
| 151 | int i=0; |
| 152 | int j=0; |
| 153 | while (vx1u()) { |
| 154 | while (iv[i].idx < vx1u.val()) { |
| 155 | iv[j] = iv[i]; |
| 156 | i++; j++; |
| 157 | } |
| 158 | assert(iv[i].idx == vx1u.val()); |
nothing calls this directly
no test coverage detected