| 98 | } |
| 99 | |
| 100 | bool domainReductionTest(BSpline &bs, const BSpline &bs_orig) |
| 101 | { |
| 102 | if (bs.getNumVariables() != 2 || bs_orig.getNumVariables() != 2) |
| 103 | return false; |
| 104 | |
| 105 | // Check for error |
| 106 | if (!compareBSplines(bs, bs_orig)) |
| 107 | return false; |
| 108 | |
| 109 | auto lb = bs.getDomainLowerBound(); |
| 110 | auto ub = bs.getDomainUpperBound(); |
| 111 | |
| 112 | bool flag = false; |
| 113 | unsigned int index = 0; |
| 114 | for (; index < lb.size(); index++) |
| 115 | { |
| 116 | if (ub.at(index)-lb.at(index) > 1e-1) |
| 117 | { |
| 118 | flag = true; |
| 119 | break; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | if (flag) |
| 124 | { |
| 125 | auto split = (ub.at(index) + lb.at(index))/2; |
| 126 | |
| 127 | auto lb2 = lb; |
| 128 | auto ub2 = ub; ub2.at(index) = split; |
| 129 | BSpline bs2(bs); |
| 130 | bs2.reduceSupport(lb2, ub2); |
| 131 | |
| 132 | auto lb3 = lb; lb3.at(index) = split; |
| 133 | auto ub3 = ub; |
| 134 | BSpline bs3(bs); |
| 135 | bs3.reduceSupport(lb3, ub3); |
| 136 | |
| 137 | return (domainReductionTest(bs2, bs_orig) && domainReductionTest(bs3, bs_orig)); |
| 138 | } |
| 139 | |
| 140 | return true; |
| 141 | } |
| 142 | |
| 143 | bool runRecursiveDomainReductionTest() |
| 144 | { |
no test coverage detected