Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
ndcurves
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
loco-3d
ndcurves
Commits
86786232
Unverified
Commit
86786232
authored
3 months ago
by
Joris Vaillant
Browse files
Options
Downloads
Patches
Plain Diff
tests: Allocate buffer on the heap instead of the stack
parent
624d1c9a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/load_problem.h
+7
-5
7 additions, 5 deletions
tests/load_problem.h
with
7 additions
and
5 deletions
tests/load_problem.h
+
7
−
5
View file @
86786232
...
...
@@ -19,7 +19,7 @@
namespace
ndcurves
{
typedef
Eigen
::
Vector3d
point_t
;
typedef
std
::
vector
<
point_t
,
Eigen
::
aligned_allocator
<
point_t
>
>
t_point_t
;
typedef
std
::
vector
<
point_t
,
Eigen
::
aligned_allocator
<
point_t
>>
t_point_t
;
typedef
Eigen
::
VectorXd
pointX_t
;
typedef
std
::
pair
<
double
,
pointX_t
>
Waypoint
;
typedef
std
::
vector
<
Waypoint
>
T_Waypoint
;
...
...
@@ -41,9 +41,10 @@ typedef quadratic_problem<point_t, double> problem_t;
#define MAXBUFSIZE ((int)1e6)
Eigen
::
MatrixXd
readMatrix
(
std
::
ifstream
&
infile
)
{
Eigen
::
MatrixXd
readMatrix
(
std
::
ifstream
&
infile
)
{
int
cols
=
0
,
rows
=
0
;
double
buff
[
MAXBUFSIZE
];
std
::
vector
<
double
>
buff
;
buff
.
resize
(
MAXBUFSIZE
);
// Read numbers from file into buffer.
// ifstream infile;
...
...
@@ -54,7 +55,8 @@ Eigen::MatrixXd readMatrix(std::ifstream& infile) {
int
temp_cols
=
0
;
std
::
stringstream
stream
(
line
);
while
(
!
stream
.
eof
())
stream
>>
buff
[
cols
*
rows
+
temp_cols
++
];
while
(
!
stream
.
eof
())
stream
>>
buff
[
static_cast
<
size_t
>
(
cols
*
rows
+
temp_cols
++
)];
if
(
temp_cols
==
0
)
continue
;
...
...
@@ -73,7 +75,7 @@ Eigen::MatrixXd readMatrix(std::ifstream& infile) {
return
result
;
}
problem_definition_t
loadproblem
(
const
std
::
string
&
filename
)
{
problem_definition_t
loadproblem
(
const
std
::
string
&
filename
)
{
problem_definition_t
pDef
(
3
);
std
::
ifstream
in
(
filename
.
c_str
());
if
(
!
in
.
is_open
())
throw
std
::
runtime_error
(
"cant open filename"
);
...
...
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