Commit b69e6120 authored by Laurent Belcour's avatar Laurent Belcour

Adding implementation of the phong non-linear function

parent bda19515
......@@ -31,32 +31,54 @@ vec phong_function::value(const vec& x) const
//! Load function specific files
void phong_function::load(const std::string& filename)
{
std::cerr << "Not implemented " << __FILE__ << ":" << __LINE__ << std::endl;
throw;
}
//! Save the current function to a specific file type
void phong_function::save(const std::string& filename, const arguments& args) const
{
std::cerr << "Not implemented " << __FILE__ << ":" << __LINE__ << std::endl;
throw;
}
//! Number of parameters to this non-linear function
int phong_function::nbParameters() const
{
return 3*dimY();
}
//! Get the vector of parameters for the function
vec phong_function::parameters() const
{
vec res(3*dimY());
for(int i=0; i<dimY(); ++i)
{
res[i] = _kd[i];
res[i+ dimY()] = _ks[i];
res[i+2*dimY()] = _N[i];
}
return res;
}
//! Update the vector of parameters for the function
void phong_function::setParameters(const vec& p)
{
for(int i=0; i<dimY(); ++i)
{
_kd[i] = p[i];
_ks[i] = p[i+ dimY()];
_N[i] = p[i+2*dimY()];
}
}
//! Obtain the derivatives of the function with respect to the
//! parameters.
vec phong_function::parametersJacobian(const vec& x) const
{
std::cerr << "Not implemented " << __FILE__ << ":" << __LINE__ << std::endl;
throw;
}
Q_EXPORT_PLUGIN2(phong_function, phong_function)
......@@ -64,7 +64,21 @@ class phong_function : public nonlinear_function, public QObject
{
return params::COS_TH ;
}
virtual void setParametrization(params::input new_param)
{
std::cerr << "Cannot change the ouput parametrization " << __FILE__ << ":" << __LINE__ << std::endl;
throw;
}
void setDimY(int nY)
{
_nY = nY ;
// Update the length of the vectors
_kd.resize(_nY) ;
_ks.resize(_nY) ;
_N.resize(_nY) ;
}
private: // data
......
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