Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConditionNumberQualityMetric Class Reference

Computes the condition number of given element. More...

#include <ConditionNumberQualityMetric.hpp>

Inheritance diagram for ConditionNumberQualityMetric:
Collaboration diagram for ConditionNumberQualityMetric:

Public Member Functions

 ConditionNumberQualityMetric ()
 
virtual ~ConditionNumberQualityMetric ()
 virtual destructor ensures use of polymorphism during destruction More...
 
bool evaluate_element (PatchData &pd, MsqMeshEntity *element, double &fval, MsqError &err)
 evaluate using mesquite objects More...
 
 ConditionNumberQualityMetric ()
 
virtual ~ConditionNumberQualityMetric ()
 virtual destructor ensures use of polymorphism during destruction More...
 
bool evaluate_element (PatchData &pd, MsqMeshEntity *element, double &fval, MsqError &err)
 evaluate using mesquite objects More...
 
- Public Member Functions inherited from ShapeQualityMetric
virtual ~ShapeQualityMetric ()
 virtual destructor ensures use of polymorphism during destruction More...
 
virtual ~ShapeQualityMetric ()
 virtual destructor ensures use of polymorphism during destruction More...
 
- Public Member Functions inherited from QualityMetric
virtual ~QualityMetric ()
 
MetricType get_metric_type ()
 
void set_element_evaluation_mode (ElementEvaluationMode mode, MsqError &err)
 Sets the evaluation mode for the ELEMENT_BASED metrics. More...
 
ElementEvaluationMode get_element_evaluation_mode ()
 Returns the evaluation mode for the metric. More...
 
void set_averaging_method (AveragingMethod method, MsqError &err)
 
void set_feasible_constraint (int alpha)
 
int get_feasible_constraint ()
 Returns the feasible flag for this metric. More...
 
void set_name (msq_std::string st)
 Sets the name of this metric. More...
 
msq_std::string get_name ()
 Returns the name of this metric (as a string). More...
 
double vertex_barrier_function (double det, double delta)
 Escobar Barrier Function for Shape and Other Metrics. More...
 
virtual bool evaluate_vertex (PatchData &, MsqVertex *, double &, MsqError &err)
 Evaluate the metric for a vertex. More...
 
void set_gradient_type (GRADIENT_TYPE grad)
 Sets gradType for this metric. More...
 
void set_hessian_type (HESSIAN_TYPE ht)
 Sets hessianType for this metric. More...
 
bool compute_vertex_gradient (PatchData &pd, MsqVertex &vertex, MsqVertex *vertices[], Vector3D grad_vec[], int num_vtx, double &metric_value, MsqError &err)
 Calls compute_vertex_numerical_gradient if gradType equals NUMERCIAL_GRADIENT. Calls compute_vertex_analytical_gradient if gradType equals ANALYTICAL_GRADIENT;. More...
 
bool compute_element_gradient (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 For MetricType == ELEMENT_BASED. Calls either compute_element_numerical_gradient() or compute_element_analytical_gradient() for gradType equal NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT, respectively. More...
 
bool compute_element_gradient_expanded (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 
bool compute_element_hessian (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], Matrix3D hessian[], int num_free_vtx, double &metric_value, MsqError &err)
 For MetricType == ELEMENT_BASED. Calls either compute_element_numerical_hessian() or compute_element_analytical_hessian() for hessianType equal NUMERICAL_HESSIAN or ANALYTICAL_HESSIAN, respectively. More...
 
void set_negate_flag (int neg)
 
int get_negate_flag ()
 Returns negateFlag. More...
 
virtual void change_metric_type (MetricType t, MsqError &err)
 
virtual ~QualityMetric ()
 
MetricType get_metric_type ()
 
void set_element_evaluation_mode (ElementEvaluationMode mode, MsqError &err)
 Sets the evaluation mode for the ELEMENT_BASED metrics. More...
 
ElementEvaluationMode get_element_evaluation_mode ()
 Returns the evaluation mode for the metric. More...
 
void set_averaging_method (AveragingMethod method, MsqError &err)
 
void set_feasible_constraint (int alpha)
 
int get_feasible_constraint ()
 Returns the feasible flag for this metric. More...
 
void set_name (msq_std::string st)
 Sets the name of this metric. More...
 
msq_std::string get_name ()
 Returns the name of this metric (as a string). More...
 
double vertex_barrier_function (double det, double delta)
 Escobar Barrier Function for Shape and Other Metrics. More...
 
virtual bool evaluate_vertex (PatchData &, MsqVertex *, double &, MsqError &err)
 Evaluate the metric for a vertex. More...
 
void set_gradient_type (GRADIENT_TYPE grad)
 Sets gradType for this metric. More...
 
void set_hessian_type (HESSIAN_TYPE ht)
 Sets hessianType for this metric. More...
 
bool compute_vertex_gradient (PatchData &pd, MsqVertex &vertex, MsqVertex *vertices[], Vector3D grad_vec[], int num_vtx, double &metric_value, MsqError &err)
 
bool compute_element_gradient (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 For MetricType == ELEMENT_BASED. Calls either compute_element_numerical_gradient() or compute_element_analytical_gradient() for gradType equal NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT, respectively. More...
 
bool compute_element_gradient_expanded (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 
bool compute_element_hessian (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], Matrix3D hessian[], int num_free_vtx, double &metric_value, MsqError &err)
 For MetricType == ELEMENT_BASED. Calls either compute_element_numerical_hessian() or compute_element_analytical_hessian() for hessianType equal NUMERICAL_HESSIAN or ANALYTICAL_HESSIAN, respectively. More...
 
void set_negate_flag (int neg)
 
int get_negate_flag ()
 Returns negateFlag. More...
 
virtual void change_metric_type (MetricType t, MsqError &err)
 

Additional Inherited Members

- Public Types inherited from QualityMetric
enum  MetricType {
  MT_UNDEFINED, VERTEX_BASED, ELEMENT_BASED, VERTEX_BASED_FREE_ONLY,
  MT_UNDEFINED, VERTEX_BASED, ELEMENT_BASED, VERTEX_BASED_FREE_ONLY
}
 
enum  ElementEvaluationMode {
  EEM_UNDEFINED, ELEMENT_VERTICES, LINEAR_GAUSS_POINTS, QUADRATIC_GAUSS_POINTS,
  CUBIC_GAUSS_POINTS, EEM_UNDEFINED, ELEMENT_VERTICES, LINEAR_GAUSS_POINTS,
  QUADRATIC_GAUSS_POINTS, CUBIC_GAUSS_POINTS
}
 
enum  AveragingMethod {
  NONE, LINEAR, RMS, HMS,
  MINIMUM, MAXIMUM, HARMONIC, GEOMETRIC,
  SUM, SUM_SQUARED, GENERALIZED_MEAN, STANDARD_DEVIATION,
  MAX_OVER_MIN, MAX_MINUS_MIN, SUM_OF_RATIOS_SQUARED, NONE,
  LINEAR, RMS, HMS, MINIMUM,
  MAXIMUM, HARMONIC, GEOMETRIC, SUM,
  SUM_SQUARED, GENERALIZED_MEAN, STANDARD_DEVIATION, MAX_OVER_MIN,
  MAX_MINUS_MIN, SUM_OF_RATIOS_SQUARED
}
 
enum  GRADIENT_TYPE { NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT, NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT }
 
enum  HESSIAN_TYPE { NUMERICAL_HESSIAN, ANALYTICAL_HESSIAN, NUMERICAL_HESSIAN, ANALYTICAL_HESSIAN }
 
enum  MetricType {
  MT_UNDEFINED, VERTEX_BASED, ELEMENT_BASED, VERTEX_BASED_FREE_ONLY,
  MT_UNDEFINED, VERTEX_BASED, ELEMENT_BASED, VERTEX_BASED_FREE_ONLY
}
 
enum  ElementEvaluationMode {
  EEM_UNDEFINED, ELEMENT_VERTICES, LINEAR_GAUSS_POINTS, QUADRATIC_GAUSS_POINTS,
  CUBIC_GAUSS_POINTS, EEM_UNDEFINED, ELEMENT_VERTICES, LINEAR_GAUSS_POINTS,
  QUADRATIC_GAUSS_POINTS, CUBIC_GAUSS_POINTS
}
 
enum  AveragingMethod {
  NONE, LINEAR, RMS, HMS,
  MINIMUM, MAXIMUM, HARMONIC, GEOMETRIC,
  SUM, SUM_SQUARED, GENERALIZED_MEAN, STANDARD_DEVIATION,
  MAX_OVER_MIN, MAX_MINUS_MIN, SUM_OF_RATIOS_SQUARED, NONE,
  LINEAR, RMS, HMS, MINIMUM,
  MAXIMUM, HARMONIC, GEOMETRIC, SUM,
  SUM_SQUARED, GENERALIZED_MEAN, STANDARD_DEVIATION, MAX_OVER_MIN,
  MAX_MINUS_MIN, SUM_OF_RATIOS_SQUARED
}
 
enum  GRADIENT_TYPE { NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT, NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT }
 
enum  HESSIAN_TYPE { NUMERICAL_HESSIAN, ANALYTICAL_HESSIAN, NUMERICAL_HESSIAN, ANALYTICAL_HESSIAN }
 
- Protected Member Functions inherited from ShapeQualityMetric
bool condition_number_2d (Vector3D temp_vec[], size_t v_ind, PatchData &pd, double &fval, MsqError &err)
 Given the 2-d jacobian matrix, compute the condition number, fval. More...
 
bool condition_number_3d (Vector3D temp_vec[], PatchData &pd, double &fval, MsqError &err)
 Given the 3-d jacobian matrix, compute the condition number, fval. More...
 
bool condition_number_2d (Vector3D temp_vec[], size_t v_ind, PatchData &pd, double &fval, MsqError &err)
 Given the 2-d jacobian matrix, compute the condition number, fval. More...
 
bool condition_number_3d (Vector3D temp_vec[], PatchData &pd, double &fval, MsqError &err)
 Given the 3-d jacobian matrix, compute the condition number, fval. More...
 
- Protected Member Functions inherited from QualityMetric
 QualityMetric ()
 
void set_metric_type (MetricType t)
 This function should be used in the constructor of every concrete quality metric. More...
 
double average_metrics (const double metric_values[], const int &num_values, MsqError &err)
 average_metrics takes an array of length num_values and averages the contents using averaging method data member avgMethod . More...
 
double average_metric_and_weights (double metric_values[], int num_metric_values, MsqError &err)
 Given a list of metric values, calculate the average metric valude according to the current avgMethod and write into the passed metric_values array the the value weight/count to use when averaging gradient vectors for the metric. More...
 
double weighted_average_metrics (const double coef[], const double metric_values[], const int &num_values, MsqError &err)
 takes an array of coefficients and an array of metrics (both of length num_value) and averages the contents using averaging method 'method'. More...
 
bool compute_vertex_numerical_gradient (PatchData &pd, MsqVertex &vertex, MsqVertex *vertices[], Vector3D grad_vec[], int num_vtx, double &metric_value, MsqError &err)
 
bool compute_element_numerical_gradient (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 Non-virtual function which numerically computes the gradient of a QualityMetric of a given element for a given set of free vertices on that element. This is used by metric which mType is ELEMENT_BASED. For parameters, see compute_element_gradient() . More...
 
virtual bool compute_vertex_analytical_gradient (PatchData &pd, MsqVertex &vertex, MsqVertex *vertices[], Vector3D grad_vec[], int num_vtx, double &metric_value, MsqError &err)
 Virtual function that computes the gradient of the QualityMetric analytically. The base class implementation of this function simply prints a warning and calls compute_numerical_gradient to calculate the gradient. This is used by metric which mType is VERTEX_BASED. More...
 
virtual bool compute_element_analytical_gradient (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 Virtual function that computes the gradient of the QualityMetric analytically. The base class implementation of this function simply prints a warning and calls compute_numerical_gradient to calculate the gradient. This is used by metric which mType is ELEMENT_BASED. For parameters, see compute_element_gradient() . More...
 
bool compute_element_numerical_hessian (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], Matrix3D hessian[], int num_free_vtx, double &metric_value, MsqError &err)
 
virtual bool compute_element_analytical_hessian (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], Matrix3D hessian[], int num_free_vtx, double &metric_value, MsqError &err)
 
 QualityMetric ()
 
void set_metric_type (MetricType t)
 This function should be used in the constructor of every concrete quality metric. More...
 
double average_metrics (const double metric_values[], const int &num_values, MsqError &err)
 average_metrics takes an array of length num_values and averages the contents using averaging method data member avgMethod . More...
 
double average_metric_and_weights (double metric_values[], int num_metric_values, MsqError &err)
 Given a list of metric values, calculate the average metric valude according to the current avgMethod and write into the passed metric_values array the the value weight/count to use when averaging gradient vectors for the metric. More...
 
double weighted_average_metrics (const double coef[], const double metric_values[], const int &num_values, MsqError &err)
 takes an array of coefficients and an array of metrics (both of length num_value) and averages the contents using averaging method 'method'. More...
 
bool compute_vertex_numerical_gradient (PatchData &pd, MsqVertex &vertex, MsqVertex *vertices[], Vector3D grad_vec[], int num_vtx, double &metric_value, MsqError &err)
 
bool compute_element_numerical_gradient (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 Non-virtual function which numerically computes the gradient of a QualityMetric of a given element for a given set of free vertices on that element. This is used by metric which mType is ELEMENT_BASED. For parameters, see compute_element_gradient() . More...
 
virtual bool compute_vertex_analytical_gradient (PatchData &pd, MsqVertex &vertex, MsqVertex *vertices[], Vector3D grad_vec[], int num_vtx, double &metric_value, MsqError &err)
 Virtual function that computes the gradient of the QualityMetric analytically. The base class implementation of this function simply prints a warning and calls compute_numerical_gradient to calculate the gradient. This is used by metric which mType is VERTEX_BASED. More...
 
virtual bool compute_element_analytical_gradient (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], int num_free_vtx, double &metric_value, MsqError &err)
 Virtual function that computes the gradient of the QualityMetric analytically. The base class implementation of this function simply prints a warning and calls compute_numerical_gradient to calculate the gradient. This is used by metric which mType is ELEMENT_BASED. For parameters, see compute_element_gradient() . More...
 
bool compute_element_numerical_hessian (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], Matrix3D hessian[], int num_free_vtx, double &metric_value, MsqError &err)
 
virtual bool compute_element_analytical_hessian (PatchData &pd, MsqMeshEntity *element, MsqVertex *free_vtces[], Vector3D grad_vec[], Matrix3D hessian[], int num_free_vtx, double &metric_value, MsqError &err)
 
- Protected Attributes inherited from QualityMetric
AveragingMethod avgMethod
 
int feasible
 
msq_std::string metricName
 

Detailed Description

Computes the condition number of given element.

The metric does not use the sample point functionality or the compute_weighted_jacobian. It evaluates the metric at the element vertices, and uses the isotropic ideal element. It does require a feasible region, and the metric needs to be minimized.

Definition at line 57 of file includeLinks/ConditionNumberQualityMetric.hpp.

Constructor & Destructor Documentation

Definition at line 43 of file QualityMetric/Shape/ConditionNumberQualityMetric.cpp.

References QualityMetric::avgMethod, QualityMetric::ELEMENT_BASED, QualityMetric::ELEMENT_VERTICES, QualityMetric::feasible, QualityMetric::LINEAR, MSQ_CHKERR, QualityMetric::set_element_evaluation_mode(), QualityMetric::set_metric_type(), and QualityMetric::set_name().

44 {
45  MsqError err;
49  feasible=1;
50  set_name("Condition Number");
51 }
Used to hold the error state and return it to the application.
void set_element_evaluation_mode(ElementEvaluationMode mode, MsqError &err)
Sets the evaluation mode for the ELEMENT_BASED metrics.
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.
void set_metric_type(MetricType t)
This function should be used in the constructor of every concrete quality metric. ...
void set_name(msq_std::string st)
Sets the name of this metric.

Here is the call graph for this function:

virtual ~ConditionNumberQualityMetric ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 63 of file includeLinks/ConditionNumberQualityMetric.hpp.

64  {}
virtual ~ConditionNumberQualityMetric ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 63 of file src/QualityMetric/Shape/ConditionNumberQualityMetric.hpp.

64  {}

Member Function Documentation

bool evaluate_element ( PatchData pd,
MsqMeshEntity element,
double &  fval,
MsqError err 
)
virtual

evaluate using mesquite objects

Reimplemented from QualityMetric.

Definition at line 54 of file QualityMetric/Shape/ConditionNumberQualityMetric.cpp.

References QualityMetric::average_metrics(), ShapeQualityMetric::condition_number_2d(), ShapeQualityMetric::condition_number_3d(), MsqMeshEntity::get_element_type(), PatchData::get_vertex_array(), MsqMeshEntity::get_vertex_index_array(), Mesquite::HEXAHEDRON, MSQ_ERRZERO, Mesquite::MSQ_MAX_CAP, Mesquite::MSQ_MAX_NUM_VERT_PER_ENT, Mesquite::MSQ_SQRT_THREE, Mesquite::MSQ_SQRT_THREE_INV, Mesquite::MSQ_SQRT_TWO, Mesquite::QUADRILATERAL, Mesquite::TETRAHEDRON, and Mesquite::TRIANGLE.

58 {
59  bool return_flag;
60  double met_vals[MSQ_MAX_NUM_VERT_PER_ENT];
61  fval=MSQ_MAX_CAP;
62  const size_t* v_i = element->get_vertex_index_array();
63  //only 3 temp_vec will be sent to cond-num calculator, but the
64  //additional vector3Ds may be needed during the calculations
65  Vector3D temp_vec[6];
66  MsqVertex *vertices=pd.get_vertex_array(err);
67  switch(element->get_element_type()){
68  case TRIANGLE:
69  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
70  temp_vec[2]=vertices[v_i[2]]-vertices[v_i[0]];
71  //make relative to equilateral
72  temp_vec[1]=((2*temp_vec[2])-temp_vec[0])*MSQ_SQRT_THREE_INV;
73  return_flag=condition_number_2d(temp_vec,v_i[0],pd,fval,err); MSQ_ERRZERO(err);
74  return return_flag;
75  case QUADRILATERAL:
76  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
77  temp_vec[1]=vertices[v_i[3]]-vertices[v_i[0]];
78  return_flag=condition_number_2d(temp_vec,v_i[0],pd,met_vals[0],err); MSQ_ERRZERO(err);
79  if(!return_flag)
80  return return_flag;
81  temp_vec[0]=vertices[v_i[2]]-vertices[v_i[1]];
82  temp_vec[1]=vertices[v_i[0]]-vertices[v_i[1]];
83  return_flag=condition_number_2d(temp_vec,v_i[1],pd,met_vals[1],err); MSQ_ERRZERO(err);
84  if(!return_flag)
85  return return_flag;
86  temp_vec[0]=vertices[v_i[3]]-vertices[v_i[2]];
87  temp_vec[1]=vertices[v_i[1]]-vertices[v_i[2]];
88  return_flag=condition_number_2d(temp_vec,v_i[2],pd,met_vals[2],err); MSQ_ERRZERO(err);
89  if(!return_flag)
90  return return_flag;
91  temp_vec[0]=vertices[v_i[0]]-vertices[v_i[3]];
92  temp_vec[1]=vertices[v_i[2]]-vertices[v_i[3]];
93  return_flag=condition_number_2d(temp_vec,v_i[3],pd,met_vals[3],err); MSQ_ERRZERO(err);
94  fval = average_metrics(met_vals, 4, err);
95  return return_flag;
96  case TETRAHEDRON:
97  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
98  temp_vec[3]=vertices[v_i[2]]-vertices[v_i[0]];
99  temp_vec[4]=vertices[v_i[3]]-vertices[v_i[0]];
100  //transform to equilateral tet
101  temp_vec[1]=((2*temp_vec[3])-temp_vec[0])/MSQ_SQRT_THREE;
102  temp_vec[2]=((3*temp_vec[4])-temp_vec[0]-temp_vec[3])/
104  return_flag=condition_number_3d(temp_vec,pd,fval,err); MSQ_ERRZERO(err);
105  return return_flag;
106  /*
107  case PYRAMID:
108  //We compute the pyramid's "condition number" by averaging
109  //the 4 tet's condition numbers, where the tets are created
110  //by removing one of the four base vertices from the pyramid.
111  //transform to origina v_i[0]
112  temp_vec[3]=vertices[v_i[1]]-vertices[v_i[0]];
113  temp_vec[4]=vertices[v_i[3]]-vertices[v_i[0]];
114  temp_vec[5]=vertices[v_i[4]]-vertices[v_i[0]];
115  //find AW_inverse
116  temp_vec[0]=temp_vec[3];
117  temp_vec[1]=temp_vec[4]-temp_vec[3];
118  temp_vec[2]=MSQ_SQRT_TWO*(temp_vec[5]-(temp_vec[4]/2.0));
119  return_flag=condition_number_3d(temp_vec,pd,met_vals[0],err);
120  if(!return_flag)
121  return return_flag;
122  //transform to origina v_i[1]
123  temp_vec[3]=vertices[v_i[2]]-vertices[v_i[1]];
124  temp_vec[4]=vertices[v_i[3]]-vertices[v_i[1]];
125  temp_vec[5]=vertices[v_i[4]]-vertices[v_i[1]];
126  //find AW_inverse
127  temp_vec[0]=temp_vec[3]-temp_vec[4];
128  temp_vec[1]=temp_vec[3];
129  temp_vec[2]=MSQ_SQRT_TWO*(temp_vec[5]-(temp_vec[4]/2.0));
130  return_flag=condition_number_3d(temp_vec,pd,met_vals[1],err);
131  if(!return_flag)
132  return return_flag;
133  //transform to origina v_i[1]
134  temp_vec[3]=vertices[v_i[3]]-vertices[v_i[2]];
135  temp_vec[4]=vertices[v_i[0]]-vertices[v_i[2]];
136  temp_vec[5]=vertices[v_i[4]]-vertices[v_i[2]];
137  //find AW_inverse
138  temp_vec[0]=-temp_vec[3];
139  temp_vec[1]=temp_vec[3]-temp_vec[4];
140  temp_vec[2]=MSQ_SQRT_TWO*(temp_vec[5]-(temp_vec[4]/2.0));
141  return_flag=condition_number_3d(temp_vec,pd,met_vals[2],err);
142  if(!return_flag)
143  return return_flag;
144  //transform to origina v_i[1]
145  temp_vec[3]=vertices[v_i[0]]-vertices[v_i[3]];
146  temp_vec[4]=vertices[v_i[1]]-vertices[v_i[3]];
147  temp_vec[5]=vertices[v_i[4]]-vertices[v_i[3]];
148  //find AW_inverse
149  temp_vec[0]=temp_vec[4]-temp_vec[3];
150  temp_vec[1]=-temp_vec[3];
151  temp_vec[2]=MSQ_SQRT_TWO*(temp_vec[5]-(temp_vec[4]/2.0));
152  return_flag=condition_number_3d(temp_vec,pd,met_vals[3],err);
153  fval=average_metrics(met_vals, 4, err);
154  if(!return_flag)
155  return return_flag;
156  break;
157  */
158  case HEXAHEDRON:
159  //transform to v_i[0]
160  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
161  temp_vec[1]=vertices[v_i[3]]-vertices[v_i[0]];
162  temp_vec[2]=vertices[v_i[4]]-vertices[v_i[0]];
163  return_flag=condition_number_3d(temp_vec,pd,met_vals[0],err); MSQ_ERRZERO(err);
164  if(!return_flag)
165  return return_flag;
166  temp_vec[0]=vertices[v_i[2]]-vertices[v_i[1]];
167  temp_vec[1]=vertices[v_i[0]]-vertices[v_i[1]];
168  temp_vec[2]=vertices[v_i[5]]-vertices[v_i[1]];
169  return_flag=condition_number_3d(temp_vec,pd,met_vals[1],err); MSQ_ERRZERO(err);
170  if(!return_flag)
171  return return_flag;
172  temp_vec[0]=vertices[v_i[3]]-vertices[v_i[2]];
173  temp_vec[1]=vertices[v_i[1]]-vertices[v_i[2]];
174  temp_vec[2]=vertices[v_i[6]]-vertices[v_i[2]];
175  return_flag=condition_number_3d(temp_vec,pd,met_vals[2],err); MSQ_ERRZERO(err);
176  if(!return_flag)
177  return return_flag;
178  temp_vec[0]=vertices[v_i[0]]-vertices[v_i[3]];
179  temp_vec[1]=vertices[v_i[2]]-vertices[v_i[3]];
180  temp_vec[2]=vertices[v_i[7]]-vertices[v_i[3]];
181  return_flag=condition_number_3d(temp_vec,pd,met_vals[3],err); MSQ_ERRZERO(err);
182  if(!return_flag)
183  return return_flag;
184  temp_vec[0]=vertices[v_i[7]]-vertices[v_i[4]];
185  temp_vec[1]=vertices[v_i[5]]-vertices[v_i[4]];
186  temp_vec[2]=vertices[v_i[0]]-vertices[v_i[4]];
187  return_flag=condition_number_3d(temp_vec,pd,met_vals[4],err); MSQ_ERRZERO(err);
188  if(!return_flag)
189  return return_flag;
190  temp_vec[0]=vertices[v_i[4]]-vertices[v_i[5]];
191  temp_vec[1]=vertices[v_i[6]]-vertices[v_i[5]];
192  temp_vec[2]=vertices[v_i[1]]-vertices[v_i[5]];
193  return_flag=condition_number_3d(temp_vec,pd,met_vals[5],err); MSQ_ERRZERO(err);
194  if(!return_flag)
195  return return_flag;
196  temp_vec[0]=vertices[v_i[5]]-vertices[v_i[6]];
197  temp_vec[1]=vertices[v_i[7]]-vertices[v_i[6]];
198  temp_vec[2]=vertices[v_i[2]]-vertices[v_i[6]];
199  return_flag=condition_number_3d(temp_vec,pd,met_vals[6],err); MSQ_ERRZERO(err);
200  if(!return_flag)
201  return return_flag;
202  temp_vec[0]=vertices[v_i[6]]-vertices[v_i[7]];
203  temp_vec[1]=vertices[v_i[4]]-vertices[v_i[7]];
204  temp_vec[2]=vertices[v_i[3]]-vertices[v_i[7]];
205  return_flag=condition_number_3d(temp_vec,pd,met_vals[7],err); MSQ_ERRZERO(err);
206  fval=average_metrics(met_vals, 8, err); MSQ_ERRZERO(err);
207  return return_flag;
208  default:
209  fval=MSQ_MAX_CAP;
210  }// end switch over element type
211  return false;
212 }
bool condition_number_3d(Vector3D temp_vec[], PatchData &pd, double &fval, MsqError &err)
Given the 3-d jacobian matrix, compute the condition number, fval.
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
const double MSQ_MAX_CAP
Definition: Mesquite.hpp:173
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
const int MSQ_MAX_NUM_VERT_PER_ENT
Definition: Mesquite.hpp:120
static const double MSQ_SQRT_TWO
Definition: Mesquite.hpp:122
bool condition_number_2d(Vector3D temp_vec[], size_t v_ind, PatchData &pd, double &fval, MsqError &err)
Given the 2-d jacobian matrix, compute the condition number, fval.
const MsqVertex * get_vertex_array(MsqError &err) const
Returns a pointer to the start of the vertex array.
EntityTopology get_element_type() const
Returns element type.
const msq_stdc::size_t * get_vertex_index_array() const
Very efficient retrieval of vertices indexes (corresponding to the PatchData vertex array)...
static const double MSQ_SQRT_THREE_INV
Definition: Mesquite.hpp:125
double average_metrics(const double metric_values[], const int &num_values, MsqError &err)
average_metrics takes an array of length num_values and averages the contents using averaging method ...
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
static const double MSQ_SQRT_THREE
Definition: Mesquite.hpp:123

Here is the call graph for this function:

bool evaluate_element ( PatchData pd,
MsqMeshEntity element,
double &  fval,
MsqError err 
)
virtual

evaluate using mesquite objects

Reimplemented from QualityMetric.


The documentation for this class was generated from the following files: