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
69c6daed
Commit
69c6daed
authored
Sep 24, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding an example of XML command
parent
74d59009
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
1 deletion
+77
-1
sources/core/plugins_manager.cpp
sources/core/plugins_manager.cpp
+3
-0
sources/scripts/example.xml
sources/scripts/example.xml
+38
-0
sources/scripts/xml_cmd.py
sources/scripts/xml_cmd.py
+36
-1
No files found.
sources/core/plugins_manager.cpp
View file @
69c6daed
...
...
@@ -288,6 +288,9 @@ function* plugins_manager::get_function(const arguments& args)
{
std
::
string
n
(
"--func "
);
n
.
append
(
args_vec
[
i
]);
#ifdef DEBUG
std
::
cout
<<
"<<DEBUG>> load function with args: "
<<
n
<<
std
::
endl
;
#endif
arguments
temp_args
=
arguments
::
create_arguments
(
n
);
function
*
f
=
get_function
(
temp_args
);
if
(
dynamic_cast
<
nonlinear_function
*>
(
f
)
==
NULL
)
...
...
sources/scripts/example.xml
0 → 100644
View file @
69c6daed
<?xml version="1.0"?>
<alta>
<configuration>
<parameter
name=
"lib-dir"
value=
"./build"
/>
</configuration>
<action
name=
"data2brdf"
>
<!-- Input and output arguments of the action -->
<input
name=
"../data/2d/matusik_merl/blue-metallic-paint-double-mean-romeiro-80deg.dat"
/>
<output
name=
"blue-metallic-paint.brdf"
/>
<!-- Define the function to use -->
<function
name=
"nonlinear_function_diffuse"
/>
<function
name=
"nonlinear_function_isotropic_lafortune"
/>
<function
name=
"nonlinear_function_isotropic_lafortune"
>
</function>
<!-- You can put as many function as you want, they will be
treated as a compound -->
<!-- <function name="nonlinear_function_isotropic_lafortune" />-->
<!-- Define the ftting procedure to use -->
<plugin
type=
"fitter"
name=
"nonlinear_fitter_nlopt"
/>
<!--<plugin type="fitter" name="nonlinear_fitter_ceres" />-->
<!--<plugin type="fitter" name="nonlinear_fitter_eigen" />-->
<!--<plugin type="fitter" name="nonlinear_fitter_ipopt" />-->
<parameter
name=
"max"
value=
"[0.8, 0.8]"
/>
</action>
<action
name=
"brdf2gnuplot"
>
<input
name=
"blue-metallic-paint.brdf"
/>
<output
name=
"blue-metallic-paint.dat"
/>
<parameter
name=
"data"
value=
"../data/2d/matusik_merl/blue-metallic-paint-double-mean-romeiro-80deg.dat"
/>
</action>
</alta>
sources/scripts/xml_cmd.py
View file @
69c6daed
...
...
@@ -50,6 +50,39 @@ def parseConfiguration(xmlNode):
#end
#end
def
parseFunction
(
xmlNode
):
global
lib_dir
;
cmd
=
''
;
cmd
+=
lib_dir
+
'/'
+
libName
(
xmlNode
.
attrib
[
'name'
]);
# Parse the parameters of the function
for
param
in
xmlNode
.
findall
(
'parameter'
):
cmd
+=
' --'
+
param
.
attrib
[
'name'
]
+
' '
+
param
.
attrib
[
'value'
];
#end
return
cmd
;
#end
def
parseFunctions
(
xmlNodes
):
list_len
=
len
(
xmlNodes
);
if
(
list_len
==
0
):
return
''
;
elif
(
list_len
==
1
):
return
' --func '
+
parseFunction
(
xmlNodes
[
0
]);
else
:
cmd
=
' --func ['
;
for
index
in
range
(
0
,
list_len
):
cmd
+=
parseFunction
(
xmlNodes
[
index
]);
if
(
index
!=
list_len
-
1
):
cmd
+=
', '
;
#end
#end
cmd
+=
']'
;
return
cmd
;
#end
#end
def
parseAction
(
xmlNode
):
global
lib_dir
,
dat_dir
,
out_dir
;
...
...
@@ -65,6 +98,8 @@ def parseAction(xmlNode):
cmd
+=
' --output '
+
outputNode
.
attrib
[
'name'
];
#end
cmd
+=
parseFunctions
(
xmlNode
.
findall
(
'function'
));
for
plugin
in
xmlNode
.
findall
(
'plugin'
):
cmd
+=
' --'
+
plugin
.
attrib
[
'type'
];
cmd
+=
' '
+
lib_dir
+
'/'
+
libName
(
plugin
.
attrib
[
'name'
]);
...
...
@@ -99,7 +134,7 @@ for child in root.findall('action'):
# Parse the action
cmd
+=
parseAction
(
child
);
#print
cmd;
print
'
\n
'
+
cmd
;
ret
=
os
.
system
(
cmd
);
if
(
ret
!=
0
):
print
'<<PYTHON>> the action was not performed'
;
...
...
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