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

Function p_array_bool_element2d

gecode/flatzinc/registry.cpp:804–831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802 }
803 }
804 void p_array_bool_element2d(FlatZincSpace& s, const ConExpr& ce,
805 AST::Node* ann) {
806 bool isConstant = true;
807 AST::Array* a = ce[2]->getArray();
808 for (int i=a->a.size(); i--;) {
809 if (!a->a[i]->isBool()) {
810 isConstant = false;
811 break;
812 }
813 }
814 IntVar selector0 = s.arg2IntVar(ce[0]);
815 IntVar selector1 = s.arg2IntVar(ce[1]);
816 IntSet idxset0 = s.arg2intset(ce[3]);
817 IntSet idxset1 = s.arg2intset(ce[4]);
818
819 int w = idxset1.size();
820 int s1off = idxset1.min();
821 int h = idxset0.size();
822 int s0off = idxset0.min();
823
824 if (isConstant) {
825 IntSharedArray sia = s.arg2boolsharedarray(ce[2], 0);
826 element(s, sia, selector1, -s1off, w, selector0, -s0off, h, s.arg2BoolVar(ce[5]), s.ann2ipl(ann));
827 } else {
828 BoolVarArgs iv = s.arg2boolvarargs(ce[2], 0);
829 element(s, iv, selector1, -s1off, w, selector0, -s0off, h, s.arg2BoolVar(ce[5]), s.ann2ipl(ann));
830 }
831 }
832
833 /* coercion constraints */
834 void p_bool2int(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) {

Callers

nothing calls this directly

Calls 11

getArrayMethod · 0.80
isBoolMethod · 0.80
arg2IntVarMethod · 0.80
arg2intsetMethod · 0.80
arg2boolsharedarrayMethod · 0.80
arg2BoolVarMethod · 0.80
ann2iplMethod · 0.80
arg2boolvarargsMethod · 0.80
elementFunction · 0.50
sizeMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected