Commit 77bb1c04 authored by Laurent Belcour's avatar Laurent Belcour

Updating FLANN Qt prf file to export the configuration name.

Adding a conversion tool for the output parametrization.
parent f1978677
......@@ -6,11 +6,15 @@
#
unix:!macx{
INCLUDEPATH += /usr/include/
LIBS += -L/usr/lib/x86_64-linux-gnu -lflann
CONFIG *= flann
INCLUDEPATH *= /usr/include/
LIBS *= -L/usr/lib/x86_64-linux-gnu
LIBS *= -lflann
}
macx{
INCLUDEPATH += /opt/local/include
LIBS += -L/opt/local/lib -lflann
CONFIG *= flann
INCLUDEPATH *= /opt/local/include
LIBS *= -L/opt/local/lib
LIBS *= -lflann
}
......@@ -151,6 +151,38 @@ class params
}
}
//! \brief static function for input type convertion. The outvec
//! resulting vector should be allocated with the correct
//! output size.
static void convert(const double* invec, params::output intype, int indim,
params::output outtype, int outdim, double* outvec)
{
// The convertion is done using the cartesian parametrization as
// an intermediate one. If the two parametrizations are equals
// there is no need to perform the conversion.
if(outdim == indim)
{
for(int i=0; i<outdim; ++i) { outvec[i] = invec[i]; }
}
// If the dimension of the output data is bigger than the
// dimensions of the input domain, and the input domain is of
// dimension one, spread the data over all dimensions.
else if(indim == 1)
{
for(int i=0; i<outdim; ++i) { outvec[i] = invec[0]; }
}
// If the output dimension is one, compute the average of the
// input vector values.
else if(outdim == 1)
{
for(int i=0; i<indim; ++i) { outvec[0] = invec[i]; }
}
else
{
NOT_IMPLEMENTED();
}
}
//! \brief static function for input type convertion. The outvec
//! resulting vector should be allocated with the correct
//! output size.
......
......@@ -52,6 +52,8 @@ void data_interpolant::load(const std::string& filename)
setDimY(_data->dimY());
setMin(_data->min());
setMax(_data->max());
setParametrization(_data->input_parametrization());
setParametrization(_data->output_parametrization());
#ifdef USE_DELAUNAY
dD = dimX()+dimY();
......
......@@ -5,7 +5,7 @@ requires(contains(CONFIG, flann))
requires(contains(CONFIG, eigen))
TEMPLATE = lib
CONFIG *= plugin
CONFIG *= plugin
DESTDIR = ../../build
INCLUDEPATH += ../..
......
......@@ -118,6 +118,9 @@ int main(int argc, char** argv)
return 1;
}
std::cout << "<<INFO>> conversion from " << params::get_name(d_in->input_parametrization())
<< " to " << params::get_name(d_out->input_parametrization()) << std::endl;
if(dynamic_pointer_cast<vertical_segment>(d_out))
{
params::input param = params::parse_input(args["param"]);
......@@ -156,9 +159,17 @@ int main(int argc, char** argv)
}
else
{
if(d_out->output_parametrization() != d_in->output_parametrization())
{
std::cerr << "<<WARNING>> data types have different output parametrizations." << std::endl;
std::cerr << " This is currently not handled properly by ALTA." << std::endl;
}
if(d_out->dimY() != d_in->dimY())
{
std::cerr << "<<ERROR>> data types have incompatible output dimensions" << std::endl;
std::cerr << "<<WARNING>> data types have different output dimensions (" << d_in->dimY()
<< " and " << d_out->dimY() << ")." << std::endl;
std::cerr << " This is currently not handled properly by ALTA." << std::endl;
}
vec temp(d_in->dimX());
......@@ -169,11 +180,7 @@ int main(int argc, char** argv)
params::convert(&x[0], d_out->parametrization(), d_in->parametrization(), &temp[0]);
vec y = d_in->value(temp);
for(int j=0; j<d_in->dimY(); ++j)
{
x[d_out->dimX() + j] = y[j];
}
params::convert(&y[0], d_in->output_parametrization(), d_in->dimY(), d_out->output_parametrization(), d_out->dimY(), &x[d_out->dimX()]);
d_out->set(x);
}
......
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