Skip to content

Commit

Permalink
pass npts to OneEdgeIndex for #103
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Sep 2, 2022
1 parent 1b5f16f commit b90dd1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dodgr
Title: Distances on Directed Graphs
Version: 0.2.15.007
Version: 0.2.15.008
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre")),
person("Andreas", "Petutschnig", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ATFutures/dodgr",
"issueTracker": "https://github.com/ATFutures/dodgr/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.2.15.007",
"version": "0.2.15.008",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
11 changes: 6 additions & 5 deletions src/match-points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct OneEdgeIndex : public RcppParallel::Worker
{
const RcppParallel::RVector <double> pt_x, pt_y,
xfr, yfr, xto, yto;
const size_t nxy;
const size_t nxy, npts;
RcppParallel::RVector <double> index;

// constructor
Expand All @@ -79,10 +79,11 @@ struct OneEdgeIndex : public RcppParallel::Worker
const RcppParallel::RVector <double> xto_in,
const RcppParallel::RVector <double> yto_in,
const size_t nxy_in,
const size_t npts_in,
Rcpp::NumericVector index_in) :
pt_x (pt_x_in), pt_y (pt_y_in),
xfr (xfr_in), yfr (yfr_in), xto (xto_in), yto (yto_in),
nxy (nxy_in), index (index_in)
nxy (nxy_in), npts (npts_in), index (index_in)
{
}

Expand Down Expand Up @@ -202,8 +203,8 @@ Rcpp::NumericVector rcpp_points_to_edges_par (const Rcpp::DataFrame &graph,
Rcpp::NumericVector xto = graph ["xto"];
Rcpp::NumericVector yto = graph ["yto"];

const size_t npts = static_cast <size_t> (pts.nrow ()),
nxy = static_cast <size_t> (graph.nrow ());
const size_t nxy = static_cast <size_t> (graph.nrow ()),
npts = static_cast <size_t> (pts.nrow ());

Rcpp::NumericVector index (npts);

Expand All @@ -214,7 +215,7 @@ Rcpp::NumericVector rcpp_points_to_edges_par (const Rcpp::DataFrame &graph,
RcppParallel::RVector <double> (yfr),
RcppParallel::RVector <double> (xto),
RcppParallel::RVector <double> (yto),
nxy, index);
nxy, npts, index);

RcppParallel::parallelFor (0, npts, one_edge_indx);

Expand Down

0 comments on commit b90dd1d

Please sign in to comment.