review fixes

This commit is contained in:
Bharat Nallan Chakravarthy 2022-05-18 17:04:15 -07:00
parent c476b8dd92
commit 00d3bbc2e0
3 changed files with 12 additions and 13 deletions

View File

@ -79,10 +79,10 @@ public:
for (size_t row = 0; row < input_rows_count; ++row)
{
const UInt64 edge = data_hindex_edge[row];
std::vector<H3Index> res;
// resize to 2 as directedEdgeToCells func sets the origin and
// allocate array of size 2
// directedEdgeToCells func sets the origin and
// destination at [0] and [1] of the input vector
res.resize(2);
std::array<H3Index, 2> res;
directedEdgeToCells(edge, res.data());

View File

@ -85,8 +85,8 @@ public:
for (int vert = 0; vert < boundary.numVerts; ++vert)
{
latitude->insert(radsToDegs(boundary.verts[vert].lat));
longitude->insert(radsToDegs(boundary.verts[vert].lng));
latitude->getData().push_back(radsToDegs(boundary.verts[vert].lat));
longitude->getData().push_back(radsToDegs(boundary.verts[vert].lng));
}
current_offset += boundary.numVerts;

View File

@ -76,26 +76,25 @@ public:
result_offsets.resize(input_rows_count);
auto current_offset = 0;
std::vector<H3Index> res_vec;
result_data.reserve(input_rows_count);
for (size_t row = 0; row < input_rows_count; ++row)
{
// allocate array of size 6
// originToDirectedEdges places 6 edges into
// array that's passed to it
std::array<H3Index, 6> res;
const UInt64 edge = data_hindex_edge[row];
// originToDirectedEdges places only 6 edges into
// res_vec that's passed
res_vec.resize(6);
originToDirectedEdges(edge, res.data());
originToDirectedEdges(edge, res_vec.data());
for (auto & i : res_vec)
for (auto & i : res)
{
++current_offset;
result_data.emplace_back(i);
}
result_offsets[row] = current_offset;
res_vec.clear();
}
return ColumnArray::create(std::move(result_column_data), std::move(result_column_offsets));
}