Calculates the L_p objective function raised to the pth power. That is, sums the p_th powers of (the absolute value of) the quality metric values. More...
#include <LPtoPTemplate.hpp>
Public Member Functions | |
LPtoPTemplate (QualityMetric *, short, MsqError &) | |
virtual | ~LPtoPTemplate () |
virtual bool | concrete_evaluate (PatchData &patch, double &fval, MsqError &err) |
void | set_dividing_by_n (bool d_bool) |
LPtoPTemplate (QualityMetric *, short, MsqError &) | |
virtual | ~LPtoPTemplate () |
virtual bool | concrete_evaluate (PatchData &patch, double &fval, MsqError &err) |
void | set_dividing_by_n (bool d_bool) |
Public Member Functions inherited from ObjectiveFunction | |
ObjectiveFunction () | |
virtual | ~ObjectiveFunction () |
bool | evaluate (PatchData &patch, double &fval, MsqError &err) |
void | set_gradient_type (GRADIENT_TYPE grad) |
Set gradType to either NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT. More... | |
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 gradType. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
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 feasible regeion. Otherwise, it returns 'true'. More... | |
QualityMetric * | get_quality_metric () |
virtual msq_std::list < QualityMetric * > | get_quality_metric_list () |
void | set_quality_metric (QualityMetric *qm) |
Set the value of qMetric. More... | |
void | set_negate_flag (int neg) |
Set the value of ObjectiveFunction's negateFlag. Unless composite, concrete ObjectiveFunctions should set this flag to to the value of the associated QualityMetric's negateFLag. More... | |
int | get_negate_flag () |
Returns negateFlag. More... | |
ObjectiveFunction () | |
virtual | ~ObjectiveFunction () |
bool | evaluate (PatchData &patch, double &fval, MsqError &err) |
void | set_gradient_type (GRADIENT_TYPE grad) |
Set gradType to either NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT. More... | |
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 gradType. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
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 feasible regeion. Otherwise, it returns 'true'. More... | |
QualityMetric * | get_quality_metric () |
virtual msq_std::list < QualityMetric * > | get_quality_metric_list () |
void | set_quality_metric (QualityMetric *qm) |
Set the value of qMetric. More... | |
void | set_negate_flag (int neg) |
Set the value of ObjectiveFunction's negateFlag. Unless composite, concrete ObjectiveFunctions should set this flag to to the value of the associated QualityMetric's negateFLag. More... | |
int | get_negate_flag () |
Returns negateFlag. More... | |
Protected Member Functions | |
virtual bool | compute_analytical_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size) |
virtual bool | compute_analytical_hessian (PatchData &patch, MsqHessian &hessian, Vector3D *const &grad, double &OF_val, MsqError &err) |
virtual bool | compute_analytical_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size) |
virtual bool | compute_analytical_hessian (PatchData &patch, MsqHessian &hessian, Vector3D *const &grad, double &OF_val, MsqError &err) |
Protected Member Functions inherited from ObjectiveFunction | |
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'. More... | |
double | get_eps (PatchData &pd, double &local_val, int k, MsqVertex *vertex, MsqError &err) |
Returns eps used in the numerical gradient calculation. More... | |
void | set_use_local_gradient (bool new_bool) |
Sets useLocalGradient This variable determines whether compute_numercial_gradient can use the most efficient gradient calculation. More... | |
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'. More... | |
double | get_eps (PatchData &pd, double &local_val, int k, MsqVertex *vertex, MsqError &err) |
Returns eps used in the numerical gradient calculation. More... | |
void | set_use_local_gradient (bool new_bool) |
Sets useLocalGradient This variable determines whether compute_numercial_gradient can use the most efficient gradient calculation. More... | |
Private Member Functions | |
double | compute_function (double metric_values[], size_t total_num, MsqError &err) |
double | compute_function (double metric_values[], size_t total_num, MsqError &err) |
Private Attributes | |
short | pVal |
The metric value entries are raised to the pVal power. More... | |
bool | dividingByN |
dividingByN is true if we are dividing the objective function by the number of metric values. More... | |
Additional Inherited Members | |
Public Types inherited from ObjectiveFunction | |
enum | GRADIENT_TYPE { NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT, NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT } |
enum | GRADIENT_TYPE { NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT, NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT } |
Calculates the L_p objective function raised to the pth power. That is, sums the p_th powers of (the absolute value of) the quality metric values.
Definition at line 68 of file includeLinks/LPtoPTemplate.hpp.
LPtoPTemplate | ( | QualityMetric * | qualitymetric, |
short | Pinput, | ||
MsqError & | err | ||
) |
Definition at line 46 of file ObjectiveFunction/LPtoPTemplate.cpp.
References ObjectiveFunction::ANALYTICAL_GRADIENT, LPtoPTemplate::dividingByN, QualityMetric::get_negate_flag(), MsqError::INVALID_ARG, MSQ_SETERR, LPtoPTemplate::pVal, ObjectiveFunction::set_gradient_type(), ObjectiveFunction::set_negate_flag(), and ObjectiveFunction::set_quality_metric().
|
virtual |
Definition at line 60 of file ObjectiveFunction/LPtoPTemplate.cpp.
LPtoPTemplate | ( | QualityMetric * | , |
short | , | ||
MsqError & | |||
) |
|
virtual |
|
protectedvirtual |
Fills an array of Vector3D, grad, with the gradient of the objective function computed using the gradient of the quality metric. If the function has not been over-riden in the concrete Objective Function, the base class implementation prints a warning and then defaults to numerical gradient. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'.
patch | The PatchData object for which the objective function gradient is computed. |
grad | An array of Vector3D, at least the size of the number of vertices in the patch. |
OF_val | is set to the value of the objective function. |
array_size | is the size of the grad Vector3D[] array and must correspond to the number of vertices in the patch. |
Reimplemented from ObjectiveFunction.
Definition at line 139 of file ObjectiveFunction/LPtoPTemplate.cpp.
References QualityMetric::compute_element_gradient(), QualityMetric::compute_vertex_gradient(), LPtoPTemplate::dividingByN, QualityMetric::ELEMENT_BASED, PatchData::get_adjacent_vertex_indices(), PatchData::get_element_array(), QualityMetric::get_metric_type(), ObjectiveFunction::get_negate_flag(), ObjectiveFunction::get_quality_metric(), PatchData::get_vertex_array(), PatchData::get_vertex_index(), MsqMeshEntity::get_vertex_index_array(), i, MsqError::INVALID_ARG, MsqError::INVALID_MESH, MsqError::INVALID_STATE, MSQ_CHKERR, MSQ_ERRZERO, MSQ_FUNCTION_TIMER, Mesquite::MSQ_MAX_NUM_VERT_PER_ENT, MSQ_SETERR, PatchData::num_elements(), PatchData::num_vertices(), p1, LPtoPTemplate::pVal, QualityMetric::VERTEX_BASED, and MsqMeshEntity::vertex_count().
|
protectedvirtual |
Fills an array of Vector3D, grad, with the gradient of the objective function computed using the gradient of the quality metric. If the function has not been over-riden in the concrete Objective Function, the base class implementation prints a warning and then defaults to numerical gradient. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'.
patch | The PatchData object for which the objective function gradient is computed. |
grad | An array of Vector3D, at least the size of the number of vertices in the patch. |
OF_val | is set to the value of the objective function. |
array_size | is the size of the grad Vector3D[] array and must correspond to the number of vertices in the patch. |
Reimplemented from ObjectiveFunction.
|
protectedvirtual |
Fills a MsqHessian object with the Hessian of the objective function computed using the hessian of the quality metric. If the function has not been over-riden in the concrete Objective Function, the base class implementation prints a warning and returns false. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'.
Reimplemented from ObjectiveFunction.
Definition at line 368 of file ObjectiveFunction/LPtoPTemplate.cpp.
References MsqHessian::accumulate_entries(), QualityMetric::compute_element_hessian(), LPtoPTemplate::dividingByN, PatchData::get_element_array(), ObjectiveFunction::get_negate_flag(), ObjectiveFunction::get_quality_metric(), PatchData::get_vertex_array(), MsqMeshEntity::get_vertex_index_array(), i, MsqError::INVALID_MESH, MsqError::INVALID_STATE, MsqVertex::is_free_vertex(), j, MSQ_CHKERR, MSQ_ERRZERO, MSQ_FUNCTION_TIMER, Mesquite::MSQ_MAX_NUM_VERT_PER_ENT, MSQ_SETERR, n, PatchData::num_elements(), PatchData::num_vertices(), LPtoPTemplate::pVal, v, MsqMeshEntity::vertex_count(), and MsqHessian::zero_out().
|
protectedvirtual |
Fills a MsqHessian object with the Hessian of the objective function computed using the hessian of the quality metric. If the function has not been over-riden in the concrete Objective Function, the base class implementation prints a warning and returns false. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'.
Reimplemented from ObjectiveFunction.
|
private |
|
inlineprivate |
Definition at line 110 of file includeLinks/LPtoPTemplate.hpp.
References LPtoPTemplate::dividingByN, MsqError::INVALID_ARG, MSQ_SETERR, and LPtoPTemplate::pVal.
Referenced by LPtoPTemplate::concrete_evaluate().
Evaluate the objective function on a given patch.
Implements ObjectiveFunction.
Evaluate the objective function on a given patch.
Implements ObjectiveFunction.
Definition at line 64 of file ObjectiveFunction/LPtoPTemplate.cpp.
References LPtoPTemplate::compute_function(), QualityMetric::ELEMENT_BASED, QualityMetric::evaluate_element(), QualityMetric::evaluate_vertex(), PatchData::get_element_array(), QualityMetric::get_metric_type(), ObjectiveFunction::get_quality_metric(), ObjectiveFunction::get_quality_metric_list(), PatchData::get_vertex_array(), MsqError::INVALID_STATE, MSQ_CHKERR, MSQ_DBGOUT, MSQ_ERRZERO, MSQ_SETERR, PatchData::num_elements(), PatchData::num_vertices(), LPtoPTemplate::pVal, and QualityMetric::VERTEX_BASED.
|
inline |
Use set_dividing_by_n to control whether this objective function divides it's final value by the number of metric values used to compute the objective function value. That is, if the associated metric is element based, the obejctive function value is divided by the number of elements. If it is vertex based, the objective function is divided by the number of vertices. If this function is passed 'true', the function value will be scale. If it is passed false, the function value will not be scaled.
Definition at line 85 of file includeLinks/LPtoPTemplate.hpp.
References LPtoPTemplate::dividingByN.
|
inline |
Use set_dividing_by_n to control whether this objective function divides it's final value by the number of metric values used to compute the objective function value. That is, if the associated metric is element based, the obejctive function value is divided by the number of elements. If it is vertex based, the objective function is divided by the number of vertices. If this function is passed 'true', the function value will be scale. If it is passed false, the function value will not be scaled.
Definition at line 85 of file src/ObjectiveFunction/LPtoPTemplate.hpp.
References LPtoPTemplate::dividingByN.
|
private |
dividingByN is true if we are dividing the objective function by the number of metric values.
Definition at line 107 of file includeLinks/LPtoPTemplate.hpp.
Referenced by LPtoPTemplate::compute_analytical_gradient(), LPtoPTemplate::compute_analytical_hessian(), LPtoPTemplate::compute_function(), LPtoPTemplate::LPtoPTemplate(), and LPtoPTemplate::set_dividing_by_n().
|
private |
The metric value entries are raised to the pVal power.
Definition at line 104 of file includeLinks/LPtoPTemplate.hpp.
Referenced by LPtoPTemplate::compute_analytical_gradient(), LPtoPTemplate::compute_analytical_hessian(), LPtoPTemplate::compute_function(), LPtoPTemplate::concrete_evaluate(), and LPtoPTemplate::LPtoPTemplate().