38 #include "MsqVertex.hpp"
39 #include "MsqDebug.hpp"
40 #include "MsqFreeVertexIndexIterator.hpp"
72 if(num_vtx!=array_size && array_size>0)
73 MSQ_DBGOUT(1) <<
"\nArray size not equal to the number of vertices.\n";
87 for (m=0; m<num_vtx; ++m) {
88 if (vertices[m].is_free_vertex()) {
92 bool b =
evaluate(sub_patch,flocal,err);
102 MSQ_SETERR(err)(
"Dividing by zero in Objective Functions numerical grad",
106 grad[m][
j]=(flocald-flocal)/eps;
119 for (m=0; m<num_vtx; ++m) {
121 if (vertices[m].is_free_vertex()) {
134 MSQ_SETERR(err)(
"Dividing by zero in Objective Functions numerical grad",
138 grad[m][
j]=(flocald-flocal)/eps;
166 MSQ_SETERR(err)(
"Analytic hessian not implemented for this Objective "
167 "Function. Feasible Newton algorythm cannot be used.\n",
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.
virtual bool compute_analytical_hessian(PatchData &, MsqHessian &, Vector3D *const &, double &, MsqError &)
Used to hold the error state and return it to the application.
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...
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 get_subpatch(size_t center_vertex_index, PatchData &pd_to_fill, MsqError &err)
Fills a PatchData with the elements attached to a center vertex.
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.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
can be very slow. Should be for tests only.
size_t num_vertices() const
number of vertices in the patch.
const MsqVertex * get_vertex_array(MsqError &err) const
Returns a pointer to the start of the vertex array.
object is in an invalid state
#define MSQ_DBGOUT(flag)
Check debug flag and return ostream associated with flag.
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...