Commit 69c6daed authored by Laurent Belcour's avatar Laurent Belcour

Adding an example of XML command

parent 74d59009
......@@ -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)
......
<?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>
......@@ -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';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment