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

The untangle beta quality metric. More...

#include <UntangleBetaQualityMetric.hpp>

Inheritance diagram for UntangleBetaQualityMetric:
Collaboration diagram for UntangleBetaQualityMetric:

Public Member Functions

 UntangleBetaQualityMetric (double bet=0.05)
 For untangle beta, the constructor defaults to the SUM averaging method, and to the ELEMENT_VERTICES evaluation mode. More...
 
virtual ~UntangleBetaQualityMetric ()
 
bool evaluate_element (PatchData &pd, MsqMeshEntity *element, double &fval, MsqError &err)
 
void set_beta (double beta_in)
 
double get_beta ()
 
 UntangleBetaQualityMetric (double bet=0.05)
 
virtual ~UntangleBetaQualityMetric ()
 
bool evaluate_element (PatchData &pd, MsqMeshEntity *element, double &fval, MsqError &err)
 
void set_beta (double beta_in)
 
double get_beta ()
 
- Public Member Functions inherited from UntangleQualityMetric
virtual ~UntangleQualityMetric ()
 
virtual ~UntangleQualityMetric ()
 
- 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)
 

Protected Member Functions

void untangle_function_2d (Vector3D temp_vec[], size_t e_ind, PatchData &pd, double &fval, MsqError &err)
 
void untangle_function_3d (Vector3D temp_vec[], double &fval, MsqError &err)
 
void untangle_function_2d (Vector3D temp_vec[], size_t e_ind, PatchData &pd, double &fval, MsqError &err)
 
void untangle_function_3d (Vector3D temp_vec[], double &fval, MsqError &err)
 
- 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)
 

Private Attributes

double mBeta
 

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 Attributes inherited from QualityMetric
AveragingMethod avgMethod
 
int feasible
 
msq_std::string metricName
 

Detailed Description

The untangle beta quality metric.

Given a scalar value beta and local signed element volume alpha_i, define delta_i to be alpha_i minus beta. The Untangle beta value is then defined as square root of the sum over sample points of the absolute value of delta_i minus delta_i, difference squared. That is, the root mean square of the difference, abs(delta_i) minus delta_i.

The constructor defaults to RMS AveragingMethod and ELEMENT_VERTICES evaluationMode. The default beta value is .05.

Definition at line 60 of file includeLinks/UntangleBetaQualityMetric.hpp.

Constructor & Destructor Documentation

UntangleBetaQualityMetric ( double  bet = 0.05)

For untangle beta, the constructor defaults to the SUM averaging method, and to the ELEMENT_VERTICES evaluation mode.

Definition at line 53 of file QualityMetric/Untangle/UntangleBetaQualityMetric.cpp.

References QualityMetric::avgMethod, QualityMetric::ELEMENT_BASED, QualityMetric::ELEMENT_VERTICES, QualityMetric::feasible, UntangleBetaQualityMetric::mBeta, MSQ_CHKERR, QualityMetric::NUMERICAL_GRADIENT, QualityMetric::RMS, QualityMetric::set_element_evaluation_mode(), QualityMetric::set_gradient_type(), QualityMetric::set_metric_type(), and QualityMetric::set_name().

54 {
55  MsqError err;
59  feasible=0;
60  set_name("Untangle Beta");
62  mBeta=bet;
63 }
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_gradient_type(GRADIENT_TYPE grad)
Sets gradType for this metric.
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 ~UntangleBetaQualityMetric ( )
inlinevirtual

Definition at line 67 of file includeLinks/UntangleBetaQualityMetric.hpp.

68  {}
UntangleBetaQualityMetric ( double  bet = 0.05)
virtual ~UntangleBetaQualityMetric ( )
inlinevirtual

Definition at line 67 of file src/QualityMetric/Untangle/UntangleBetaQualityMetric.hpp.

68  {}

Member Function Documentation

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

Evaluate the Untangle Beta metric value for an element.

Todo:
This function needs to be modified so that it no longer uses compute_weighted_jacobian. It also needs to set an error whenever sent a 2D element and the surface normal information is not available.

Evaluate the Untangle Beta value of the MsqMeshEntity pointed to by 'element'.

Reimplemented from QualityMetric.

Definition at line 67 of file QualityMetric/Untangle/UntangleBetaQualityMetric.cpp.

References QualityMetric::average_metrics(), PatchData::get_element_index(), 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, MSQ_SETERR, Mesquite::MSQ_SQRT_THREE, Mesquite::MSQ_SQRT_THREE_INV, Mesquite::MSQ_SQRT_TWO, MsqError::NOT_IMPLEMENTED, Mesquite::QUADRILATERAL, Mesquite::TETRAHEDRON, Mesquite::TRIANGLE, UntangleBetaQualityMetric::untangle_function_2d(), and UntangleBetaQualityMetric::untangle_function_3d().

70  {
71 
72  double met_vals[MSQ_MAX_NUM_VERT_PER_ENT];
73  fval=MSQ_MAX_CAP;
74  const size_t* v_i = element->get_vertex_index_array();
75  size_t e_ind = pd.get_element_index(element);
76  //only 3 temp_vec will be sent to untangle calculator, but the
77  //additional vector3Ds may be needed during the calculations
78  Vector3D temp_vec[6];
79  MsqVertex *vertices=pd.get_vertex_array(err); MSQ_ERRZERO(err);
80  switch(element->get_element_type()){
81  case TRIANGLE:
82  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
83  temp_vec[2]=vertices[v_i[2]]-vertices[v_i[0]];
84  //make relative to equilateral
85  temp_vec[1]=((2*temp_vec[2])-temp_vec[0])*MSQ_SQRT_THREE_INV;
86  untangle_function_2d(temp_vec,e_ind,pd,fval,err);
87  return true;
88  case QUADRILATERAL:
89  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
90  temp_vec[1]=vertices[v_i[3]]-vertices[v_i[0]];
91  untangle_function_2d(temp_vec,e_ind,pd,met_vals[0],err); MSQ_ERRZERO(err);
92 
93  temp_vec[0]=vertices[v_i[2]]-vertices[v_i[1]];
94  temp_vec[1]=vertices[v_i[0]]-vertices[v_i[1]];
95  untangle_function_2d(temp_vec,e_ind,pd,met_vals[1],err); MSQ_ERRZERO(err);
96 
97  temp_vec[0]=vertices[v_i[3]]-vertices[v_i[2]];
98  temp_vec[1]=vertices[v_i[1]]-vertices[v_i[2]];
99  untangle_function_2d(temp_vec,e_ind,pd,met_vals[2],err); MSQ_ERRZERO(err);
100 
101  temp_vec[0]=vertices[v_i[0]]-vertices[v_i[3]];
102  temp_vec[1]=vertices[v_i[2]]-vertices[v_i[3]];
103  untangle_function_2d(temp_vec,e_ind,pd,met_vals[3],err); MSQ_ERRZERO(err);
104  fval=average_metrics(met_vals, 4, err); MSQ_ERRZERO(err);
105  return true;
106  case TETRAHEDRON:
107  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
108  temp_vec[3]=vertices[v_i[2]]-vertices[v_i[0]];
109  temp_vec[4]=vertices[v_i[3]]-vertices[v_i[0]];
110  //transform to equilateral tet
111  temp_vec[1]=((2*temp_vec[3])-temp_vec[0])/MSQ_SQRT_THREE;
112  temp_vec[2]=((3*temp_vec[4])-temp_vec[0]-temp_vec[3])/
114  untangle_function_3d(temp_vec,fval,err); MSQ_ERRZERO(err);
115  return true;
116  case HEXAHEDRON:
117  //transform to v_i[0]
118  temp_vec[0]=vertices[v_i[1]]-vertices[v_i[0]];
119  temp_vec[1]=vertices[v_i[3]]-vertices[v_i[0]];
120  temp_vec[2]=vertices[v_i[4]]-vertices[v_i[0]];
121  untangle_function_3d(temp_vec,met_vals[0],err); MSQ_ERRZERO(err);
122 
123  temp_vec[0]=vertices[v_i[2]]-vertices[v_i[1]];
124  temp_vec[1]=vertices[v_i[0]]-vertices[v_i[1]];
125  temp_vec[2]=vertices[v_i[5]]-vertices[v_i[1]];
126  untangle_function_3d(temp_vec,met_vals[1],err); MSQ_ERRZERO(err);
127 
128  temp_vec[0]=vertices[v_i[3]]-vertices[v_i[2]];
129  temp_vec[1]=vertices[v_i[1]]-vertices[v_i[2]];
130  temp_vec[2]=vertices[v_i[6]]-vertices[v_i[2]];
131  untangle_function_3d(temp_vec,met_vals[2],err); MSQ_ERRZERO(err);
132 
133  temp_vec[0]=vertices[v_i[0]]-vertices[v_i[3]];
134  temp_vec[1]=vertices[v_i[2]]-vertices[v_i[3]];
135  temp_vec[2]=vertices[v_i[7]]-vertices[v_i[3]];
136  untangle_function_3d(temp_vec,met_vals[3],err); MSQ_ERRZERO(err);
137 
138  temp_vec[0]=vertices[v_i[7]]-vertices[v_i[4]];
139  temp_vec[1]=vertices[v_i[5]]-vertices[v_i[4]];
140  temp_vec[2]=vertices[v_i[0]]-vertices[v_i[4]];
141  untangle_function_3d(temp_vec,met_vals[4],err); MSQ_ERRZERO(err);
142 
143  temp_vec[0]=vertices[v_i[4]]-vertices[v_i[5]];
144  temp_vec[1]=vertices[v_i[6]]-vertices[v_i[5]];
145  temp_vec[2]=vertices[v_i[1]]-vertices[v_i[5]];
146  untangle_function_3d(temp_vec,met_vals[5],err); MSQ_ERRZERO(err);
147 
148  temp_vec[0]=vertices[v_i[5]]-vertices[v_i[6]];
149  temp_vec[1]=vertices[v_i[7]]-vertices[v_i[6]];
150  temp_vec[2]=vertices[v_i[2]]-vertices[v_i[6]];
151  untangle_function_3d(temp_vec,met_vals[6],err); MSQ_ERRZERO(err);
152 
153  temp_vec[0]=vertices[v_i[6]]-vertices[v_i[7]];
154  temp_vec[1]=vertices[v_i[4]]-vertices[v_i[7]];
155  temp_vec[2]=vertices[v_i[3]]-vertices[v_i[7]];
156  untangle_function_3d(temp_vec,met_vals[7],err); MSQ_ERRZERO(err);
157  fval=average_metrics(met_vals, 8, err); MSQ_ERRZERO(err);
158  return true;
159  default:
160  MSQ_SETERR(err)("Element of incorrect type sent to "
161  "UntangleBetaQualityMetric",
163  return false;
164  }// end switch over element type
165 
166 
167 }
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
const double MSQ_MAX_CAP
Definition: Mesquite.hpp:173
void untangle_function_3d(Vector3D temp_vec[], double &fval, MsqError &err)
requested functionality is not (yet) implemented
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
size_t get_element_index(MsqMeshEntity *element)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
void untangle_function_2d(Vector3D temp_vec[], size_t e_ind, PatchData &pd, double &fval, MsqError &err)
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 the Untangle Beta metric value for an element.

Todo:
This function needs to be modified so that it no longer uses compute_weighted_jacobian. It also needs to set an error whenever sent a 2D element and the surface normal information is not available.

Reimplemented from QualityMetric.

double get_beta ( )
inline

Function to allow the user to check the value of beta.

Definition at line 82 of file src/QualityMetric/Untangle/UntangleBetaQualityMetric.hpp.

References UntangleBetaQualityMetric::mBeta.

double get_beta ( )
inline

Function to allow the user to check the value of beta.

Definition at line 82 of file includeLinks/UntangleBetaQualityMetric.hpp.

References UntangleBetaQualityMetric::mBeta.

void set_beta ( double  beta_in)
inline

Function to allow users to set the beta value after the metric has already been created.

Definition at line 79 of file includeLinks/UntangleBetaQualityMetric.hpp.

References UntangleBetaQualityMetric::mBeta.

void set_beta ( double  beta_in)
inline

Function to allow users to set the beta value after the metric has already been created.

Definition at line 79 of file src/QualityMetric/Untangle/UntangleBetaQualityMetric.hpp.

References UntangleBetaQualityMetric::mBeta.

void untangle_function_2d ( Vector3D  temp_vec[],
size_t  e_ind,
PatchData pd,
double &  fval,
MsqError err 
)
inlineprotected

Definition at line 98 of file includeLinks/UntangleBetaQualityMetric.hpp.

References PatchData::get_domain_normal_at_element(), Vector3D::length(), UntangleBetaQualityMetric::mBeta, and MSQ_ERRRTN.

Referenced by UntangleBetaQualityMetric::evaluate_element().

99  {
100  Vector3D surface_normal;
101  pd.get_domain_normal_at_element(e_ind,surface_normal,err); MSQ_ERRRTN(err);
102  Vector3D cross_vec=temp_vec[0]*temp_vec[1];
103  //cout<<"\nsurface_normal "<<surface_normal;
104  //cout<<"\cross_vec "<<cross_vec;
105  double temp_var=cross_vec.length();
106  if(cross_vec%surface_normal<0.0){
107  temp_var*=-1;
108  }
109  temp_var -= mBeta;
110  //cout<<"temp_var == "<<temp_var;
111  fval=0.0;
112  if(temp_var<0.0){
113  fval=fabs(temp_var)-temp_var;
114  }
115  // cout<<"\nfval == "<<fval<<" e_ind "<<e_ind;
116  }
NVec< 3, double > Vector3D
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

void untangle_function_2d ( Vector3D  temp_vec[],
size_t  e_ind,
PatchData pd,
double &  fval,
MsqError err 
)
inlineprotected
void untangle_function_3d ( Vector3D  temp_vec[],
double &  fval,
MsqError err 
)
inlineprotected
void untangle_function_3d ( Vector3D  temp_vec[],
double &  fval,
MsqError err 
)
inlineprotected

Definition at line 118 of file includeLinks/UntangleBetaQualityMetric.hpp.

References UntangleBetaQualityMetric::mBeta.

Referenced by UntangleBetaQualityMetric::evaluate_element().

119  {
120  double temp_var=temp_vec[0]%(temp_vec[1]*temp_vec[2]);
121  temp_var-=mBeta;
122  fval=0.0;
123  if(temp_var<0.0){
124  fval=fabs(temp_var)-temp_var;
125  }
126  }

Here is the caller graph for this function:

Member Data Documentation


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