37 #ifndef DistanceFromTarget_hpp
38 #define DistanceFromTarget_hpp
41 #include "MsqError.hpp"
42 #include "PatchData.hpp"
43 #include "QualityMetric.hpp"
44 #include "TargetMatrix.hpp"
53 class DistanceFromTarget :
public QualityMetric
75 Matrix3D T[],
size_t num_T,
double c_k[], MsqError &err)
78 elem.compute_corner_matrices(pd, T, num_T, err);
83 int elem_idx = pd.get_element_index(&elem);
84 const TargetMatrix* W = pd.targetMatrices.get_element_corner_tags(&pd, elem_idx, err );
89 for (
size_t i=0;
i<num_T; ++
i) {
91 c_k[
i] = W[
i].get_cK();
101 double delta=pd.get_barrier_delta(err);
MSQ_ERRZERO(err);
128 h = 0.5*(tau+
sqrt(tau*tau+4*delta*delta));
131 h = delta*delta/fabs(tau); }
140 MSQ_SETERR(err)(
"Barrier function is zero due to excessively large "
141 "negative area compared to delta.\nTry to untangle "
151 #endif // DistanceFromTarget_hpp
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
Used to hold the error state and return it to the application.
virtual ~DistanceFromTarget()
virtual destructor ensures use of polymorphism during destruction
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
void timesInvA(Matrix3D &B, const Matrix3D &A)
void compute_T_matrices(MsqMeshEntity &elem, PatchData &pd, Matrix3D T[], size_t num_T, double c_k[], MsqError &err)
For a given element, compute each corner matrix A, and given a target corner matrix W...
bool get_barrier_function(PatchData &pd, const double &tau, double &h, MsqError &err)