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
63c3f6be
Commit
63c3f6be
authored
Jan 29, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating argument informations
parent
1ec84393
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
14 deletions
+22
-14
sources/core/args.h
sources/core/args.h
+3
-4
sources/core/function.h
sources/core/function.h
+2
-1
sources/plugins/rational_function/rational_function.cpp
sources/plugins/rational_function/rational_function.cpp
+15
-1
sources/plugins/rational_function/rational_function.h
sources/plugins/rational_function/rational_function.h
+1
-1
sources/tests/plugin_loader/main.cpp
sources/tests/plugin_loader/main.cpp
+1
-7
No files found.
sources/core/args.h
View file @
63c3f6be
...
...
@@ -69,11 +69,10 @@ class arguments
}
;
int
get_int
(
const
std
::
string
&
key
,
int
default_value
=
0
)
const
{
std
::
string
value
=
_map
.
at
(
key
)
;
if
(
value
.
empty
())
return
default_value
;
if
(
_map
.
count
(
key
)
>
0
)
return
atoi
(
_map
.
at
(
key
).
c_str
())
;
else
return
atoi
(
value
.
c_str
())
;
return
default_value
;
}
;
private:
// data
...
...
sources/core/function.h
View file @
63c3f6be
...
...
@@ -6,6 +6,7 @@
#include <QtPlugin>
#include "common.h"
#include "args.h"
class
function
//: public std::function<double(double)>
{
...
...
@@ -16,7 +17,7 @@ class function //: public std::function<double(double)>
// IO function to text files
virtual
void
load
(
const
std
::
string
&
filename
)
=
0
;
virtual
void
save
()
const
=
0
;
virtual
void
save
(
const
std
::
string
&
filename
,
const
arguments
&
args
)
const
=
0
;
virtual
int
dimX
()
const
{
return
_nX
;
}
;
virtual
int
dimY
()
const
{
return
_nY
;
}
;
...
...
sources/plugins/rational_function/rational_function.cpp
View file @
63c3f6be
...
...
@@ -121,8 +121,22 @@ double rational_function::q(const vec& x, int i) const
void
rational_function
::
load
(
const
std
::
string
&
filename
)
{
}
void
rational_function
::
save
()
const
void
rational_function
::
save
(
const
std
::
string
&
filename
,
const
arguments
&
args
)
const
{
vec
min
,
max
;
min
.
assign
(
_nX
,
args
.
get_float
(
"min"
,
0.0
f
))
;
max
.
assign
(
_nX
,
args
.
get_float
(
"max"
,
1.5
f
))
;
int
nb_samples
=
args
.
get_int
(
"nb_samples"
,
100
)
;
double
dt
=
(
max
[
0
]
-
min
[
0
])
/
nb_samples
;
std
::
ofstream
file
(
filename
.
c_str
(),
std
::
ios_base
::
trunc
);
for
(
double
x
=
min
[
0
];
x
<=
max
[
0
];
x
+=
dt
)
{
vec
vx
;
vx
.
push_back
(
x
)
;
file
<<
x
<<
"
\t
"
<<
((
*
this
)(
vx
))[
0
]
<<
std
::
endl
;
std
::
cout
<<
x
<<
"
\t
"
<<
((
*
this
)(
vx
))[
0
]
<<
std
::
endl
;
}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
rational_function
&
r
)
...
...
sources/plugins/rational_function/rational_function.h
View file @
63c3f6be
...
...
@@ -32,7 +32,7 @@ class rational_function : public QObject, public function
// IO function to text files
void
load
(
const
std
::
string
&
filename
)
;
void
save
()
const
;
void
save
(
const
std
::
string
&
filename
,
const
arguments
&
args
)
const
;
// STL stream ouput
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
rational_function
&
r
)
;
...
...
sources/tests/plugin_loader/main.cpp
View file @
63c3f6be
...
...
@@ -108,13 +108,7 @@ int main(int argc, char** argv)
// Display the result
if
(
is_fitted
)
{
std
::
ofstream
file
(
args
[
"output"
].
c_str
(),
std
::
ios_base
::
trunc
);
const
double
dt
=
(
d
->
max
()[
0
]
-
d
->
min
()[
0
])
/
100.0
f
;
for
(
double
x
=
d
->
min
()[
0
];
x
<=
d
->
max
()[
0
];
x
+=
dt
)
{
vec
vx
;
vx
.
push_back
(
x
)
;
file
<<
x
<<
"
\t
"
<<
((
*
f
)(
vx
))[
0
]
<<
std
::
endl
;
}
functions
[
0
]
->
save
(
args
[
"output"
],
args
)
;
}
else
{
...
...
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