| 193 | |
| 194 | template<class View, class Offset, bool shared> |
| 195 | ExecStatus |
| 196 | Dom<View,Offset,shared>::propagate(Space& home, const ModEventDelta& med) { |
| 197 | // MSVC in non-permissive mode needs this, no idea why... |
| 198 | const int n = this->n; |
| 199 | Region r; |
| 200 | ProcessStack xa(r,n); |
| 201 | ProcessStack ya(r,n); |
| 202 | |
| 203 | DomInfo<View,Offset>* x = xy; |
| 204 | DomInfo<View,Offset>* y = xy+n; |
| 205 | |
| 206 | if (View::me(med) == ME_INT_VAL) { |
| 207 | // Scan x and y for assigned but not yet propagated views |
| 208 | for (int i=0; i<n; i++) { |
| 209 | if (x[i].doval()) xa.push(i); |
| 210 | if (y[i].doval()) ya.push(i); |
| 211 | } |
| 212 | |
| 213 | if (shared) { |
| 214 | do { |
| 215 | // Propagate assigned views for x |
| 216 | GECODE_ES_CHECK((prop_val<View,Offset,DomInfo<View,Offset> > |
| 217 | (home,n,x,ox,y,oy,n_na,xa,ya))); |
| 218 | // Propagate assigned views for y |
| 219 | GECODE_ES_CHECK((prop_val<View,Offset,DomInfo<View,Offset> > |
| 220 | (home,n,y,oy,x,ox,n_na,ya,xa))); |
| 221 | assert(ya.empty()); |
| 222 | } while (!xa.empty() || !ya.empty()); |
| 223 | return home.ES_NOFIX_PARTIAL(*this,View::med(ME_INT_DOM)); |
| 224 | } else { |
| 225 | do { |
| 226 | // Propagate assigned views for x |
| 227 | GECODE_ES_CHECK((prop_val<View,Offset,DomInfo<View,Offset> > |
| 228 | (home,n,x,ox,y,oy,n_na,xa,ya))); |
| 229 | // Propagate assigned views for y |
| 230 | GECODE_ES_CHECK((prop_val<View,Offset,DomInfo<View,Offset> > |
| 231 | (home,n,y,oy,x,ox,n_na,ya,xa))); |
| 232 | assert(ya.empty()); |
| 233 | } while (!xa.empty()); |
| 234 | return home.ES_FIX_PARTIAL(*this,View::med(ME_INT_DOM)); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // Process changed views for y |
| 239 | // This propagates from y to x and possibly records xs that |
| 240 | // got assigned |
| 241 | GECODE_ES_CHECK(prop_dom(home,n,y,oy,x,ox,xa)); |
| 242 | |
| 243 | // Process assigned views for x |
| 244 | GECODE_ES_CHECK((prop_val<View,Offset,DomInfo<View,Offset> > |
| 245 | (home,n,x,ox,y,oy,n_na,xa,ya))); |
| 246 | |
| 247 | // Perform domain consistent propagation for distinct on the x views |
| 248 | if (dc.available()) { |
| 249 | GECODE_ES_CHECK(dc.sync()); |
| 250 | } else { |
| 251 | ViewArray<View> xv(r,n); |
| 252 | for (int i=0; i<n; i++) |
nothing calls this directly
no test coverage detected