Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
02008951
Commit
02008951
authored
Sep 19, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does compile under Windows
parent
da34b627
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
12 deletions
+25
-12
sources/core/args.h
sources/core/args.h
+1
-1
sources/core/common.cpp
sources/core/common.cpp
+5
-5
sources/core/common.h
sources/core/common.h
+13
-0
sources/core/function.cpp
sources/core/function.cpp
+1
-1
sources/core/rational_function.cpp
sources/core/rational_function.cpp
+2
-2
sources/core/vertical_segment.cpp
sources/core/vertical_segment.cpp
+3
-3
No files found.
sources/core/args.h
View file @
02008951
...
...
@@ -151,7 +151,7 @@ class arguments
float
get_float
(
const
std
::
string
&
key
,
float
default_value
=
0.0
f
)
const
{
if
(
_map
.
count
(
key
)
>
0
)
return
atof
(
_map
.
find
(
key
)
->
second
.
c_str
())
;
return
(
float
)
atof
(
_map
.
find
(
key
)
->
second
.
c_str
())
;
else
return
default_value
;
}
...
...
sources/core/common.cpp
View file @
02008951
...
...
@@ -3,7 +3,7 @@
double
norm
(
const
vec
&
a
)
{
double
norm
=
0.0
;
for
(
unsigned
int
i
=
0
;
i
<
a
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
a
.
size
();
++
i
)
{
norm
+=
a
[
i
]
*
a
[
i
];
}
...
...
@@ -14,13 +14,13 @@ vec normalize(const vec& a)
{
vec
b
(
a
.
size
());
double
norm
=
0.0
;
for
(
unsigned
int
i
=
0
;
i
<
a
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
a
.
size
();
++
i
)
{
norm
+=
a
[
i
]
*
a
[
i
];
}
norm
=
sqrt
(
norm
);
for
(
unsigned
int
i
=
0
;
i
<
a
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
a
.
size
();
++
i
)
{
b
[
i
]
=
a
[
i
]
/
norm
;
}
...
...
@@ -33,7 +33,7 @@ double dot(const vec& a, const vec& b)
assert
(
a
.
size
()
==
b
.
size
());
#endif
double
res
=
0.0
;
for
(
unsigned
int
i
=
0
;
i
<
a
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
a
.
size
();
++
i
)
{
res
+=
a
[
i
]
*
b
[
i
];
}
...
...
@@ -48,7 +48,7 @@ vec product(const vec& a, const vec& b)
#endif
vec
res
(
a
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
a
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
a
.
size
();
++
i
)
{
res
[
i
]
=
a
[
i
]
*
b
[
i
];
}
...
...
sources/core/common.h
View file @
02008951
...
...
@@ -256,13 +256,26 @@ template<typename T> T clamp(T x, T a, T b)
return
std
::
max
<
T
>
(
std
::
min
<
T
>
(
x
,
b
),
a
);
}
#ifdef WIN32
#define NOT_IMPLEMENTED() \
std::cerr << "<<ERROR>> not implemented " << __FUNCDNAME__ << " in file " << __FILE__ \
<< ":" << __LINE__ << std::endl; \
throw
#else
#define NOT_IMPLEMENTED() \
std::cerr << "<<ERROR>> not implemented " << __PRETTY_FUNCTION__ << " in file " << __FILE__ \
<< ":" << __LINE__ << std::endl; \
throw
#endif
// Mathematical definition not provided on the Window plateform
#ifdef WIN32
#define M_PI 3.14159265
template
<
typename
T
>
bool
isnan
(
T
x
)
{
return
x
==
std
::
numeric_limits
<
T
>::
signaling_NaN
();
}
#endif
#ifdef WIN32
...
...
sources/core/function.cpp
View file @
02008951
...
...
@@ -10,7 +10,7 @@ void function::save(const std::string& filename, const arguments& args) const
bool
is_matlab
=
args
[
"export"
]
==
"matlab"
;
// Open the file
std
::
ofstream
file
(
filename
);
std
::
ofstream
file
(
filename
.
c_str
()
);
if
(
!
file
.
is_open
())
{
std
::
cerr
<<
"<<ERROR>> unable to open output file for writing"
<<
std
::
endl
;
...
...
sources/core/rational_function.cpp
View file @
02008951
...
...
@@ -261,7 +261,7 @@ vec rational_function_1d::value(const vec& x) const
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
rational_function_1d
&
r
)
{
std
::
cout
<<
"p = ["
;
for
(
unsigned
int
i
=
0
;
i
<
r
.
a
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
r
.
a
.
size
();
++
i
)
{
if
(
i
!=
0
)
{
...
...
@@ -272,7 +272,7 @@ std::ostream& operator<< (std::ostream& out, const rational_function_1d& r)
std
::
cout
<<
"]"
<<
std
::
endl
;
std
::
cout
<<
"q = ["
;
for
(
unsigned
int
i
=
0
;
i
<
r
.
b
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
r
.
b
.
size
();
++
i
)
{
if
(
i
!=
0
)
{
...
...
sources/core/vertical_segment.cpp
View file @
02008951
...
...
@@ -57,8 +57,8 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
_min
.
resize
(
dimX
())
;
_max
.
resize
(
dimX
())
;
min
=
args
.
get_vec
(
"min"
,
_nX
,
-
std
::
numeric_limits
<
double
>::
max
())
;
max
=
args
.
get_vec
(
"max"
,
_nX
,
std
::
numeric_limits
<
double
>::
max
())
;
min
=
args
.
get_vec
(
"min"
,
_nX
,
-
std
::
numeric_limits
<
float
>::
max
())
;
max
=
args
.
get_vec
(
"max"
,
_nX
,
std
::
numeric_limits
<
float
>::
max
())
;
for
(
int
k
=
0
;
k
<
dimX
();
++
k
)
{
...
...
@@ -121,7 +121,7 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
}
else
{
double
dt
=
args
.
get_float
(
"dt"
,
0.1
);
double
dt
=
args
.
get_float
(
"dt"
,
0.1
f
);
min_dt
=
-
dt
;
max_dt
=
dt
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment