| 820 | } |
| 821 | |
| 822 | bool TableMultiVariableLookup_Impl::setPoints(const std::vector<TableMultiVariableLookupPoint>& points) { |
| 823 | // We first check that ALL points have the right number of independent variables, before we do anything destructive such as clearing the points |
| 824 | int n_independent = numberofIndependentVariables(); |
| 825 | for (const TableMultiVariableLookupPoint& pt : points) { |
| 826 | if (pt.x().size() != (unsigned)n_independent) { |
| 827 | LOG(Warn, |
| 828 | "Cannot set points because all points must have exactly " << n_independent << " independent variable(s), for " << briefDescription()); |
| 829 | return false; |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | // Ok, now we clear |
| 834 | this->clearExtensibleGroups(); |
| 835 | |
| 836 | // And we add all points |
| 837 | bool result = true; |
| 838 | for (const TableMultiVariableLookupPoint& pt : points) { |
| 839 | result &= addPoint(pt); |
| 840 | } |
| 841 | |
| 842 | return result; |
| 843 | } |
| 844 | |
| 845 | bool TableMultiVariableLookup_Impl::addPoint(const TableMultiVariableLookupPoint& point) { |
| 846 | return addPoint(point.x(), point.y()); |