MCPcopy Create free account
hub / github.com/PDAL/PDAL / run

Method run

filters/DividerFilter.cpp:177–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175
176
177PointViewSet DividerFilter::run(PointViewPtr inView)
178{
179 PointViewSet result;
180
181 if (m_args->m_sizeMode == SizeMode::Capacity)
182 m_args->m_size = ((inView->size() - 1) / m_args->m_size) + 1;
183
184 std::vector<PointViewPtr> views;
185
186 // If we are Partition or RoundRobin, we
187 // make views of m_args->m_size. If we are Expression mode,
188 // we will make new views once the expression passes the 'count'
189 // number of times
190 if (m_args->m_mode == Mode::Partition ||
191 m_args->m_mode == Mode::RoundRobin)
192 {
193 for (point_count_t i = 0; i < m_args->m_size; ++i)
194 {
195 PointViewPtr v(inView->makeNew());
196 views.push_back(v);
197 result.insert(v);
198 }
199 }
200
201 if (m_args->m_mode == Mode::Partition)
202 {
203 point_count_t limit = ((inView->size() - 1) / m_args->m_size) + 1;
204 unsigned viewNum = 0;
205 for (PointId i = 0; i < inView->size();)
206 {
207 views[viewNum]->appendPoint(*inView, i++);
208 if (i % limit == 0)
209 viewNum++;
210 }
211 }
212 else if (m_args->m_mode == Mode::RoundRobin)
213 {
214 unsigned viewNum = 0;
215 for (PointId i = 0; i < inView->size(); ++i)
216 {
217 views[viewNum]->appendPoint(*inView, i);
218 viewNum++;
219 if (viewNum == m_args->m_size)
220 viewNum = 0;
221 }
222 }
223 else if (m_args->m_mode == Mode::Expression)
224 {
225 // Go make our first view to insert points into. If none of the points
226 // pass the expression, all of the points will be in a single view
227
228 PointViewPtr firstView(inView->makeNew());
229 views.push_back(firstView);
230 result.insert(firstView);
231
232 unsigned viewNum (0);
233
234 for (PointRef point : *inView)

Callers

nothing calls this directly

Calls 5

appendPointMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45
evalMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected