38 #ifndef GeneralizedConditionNumberQualityMetric_hpp
39 #define GeneralizedConditionNumberQualityMetric_hpp
43 #include "MsqMeshEntity.hpp"
44 #include "MsqError.hpp"
46 #include "Vector3D.hpp"
47 #include "PatchData.hpp"
83 int num_jacobian_vectors,
91 PatchData &pd, MsqMeshEntity *element,
Vector3D* jacobian_vectors,
92 int num_jacobian_vectors,
double &fval, MsqError &err)
96 if(num_jacobian_vectors==2){
97 size_t vert=element->get_vertex_index(0);
98 Vector3D cross_vec=jacobian_vectors[0]*jacobian_vectors[1];
99 if ( pd.domain_set() ) {
101 pd.get_domain_normal_at_vertex(vert,
false,norm_vec,err);
MSQ_ERRZERO(err);
102 if(cross_vec%norm_vec<0.0){
107 temp_var=fabs((cross_vec).
length());
108 fval=jacobian_vectors[0].length_squared();
109 fval+=jacobian_vectors[1].length_squared();
111 fval/=(2.0*temp_var);
120 else if(num_jacobian_vectors==3){
122 double term1=jacobian_vectors[0]%jacobian_vectors[0]+
123 jacobian_vectors[1]%jacobian_vectors[1]+
124 jacobian_vectors[2]%jacobian_vectors[2];
126 double term2=(jacobian_vectors[0]*jacobian_vectors[1])%
127 (jacobian_vectors[0]*jacobian_vectors[1])+
128 (jacobian_vectors[1]*jacobian_vectors[2])%
129 (jacobian_vectors[1]*jacobian_vectors[2])+
130 (jacobian_vectors[2]*jacobian_vectors[0])%
131 (jacobian_vectors[2]*jacobian_vectors[0]);
133 temp_var=jacobian_vectors[0]%(jacobian_vectors[1]*jacobian_vectors[2]);
138 fval=
sqrt(term1*term2);
158 #endif // GeneralizedConditionNumberQualityMetric_hpp
GeneralizedConditionNumberQualityMetric()
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
Used to hold the error state and return it to the application.
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
double length(Vector3D *const v, int n)
NVec< 3, double > Vector3D
bool evaluate_element(PatchData &pd, MsqMeshEntity *element, double &fval, MsqError &err)
evaluate using mesquite objects
bool evaluate_vertex(PatchData &pd, MsqVertex *vertex, double &fval, MsqError &err)
Evaluate the "condition number" for a vertex.
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
Parent class for the Shape Quality Metrics.
virtual ~GeneralizedConditionNumberQualityMetric()
virtual destructor ensures use of polymorphism during destruction
bool compute_condition_number(PatchData &pd, MsqMeshEntity *elem, Vector3D *jacobian_vectors, int num_jacobian_vectors, double &fval, MsqError &err)