Commit 01d2ca89 authored by Laurent Belcour's avatar Laurent Belcour

Updated Fresnel, not completely working. But at least it is loading.

I need to work more on the saving and loading procedure to ensure
how all this will work togther.
parent df821dba
......@@ -267,11 +267,12 @@ class fresnel : public nonlinear_function
// Overload the function operator
virtual vec operator()(const vec& x) const
{
return f->value(x);
return value(x);
}
virtual vec value(const vec& x) const
{
return f->value(x);
vec fres = fresnelValue(x);
return fres * f->value(x);
}
//! Load function specific files
......@@ -408,6 +409,17 @@ class fresnel : public nonlinear_function
f = fin;
}
//! \brief provide the input parametrization of the object.
virtual params::input input_parametrization() const
{
return f->input_parametrization();
}
//! \brief provide the outout parametrization of the object.
virtual params::output output_parametrization() const
{
return f->output_parametrization();
}
//! \brief can set the input parametrization of a non-parametrized
//! object. Print an error if it is already defined.
......
......@@ -287,7 +287,8 @@ function* plugins_manager::get_function(const arguments& args)
fresnel* func_fres = dynamic_cast<fresnel*>(get_function(arguments::create_arguments(n)));
func_fres->setBase(nl_func);
func = dynamic_cast<function*>(func_fres);
return func_fres;
}
return func;
......@@ -344,20 +345,20 @@ fitter* plugins_manager::get_fitter(const std::string& n)
void plugins_manager::check_compatibility(data*& d, function*& f,
const arguments& args)
{
if(d->parametrization() == params::UNKNOWN_INPUT)
if(d->input_parametrization() == params::UNKNOWN_INPUT)
{
std::cout << "<<WARNING>> unknown parametrization for data" << std::endl;
}
if(f->parametrization() == params::UNKNOWN_INPUT)
if(f->input_parametrization() == params::UNKNOWN_INPUT)
{
std::cout << "<<DEBUG>> function will take the parametrization of the data" << std::endl;
f->setParametrization(d->parametrization());
f->setParametrization(d->input_parametrization());
}
else if(d->parametrization() != f->parametrization())
else if(d->input_parametrization() != f->input_parametrization())
{
std::cout << "<<INFO>> has to change the parametrization of the input data" << std::endl;
data_params* dd = new data_params(d, f->parametrization());
data_params* dd = new data_params(d, f->input_parametrization());
d = dd ;
}
else
......
......@@ -70,4 +70,5 @@ vec schlick::getFresnelParametersJacobian(const vec& x) const
void schlick::bootstrap(const data* d, const arguments& args)
{
R = 1.0;
}
......@@ -32,7 +32,11 @@ class isotropic_lafortune_function : public nonlinear_function
public: // methods
isotropic_lafortune_function() : _n(1) { }
isotropic_lafortune_function() : _n(1)
{
setParametrization(params::CARTESIAN);
setDimX(6);
}
// Overload the function operator
virtual vec operator()(const vec& x) const ;
......@@ -65,19 +69,7 @@ class isotropic_lafortune_function : public nonlinear_function
{
return 6;
}
//! \brief Provide the parametrization of the input space of the function.
//! For this one, we fix that the parametrization is in THETAD_PHID
virtual params::input parametrization() const
{
return params::CARTESIAN ;
}
virtual void setParametrization(params::input new_param)
{
std::cerr << "<<ERROR>> Cannot change the ouput parametrization " << __FILE__ << ":" << __LINE__ << std::endl;
throw;
}
//! \brief Set the number of output dimensions
void setDimY(int nY);
......
CONFIG += qt
INCLUDEPATH += ../../
INCLUDEPATH += ../../ ../../plugins
DESTDIR = ../../build
SOURCES += main.cpp
SOURCES += main.cpp \
../../plugins/nonlinear_fresnel_schlick/function.cpp
LIBS += -L../../build -lcore
unix{
......
......@@ -4,6 +4,7 @@
#include <core/args.h>
#include <core/params.h>
#include <nonlinear_fresnel_schlick/function.h>
int main(int argc, char** argv)
{
......
......@@ -42,7 +42,6 @@ int main(int argc, char** argv)
// Evaluation tests
//
std::cout << "<<INFO>> " << nb_tests_failed << " tests failed" << std::endl;
......
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