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

Object for computing the aspect ratio gamma of simplicial elements. More...

#include <AspectRatioGammaQualityMetric.hpp>

Inheritance diagram for AspectRatioGammaQualityMetric:
Collaboration diagram for AspectRatioGammaQualityMetric:

Public Member Functions

 AspectRatioGammaQualityMetric ()
 
virtual ~AspectRatioGammaQualityMetric ()
 virtual destructor ensures use of polymorphism during destruction More...
 
 AspectRatioGammaQualityMetric ()
 
virtual ~AspectRatioGammaQualityMetric ()
 virtual destructor ensures use of polymorphism during destruction 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)
 

Private Member Functions

bool evaluate_element (PatchData &pd, MsqMeshEntity *element, double &fval, MsqError &err)
 Computes the aspect ratio gamma of element. More...
 
bool evaluate_element (PatchData &pd, MsqMeshEntity *element, double &fval, MsqError &err)
 Computes the aspect ratio gamma of element. More...
 

Private Attributes

double fourDivRootThree
 
double twelveDivRootTwo
 

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

Object for computing the aspect ratio gamma of simplicial elements.

Definition at line 50 of file includeLinks/AspectRatioGammaQualityMetric.hpp.

Constructor & Destructor Documentation

Definition at line 53 of file includeLinks/AspectRatioGammaQualityMetric.hpp.

References QualityMetric::ELEMENT_BASED, QualityMetric::ELEMENT_VERTICES, QualityMetric::feasible, AspectRatioGammaQualityMetric::fourDivRootThree, QualityMetric::set_element_evaluation_mode(), QualityMetric::set_metric_type(), QualityMetric::set_name(), sqrt(), and AspectRatioGammaQualityMetric::twelveDivRootTwo.

54  {
55  MsqError err;
58  fourDivRootThree=4.0/sqrt(3.0);
59  twelveDivRootTwo=12.0/sqrt(2.0);
60  feasible=0;
61  set_name("Aspect Ratio Gamma");
62  }
double sqrt(double d)
Definition: double.h:73
void set_element_evaluation_mode(ElementEvaluationMode mode, MsqError &err)
Sets the evaluation mode for the ELEMENT_BASED metrics.
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 ~AspectRatioGammaQualityMetric ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 64 of file includeLinks/AspectRatioGammaQualityMetric.hpp.

65  {}

Definition at line 53 of file src/QualityMetric/Shape/AspectRatioGammaQualityMetric.hpp.

References QualityMetric::ELEMENT_BASED, QualityMetric::ELEMENT_VERTICES, QualityMetric::feasible, AspectRatioGammaQualityMetric::fourDivRootThree, QualityMetric::set_element_evaluation_mode(), QualityMetric::set_metric_type(), QualityMetric::set_name(), sqrt(), and AspectRatioGammaQualityMetric::twelveDivRootTwo.

54  {
55  MsqError err;
58  fourDivRootThree=4.0/sqrt(3.0);
59  twelveDivRootTwo=12.0/sqrt(2.0);
60  feasible=0;
61  set_name("Aspect Ratio Gamma");
62  }
double sqrt(double d)
Definition: double.h:73
void set_element_evaluation_mode(ElementEvaluationMode mode, MsqError &err)
Sets the evaluation mode for the ELEMENT_BASED metrics.
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 ~AspectRatioGammaQualityMetric ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 64 of file src/QualityMetric/Shape/AspectRatioGammaQualityMetric.hpp.

65  {}

Member Function Documentation

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

Computes the aspect ratio gamma of element.

Evaluate aspect ratio gamma on ``element''.

If element is not a tetrahedron or triangle, sets an error.

Reimplemented from QualityMetric.

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

References AspectRatioGammaQualityMetric::fourDivRootThree, PatchData::get_element_index(), MsqMeshEntity::get_element_type(), PatchData::get_element_vertex_coordinates(), MsqError::INVALID_ARG, Mesquite::length(), Vector3D::length_squared(), MSQ_ERRZERO, Mesquite::MSQ_MAX_CAP, Mesquite::MSQ_MIN, MSQ_SETERR, sqrt(), Mesquite::TETRAHEDRON, Mesquite::TRIANGLE, and AspectRatioGammaQualityMetric::twelveDivRootTwo.

58 {
59  EntityTopology entity = element->get_element_type();
60  double vol=0;
61  Vector3D temp_vec(0,0,0);
62  bool return_val = true;
63 
64  //get element's nodes
65  vector<Vector3D> vert;
66  size_t elem_index = pd.get_element_index(element);
67  pd.get_element_vertex_coordinates(elem_index, vert, err); MSQ_ERRZERO(err);
68 
69  switch(entity)
70  {
71  case TRIANGLE:
72  //area
73  vol=(((vert[1]-vert[0])*(vert[2]-vert[0])).length())/2.0;
74  vol=fabs(vol);
75  if(vol<MSQ_MIN){
76  fval=MSQ_MAX_CAP;
77  }
78  else{
79  //sum of edges squared
80  temp_vec=vert[1]-vert[0];
81  fval=temp_vec.length_squared();
82  temp_vec=vert[2]-vert[0];
83  fval+=temp_vec.length_squared();
84  temp_vec=vert[1]-vert[2];
85  fval+=temp_vec.length_squared();
86  //average sum of edges squared
87  fval/=3.0;
88  //normalize to equil. and div by area
89  // 2.309... is 4/sqrt(3) (inverse of the area of an equil. tri
90  fval/=(vol*fourDivRootThree);
91  }
92 
93  break;
94  case TETRAHEDRON:
95  vol=(vert[1]-vert[0])%((vert[2]-vert[0])*(vert[3]-vert[0]))/6.0;
96  //sum of edges squared
97  if(fabs(vol)<MSQ_MIN){
98  fval=MSQ_MAX_CAP;
99  }
100  else{
101  temp_vec=vert[1]-vert[0];
102  fval=temp_vec.length_squared();
103  temp_vec=vert[2]-vert[0];
104  fval+=temp_vec.length_squared();
105  temp_vec=vert[3]-vert[0];
106  fval+=temp_vec.length_squared();
107  temp_vec=vert[2]-vert[1];
108  fval+=temp_vec.length_squared();
109  temp_vec=vert[3]-vert[1];
110  fval+=temp_vec.length_squared();
111  temp_vec=vert[3]-vert[2];
112  fval+=temp_vec.length_squared();
113  //average sum of edges squared
114  fval/=6.0;
115  fval=sqrt(fval);
116  fval*=(fval);
117  fval*=(fval);
118  //normalize to equil. and div by area
119  fval/=(vol*twelveDivRootTwo);
120  }
121  break;
122  default:
123  fval=MSQ_MAX_CAP;
125  "Entity type %d is not valid for Aspect Ratio Gamma\n",
126  (int)entity);
127  return_val = false;
128  break;
129  };
130 
131  return return_val;
132 }
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
const double MSQ_MAX_CAP
Definition: Mesquite.hpp:173
EntityTopology
Definition: Mesquite.hpp:92
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
double sqrt(double d)
Definition: double.h:73
double length(Vector3D *const v, int n)
invalid function argument passed
size_t get_element_index(MsqMeshEntity *element)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
EntityTopology get_element_type() const
Returns element type.
void get_element_vertex_coordinates(size_t elem_index, msq_std::vector< Vector3D > &coords, MsqError &err)
Get the coordinates of vertices attached to the specified element.
const double MSQ_MIN
Definition: Mesquite.hpp:160

Here is the call graph for this function:

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

Computes the aspect ratio gamma of element.

If element is not a tetrahedron or triangle, sets an error.

Reimplemented from QualityMetric.

Member Data Documentation


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