MCPcopy Create free account
hub / github.com/Gecode/gecode / p_array_int_element2d

Function p_array_int_element2d

gecode/flatzinc/registry.cpp:735–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733 }
734 }
735 void p_array_int_element2d(FlatZincSpace& s, const ConExpr& ce,
736 AST::Node* ann) {
737 bool isConstant = true;
738 AST::Array* a = ce[2]->getArray();
739 for (int i=a->a.size(); i--;) {
740 if (!a->a[i]->isInt()) {
741 isConstant = false;
742 break;
743 }
744 }
745 IntVar selector0 = s.arg2IntVar(ce[0]);
746 IntVar selector1 = s.arg2IntVar(ce[1]);
747 IntSet idxset0 = s.arg2intset(ce[3]);
748 IntSet idxset1 = s.arg2intset(ce[4]);
749
750 int w = idxset1.size();
751 int s1off = idxset1.min();
752 int h = idxset0.size();
753 int s0off = idxset0.min();
754
755 if (isConstant) {
756 IntSharedArray sia = s.arg2intsharedarray(ce[2], 0);
757 element(s, sia, selector1, -s1off, w, selector0, -s0off, h, s.arg2IntVar(ce[5]), s.ann2ipl(ann));
758 } else {
759 IntVarArgs iv = s.arg2intvarargs(ce[2], 0);
760 element(s, iv, selector1, -s1off, w, selector0, -s0off, h, s.arg2IntVar(ce[5]), s.ann2ipl(ann));
761 }
762 }
763 void p_array_bool_element(FlatZincSpace& s, const ConExpr& ce,
764 AST::Node* ann) {
765 bool isConstant = true;

Callers

nothing calls this directly

Calls 10

getArrayMethod · 0.80
isIntMethod · 0.80
arg2IntVarMethod · 0.80
arg2intsetMethod · 0.80
arg2intsharedarrayMethod · 0.80
ann2iplMethod · 0.80
arg2intvarargsMethod · 0.80
elementFunction · 0.50
sizeMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected