39 #ifndef OBJECTIVE_FUNCTION_HPP
40 #define OBJECTIVE_FUNCTION_HPP
43 #include "MsqError.hpp"
44 #include "MsqVertex.hpp"
46 #ifdef MSQ_USE_OLD_STD_HEADERS
67 class ObjectiveFunction
121 double &OF_val,
MsqError &err,
size_t array_size=0);
148 msq_std::list<QualityMetric*> temp_list;
263 bool obj_bool =
false;
300 int k,MsqVertex* vertex, MsqError& err)
308 while (i<imax && !feasible)
312 tmp_var=(*vertex)[
k];
319 (*vertex)[
k]=tmp_var;
328 #endif // ObjectiveFunction_hpp
void set_gradient_type(GRADIENT_TYPE grad)
Set gradType to either NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT.
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
void set_quality_metric(QualityMetric *qm)
Set the value of qMetric.
virtual bool compute_analytical_hessian(PatchData &, MsqHessian &, Vector3D *const &, double &, MsqError &)
bool compute_hessian(PatchData &patch, MsqHessian &hessian, Vector3D *const &grad, double &OF_val, MsqError &err)
Calls compute_analytical_hessian. Function returns 'false' if the patch is not within a required feas...
Used to hold the error state and return it to the application.
Base class for concrete quality metrics.
bool evaluate(PatchData &patch, double &fval, MsqError &err)
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
Vector3D is the object that effeciently stores the objective function Hessian each entry is a Matrix3...
enum GRADIENT_TYPE gradType
every differentiable function should have an analytical gradient implemented.
QualityMetric * get_quality_metric()
virtual msq_std::list< QualityMetric * > get_quality_metric_list()
bool compute_numerical_gradient(PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size)
Non-virtual function which numerically computes the gradient of the Objective Function. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'.
virtual bool compute_analytical_gradient(PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size)
void set_use_local_gradient(bool new_bool)
Sets useLocalGradient This variable determines whether compute_numercial_gradient can use the most ef...
NVec< 3, double > Vector3D
double get_eps(PatchData &pd, double &local_val, int k, MsqVertex *vertex, MsqError &err)
Returns eps used in the numerical gradient calculation.
#define MSQ_CHKERR(err)
Mesquite's Error Checking macro.
QualityMetric * qMetric
Flag for numerical or analytical gradient.
bool compute_gradient(PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size=0)
Calls either compute_numerical_gradient or compute_analytical_gradient depending on the value of grad...
can be very slow. Should be for tests only.
virtual ~ObjectiveFunction()
void set_negate_flag(int neg)
Set the value of ObjectiveFunction's negateFlag. Unless composite, concrete ObjectiveFunctions should...
int get_negate_flag()
Returns negateFlag.
int negateFlag
Pointer to associated QualityMetric.
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
virtual bool concrete_evaluate(PatchData &patch, double &fval, MsqError &err)=0