Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC 2023: Abhinav Jain Week 5 #314

Merged
merged 1 commit into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docqueries/withPoints/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SET(LOCAL_FILES
doc-pgr_withPointsCost
doc-pgr_withPointsDD
doc-pgr_withPointsKSP
doc-pgr_withPointsKSPv3.6
doc-pgr_withPoints
withPointsVia
)
Expand Down
7 changes: 1 addition & 6 deletions docqueries/withPoints/test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
'comment' => 'Function test for any versions.',
'data' => ['sampledata.data'],
'tests' => [qw(
doc-pgr_withPoints
doc-pgr_withPointsCost
doc-pgr_withPointsCostMatrix
doc-pgr_withPointsDD
doc-pgr_withPointsKSP
withPointsVia
doc-pgr_withPointsKSPv3.6
)],
'documentation' => [qw(
doc-pgr_withPoints
Expand Down
4 changes: 4 additions & 0 deletions include/cpp_common/basePath_SSEC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ class Path {
Path_rt **ret_path,
size_t &sequence, int routeId) const;

void get_pg_withPointsKSP_path(
Path_rt **ret_path,
size_t &sequence) const;

void get_pg_turn_restricted_path(
Path_rt **ret_path,
size_t &sequence, int routeId) const;
Expand Down
18 changes: 18 additions & 0 deletions src/common/basePath_SSEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,24 @@ void Path::get_pg_ksp_path(
}
}

/* used by withPointsKSP */
void Path::get_pg_withPointsKSP_path(
Path_rt **ret_path,
size_t &sequence) const {
for (unsigned int i = 0; i < path.size(); i++) {
(*ret_path)[sequence].seq = static_cast<int>(i + 1);
(*ret_path)[sequence].start_id = start_id();
(*ret_path)[sequence].end_id = end_id();
(*ret_path)[sequence].node = path[i].node;
(*ret_path)[sequence].edge = path[i].edge;
(*ret_path)[sequence].cost = path[i].cost;
(*ret_path)[sequence].agg_cost = (i == 0)?
0 :
(*ret_path)[sequence-1].agg_cost + path[i-1].cost;
sequence++;
}
}

/* used by turn restricted */
void Path::get_pg_turn_restricted_path(
Path_rt **ret_path,
Expand Down
5 changes: 2 additions & 3 deletions src/ksp/withPoints_ksp_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ pgr_do_withPointsKsp(
*return_tuples = pgr_alloc(count, (*return_tuples));

size_t sequence = 0;
int route_id = 0;
// int route_id = 0;
for (const auto &path : paths) {
if (path.size() > 0)
path.get_pg_ksp_path(return_tuples, sequence, route_id);
++route_id;
path.get_pg_withPointsKSP_path(return_tuples, sequence);
}

if (count != sequence) {
Expand Down