MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / setPoints

Method setPoints

src/model/TableMultiVariableLookup.cpp:822–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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());

Callers 1

TEST_FFunction · 0.45

Calls 3

clearExtensibleGroupsMethod · 0.80
sizeMethod · 0.45
xMethod · 0.45

Tested by 1

TEST_FFunction · 0.36