Commit 21a54898 authored by Laurent Belcour's avatar Laurent Belcour

Correction of some bug in the data2data and rational_fitter_parallel.

parent f1d1425f
......@@ -28,7 +28,7 @@ ALTA_DLL_EXPORT fitter* provide_fitter()
rational_fitter_parallel::rational_fitter_parallel() : nb_starting_points(100)
{
}
rational_fitter_parallel::~rational_fitter_parallel()
rational_fitter_parallel::~rational_fitter_parallel()
{
}
......@@ -48,14 +48,14 @@ bool rational_fitter_parallel::fit_data(const ptr<data> dat, function* fit, cons
std::cerr << "<<WARNING>> we advise you to perform convertion with a separate command." << std::endl;
ptr<vertical_segment> vs(new vertical_segment());
for(int i=0; i<dat->size(); ++i)
for(int i=0; i<dat->size(); ++i)
{
const vec x = dat->get(i);
vec y(dat->dimX() + 3*dat->dimY());
for(int k=0; k<x.size() ; ++k) { y[k] = x[k]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size()] = (1.0 - args.get_float("dt", 0.1)) * x[k + dat->dimX() + dat->dimY()]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size() + dat->dimY()] = (1.0 + args.get_float("dt", 0.1)) * x[k + dat->dimX() + 2*dat->dimY()]; }
for(int k=0; k<x.size() ; ++k) { y[k] = x[k]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size() + dat->dimY()] = (1.0 - args.get_float("dt", 0.1)) * x[k + dat->dimX()]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size() + 2*dat->dimY()] = (1.0 + args.get_float("dt", 0.1)) * x[k + dat->dimX()]; }
vs->set(y);
}
......@@ -151,7 +151,7 @@ bool rational_fitter_parallel::fit_data(const ptr<data> dat, function* fit, cons
std::cout << "<<INFO>> delta = " << delta << std::endl;
std::cout << std::endl;
// Get the solution with the minimum delta or the minimum L2 distance,
// Get the solution with the minimum delta or the minimum L2 distance,
// and update the main rational function r.
if((use_delta && delta < min_delta) || (!use_delta && l2_dist < min_l2_dist))
{
......@@ -201,7 +201,7 @@ void rational_fitter_parallel::set_parameters(const arguments&)
}
bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np, int nq,
bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np, int nq,
rational_function* r, const arguments &args,
double& delta, double& linf_dist, double& l2_dist)
{
......@@ -294,8 +294,8 @@ bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np,
return false;
}
void rational_fitter_parallel::get_constraint(int i, int np, int nq, int ny,
const ptr<vertical_segment>& data,
void rational_fitter_parallel::get_constraint(int i, int np, int nq, int ny,
const ptr<vertical_segment>& data,
const rational_function_1d* func,
vec& cu, vec& cl)
{
......
......@@ -7,7 +7,7 @@
* or to perform interpolation of sample values (i.e. to fill gaps).
*
* <h3>Usage</h3>
* \verbatim
* \verbatim
data2data --input data.file --output data.file --out-data exporter.so --in-data importer.so
\endverbatim
*
......@@ -96,16 +96,14 @@ int main(int argc, char** argv)
return 1 ;
}
*/
// Import data
ptr<data> d_in = NULL ;
d_in = plugins_manager::get_data(args["in-data"]) ;
ptr<data> d_in = plugins_manager::get_data(args["in-data"]) ;
d_in->load(args["input"], args);
ptr<data> d_out = NULL;
d_out = plugins_manager::get_data(args["out-data"]) ;
ptr<data> d_out = plugins_manager::get_data(args["out-data"]) ;
if(!d_in && !d_out)
{
std::cerr << "<<ERROR>> cannot import or export data" << std::endl ;
......@@ -138,7 +136,7 @@ int main(int argc, char** argv)
// Copy the input vector
vec x = d_in->get(i);
params::convert(&x[0], d_in->parametrization(), d_out->parametrization(), &temp[0]);
for(int j=0; j<d_in->dimY(); ++j)
{
temp[d_out->dimX() + j] = x[d_in->dimX() + j];
......@@ -146,7 +144,7 @@ int main(int argc, char** argv)
d_out->set(temp);
}
}
}
else
{
......@@ -170,8 +168,8 @@ int main(int argc, char** argv)
}
d_out->set(x);
}
}
}
}
d_out->save(args["output"]);
return 0 ;
}
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