MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/CompactNSearch / increase_point_set_size

Method increase_point_set_size

src/CompactNSearch.cpp:118–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116
117
118void
119NeighborhoodSearch::increase_point_set_size(unsigned int index, Real const* x, std::size_t size)
120{
121 PointSet& point_set = m_point_sets[index];
122 std::size_t old_size = point_set.n_points();
123
124 // Insert new entries.
125 for (unsigned int i = static_cast<unsigned int>(old_size); i < point_set.n_points(); i++)
126 {
127 HashKey key = cell_index(point_set.point(i));
128 point_set.m_keys[i] = point_set.m_old_keys[i] = key;
129 auto it = m_map.find(key);
130 if (it == m_map.end())
131 {
132 m_entries.push_back({{ index, i }});
133 m_map[key] = static_cast<unsigned int>(m_entries.size() - 1);
134 }
135 else
136 {
137 m_entries[it->second].add({ index, i });
138 }
139 }
140
141 point_set.resize(x, size);
142
143}
144
145void
146NeighborhoodSearch::find_neighbors()

Callers

nothing calls this directly

Calls 4

n_pointsMethod · 0.80
pointMethod · 0.80
addMethod · 0.80
resizeMethod · 0.80

Tested by

no test coverage detected