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

Method repeatExtensibleIndices

src/utilities/idf/IdfObject.cpp:1622–1661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1620 }
1621
1622 UnsignedVector IdfObject_Impl::repeatExtensibleIndices(const UnsignedVector& indices) const {
1623
1624 // assume indices is in order, and any extensible field indices are from the first
1625 // extensible group
1626 UnsignedVector result = indices;
1627
1628 // nothing to do if not extensible
1629 if (!m_iddObject.properties().extensible) {
1630 return result;
1631 }
1632
1633 // nothing to do if last index is not in extensible group
1634 if (!result.empty() && !m_iddObject.isExtensibleField(result.back())) {
1635 return result;
1636 }
1637
1638 // otherwise, find group indices of extensible field indices in result
1639 UnsignedVector groupIndices;
1640 for (unsigned index : result) {
1641 if (m_iddObject.isExtensibleField(index)) {
1642 groupIndices.push_back(m_iddObject.extensibleIndex(index).field);
1643 }
1644 }
1645
1646 unsigned n = m_fields.size();
1647 unsigned nn = m_iddObject.numFields();
1648 unsigned ne = m_iddObject.properties().numExtensible;
1649 unsigned groupIndex = 1;
1650 while (nn + groupIndex * ne < n) {
1651 for (unsigned gi : groupIndices) {
1652 unsigned index = nn + groupIndex * ne + gi;
1653 if (index < n) {
1654 result.push_back(index);
1655 }
1656 }
1657 ++groupIndex;
1658 }
1659
1660 return result;
1661 }
1662
1663 // QUERY HELPERS
1664

Callers

nothing calls this directly

Calls 6

isExtensibleFieldMethod · 0.80
extensibleIndexMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
numFieldsMethod · 0.45

Tested by

no test coverage detected