WSL/SLF GitLab Repository
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SnowQM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
snow-hydrology
SnowQM
Commits
1a0302e9
Commit
1a0302e9
authored
Feb 9, 2022
by
Adrien Michel
Browse files
Options
Downloads
Patches
Plain Diff
Code cleaning
parent
2e55df38
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/snow_days_comparison.cpp
+0
-13
0 additions, 13 deletions
src/snow_days_comparison.cpp
src/snow_season_length.cpp
+0
-9
0 additions, 9 deletions
src/snow_season_length.cpp
with
0 additions
and
22 deletions
src/snow_days_comparison.cpp
+
0
−
13
View file @
1a0302e9
...
...
@@ -54,17 +54,13 @@ Rcpp::List snowDaysComparisonCpp(const NumericMatrix data_1,
bool
interrupt
=
false
;
// Convert R object to proper c++ object since R objects are not thread safe
std
::
clock_t
start
;
start
=
std
::
clock
();
const
size_t
num_pixels
=
data_1
.
nrow
();
const
size_t
num_years
=
indices
.
size
();
std
::
vector
<
std
::
vector
<
size_t
>
>
indices_cpp
(
num_years
);
for
(
size_t
i
=
0
;
i
<
num_years
;
++
i
)
{
indices_cpp
[
i
]
=
Rcpp
::
as
<
std
::
vector
<
size_t
>
>
(
indices
[
i
]);
}
const
std
::
vector
<
double
>
data_1_cpp
=
Rcpp
::
as
<
std
::
vector
<
double
>
>
((
data_1
));
const
std
::
vector
<
double
>
data_2_cpp
=
Rcpp
::
as
<
std
::
vector
<
double
>
>
((
data_2
));
...
...
@@ -72,10 +68,6 @@ Rcpp::List snowDaysComparisonCpp(const NumericMatrix data_1,
for
(
size_t
i
=
0
;
i
<
num_pixels
;
++
i
){
out_cpp
[
i
]
=
std
::
vector
<
size_t
>
(
num_years
*
4
);
}
std
::
cout
<<
"copy "
<<
(
std
::
clock
()
-
start
)
/
(
double
)
CLOCKS_PER_SEC
<<
std
::
endl
;
start
=
std
::
clock
();
std
::
vector
<
size_t
>
snow_days_1
(
indices_cpp
[
0
].
size
());
std
::
vector
<
size_t
>
snow_days_2
(
indices_cpp
[
0
].
size
());
...
...
@@ -117,8 +109,6 @@ Rcpp::List snowDaysComparisonCpp(const NumericMatrix data_1,
if
(
interrupt
)
{
throw
interrupt_exception
(
"[I] The computation was interrupted by user"
);
}
std
::
cout
<<
"algo "
<<
(
std
::
clock
()
-
start
)
/
(
double
)
CLOCKS_PER_SEC
<<
std
::
endl
;
start
=
std
::
clock
();
Rcpp
::
List
out
(
num_pixels
);
Rcpp
::
NumericMatrix
content
(
4
,
num_years
);
...
...
@@ -127,8 +117,5 @@ Rcpp::List snowDaysComparisonCpp(const NumericMatrix data_1,
out
(
i
)
=
Rcpp
::
NumericMatrix
(
4
,
num_years
,
out_cpp
[
i
].
begin
()
);
colnames
(
out
(
i
))
=
out_names
;
}
std
::
cout
<<
"out "
<<
(
std
::
clock
()
-
start
)
/
(
double
)
CLOCKS_PER_SEC
<<
std
::
endl
;
return
(
out
);
}
This diff is collapsed.
Click to expand it.
src/snow_season_length.cpp
+
0
−
9
View file @
1a0302e9
...
...
@@ -98,8 +98,6 @@ Rcpp::NumericMatrix snowSeasonLengthCpp(const NumericMatrix data,
bool
interrupt
=
false
;
// Convert R object to proper c++ object since R objects are not thread safe
std
::
clock_t
start
;
start
=
std
::
clock
();
const
size_t
num_pixels
=
data
.
nrow
();
const
size_t
num_years
=
indices
.
size
();
...
...
@@ -113,9 +111,6 @@ Rcpp::NumericMatrix snowSeasonLengthCpp(const NumericMatrix data,
std
::
vector
<
size_t
>
out_cpp
(
num_pixels
*
num_years
);
std
::
cout
<<
"copy "
<<
(
std
::
clock
()
-
start
)
/
(
double
)
CLOCKS_PER_SEC
<<
std
::
endl
;
start
=
std
::
clock
();
std
::
vector
<
double
>
snow_height
(
366
);
#if defined(_OPENMP)
...
...
@@ -154,15 +149,11 @@ Rcpp::NumericMatrix snowSeasonLengthCpp(const NumericMatrix data,
if
(
interrupt
)
{
throw
interrupt_exception
(
"[I] The computation was interrupted by user"
);
}
std
::
cout
<<
"algo "
<<
(
std
::
clock
()
-
start
)
/
(
double
)
CLOCKS_PER_SEC
<<
std
::
endl
;
start
=
std
::
clock
();
Rcpp
::
NumericMatrix
out
(
num_pixels
,
num_years
,
out_cpp
.
begin
());
Rcpp
::
CharacterVector
out_names
=
Rcpp
::
as
<
CharacterVector
>
(
indices
.
names
());
colnames
(
out
)
=
out_names
;
std
::
cout
<<
"out "
<<
(
std
::
clock
()
-
start
)
/
(
double
)
CLOCKS_PER_SEC
<<
std
::
endl
;
return
(
out
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment