Skip to content

Commit

Permalink
Clean up loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Pals committed Feb 12, 2020
1 parent dfdf56c commit 78dbe8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
38 changes: 11 additions & 27 deletions plugins/hdf/io/HdfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,41 +76,25 @@ point_count_t HdfReader::read(PointViewPtr view, point_count_t count)
PointId startId = view->size();
point_count_t remaining = m_hdf5Handler.getNumPoints() - m_index;
count = (std::min)(count, remaining);


PointId nextId = startId;
uint8_t *buf = nullptr;
// for(uint64_t pi = 0; pi < m_hdf5Handler.getNumPoints(); pi++) {
// int index = 0;
// for(auto info : m_infos) {
// // auto info = m_infos.at(0);
// int bufIndex = pi % m_hdf5Handler.getChunkSize();
// if(bufIndex == 0) {
// buf = m_hdf5Handler.getNextChunk(index);
// }
// uint8_t *p = buf + bufIndex*point_size;
// view->setField(info.id, info.pdal_type, nextId, (void*) p);
// index++;
// }
// nextId++;
// }
int index = 0;

for(auto& info : m_infos) {
m_bufs.push_back((uint8_t *)nullptr);
}
log()->get(LogLevel::Info) << "num infos: " << m_infos.size() << std::endl;
log()->get(LogLevel::Info) << "num points: " << m_hdf5Handler.getNumPoints() << std::endl;
for(auto info: m_infos) {
size_t point_size = info.size;
log()->get(LogLevel::Info) << "type info: " << pdal::Dimension::interpretationName(info.pdal_type) << std::endl;
nextId=0;
for(uint64_t pi = 0; pi < m_hdf5Handler.getNumPoints(); pi++) {

for(uint64_t pi = 0; pi < m_hdf5Handler.getNumPoints(); pi++) {
for(int index = 0; index < m_infos.size(); ++index) {
auto& info = m_infos.at(0);
int bufIndex = pi % info.chunkSize;
if(bufIndex == 0) {
buf = m_hdf5Handler.getNextChunk(index);
m_bufs.at(index) = m_hdf5Handler.getNextChunk(index);
}
uint8_t *p = buf + bufIndex*point_size;
uint8_t *p = m_bufs.at(index) + bufIndex*info.size;
view->setField(info.id, info.pdal_type, nextId, (void*) p);
nextId++;
}
index++;
nextId++;
}

return count;
Expand Down
1 change: 1 addition & 0 deletions plugins/hdf/io/HdfReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class PDAL_DLL HdfReader : public pdal::Reader
NL::json m_pathDimMap;
Dimension::IdList m_idlist;
std::vector<hdf5::DimInfo> m_infos;
std::vector<uint8_t *> m_bufs;

HdfReader& operator=(const HdfReader&); // Not implemented.
HdfReader(const HdfReader&); // Not implemented.
Expand Down

0 comments on commit 78dbe8e

Please sign in to comment.