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

Computes the local size metric for a given vertex. More...

#include <LocalSizeQualityMetric.hpp>

Inheritance diagram for LocalSizeQualityMetric:
Collaboration diagram for LocalSizeQualityMetric:

Public Member Functions

 LocalSizeQualityMetric ()
 
virtual ~LocalSizeQualityMetric ()
 
 LocalSizeQualityMetric ()
 
virtual ~LocalSizeQualityMetric ()
 
- Public Member Functions inherited from VolumeQualityMetric
virtual ~VolumeQualityMetric ()
 
virtual ~VolumeQualityMetric ()
 
- 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_element (PatchData &, MsqMeshEntity *, double &, MsqError &err)
 Evaluate the metric for an element. 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_element (PatchData &, MsqMeshEntity *, double &, MsqError &err)
 Evaluate the metric for an element. 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

bool evaluate_vertex (PatchData &pd, MsqVertex *vert, double &fval, MsqError &err)
 For the given vertex, vert, calculate the local size metric value. More...
 
bool evaluate_vertex (PatchData &pd, MsqVertex *vert, double &fval, MsqError &err)
 For the given vertex, vert, calculate the local size metric value. 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)
 

Private Member Functions

double compute_corner_area (PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, MsqError &err)
 Calculate the area of the triangle formed by the three vertices. More...
 
double compute_corner_volume (PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, size_t vert_4, MsqError &err)
 Calculate the volume of the tetrahedron formed by the four vertices. More...
 
double compute_corner_area (PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, MsqError &err)
 Calculate the area of the triangle formed by the three vertices. More...
 
double compute_corner_volume (PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, size_t vert_4, MsqError &err)
 Calculate the volume of the tetrahedron formed by the four vertices. More...
 

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

Computes the local size metric for a given vertex.

LocalSizeQualityMetric is a vertex based metric which computes the corner volume (or area) for the element corners attached to a given element. Then these volumes (or areas) are averaged together. The default averaging method is QualityMetric::RMS.

Definition at line 61 of file includeLinks/LocalSizeQualityMetric.hpp.

Constructor & Destructor Documentation

Definition at line 65 of file includeLinks/LocalSizeQualityMetric.hpp.

References QualityMetric::avgMethod, QualityMetric::feasible, QualityMetric::RMS, QualityMetric::set_metric_type(), QualityMetric::set_name(), and QualityMetric::VERTEX_BASED.

66  {
67  avgMethod=RMS;
68  feasible=0;
70  set_name("Local Size Quality Metric");
71  }
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 ~LocalSizeQualityMetric ( )
inlinevirtual

Definition at line 74 of file includeLinks/LocalSizeQualityMetric.hpp.

75  {}

Definition at line 65 of file src/QualityMetric/Volume/LocalSizeQualityMetric.hpp.

References QualityMetric::avgMethod, QualityMetric::feasible, QualityMetric::RMS, QualityMetric::set_metric_type(), QualityMetric::set_name(), and QualityMetric::VERTEX_BASED.

66  {
67  avgMethod=RMS;
68  feasible=0;
70  set_name("Local Size Quality Metric");
71  }
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 ~LocalSizeQualityMetric ( )
inlinevirtual

Definition at line 74 of file src/QualityMetric/Volume/LocalSizeQualityMetric.hpp.

75  {}

Member Function Documentation

double compute_corner_area ( PatchData pd,
size_t  vert_1,
size_t  vert_2,
size_t  vert_3,
MsqError err 
)
inlineprivate

Calculate the area of the triangle formed by the three vertices.

Definition at line 97 of file includeLinks/LocalSizeQualityMetric.hpp.

References PatchData::get_vertex_array(), and Vector3D::length().

Referenced by LocalSizeQualityMetric::evaluate_vertex().

102  {
103  MsqVertex* verts = pd.get_vertex_array(err);
104  Vector3D vec_1=verts[vert_2]-verts[vert_1];
105  Vector3D vec_2=verts[vert_3]-verts[vert_1];
106  Vector3D cross_vec=vec_1*vec_2;
107  return (cross_vec.length()/2.0);
108  }
NVec< 3, double > Vector3D

Here is the call graph for this function:

Here is the caller graph for this function:

double compute_corner_area ( PatchData pd,
size_t  vert_1,
size_t  vert_2,
size_t  vert_3,
MsqError err 
)
inlineprivate

Calculate the area of the triangle formed by the three vertices.

double compute_corner_volume ( PatchData pd,
size_t  vert_1,
size_t  vert_2,
size_t  vert_3,
size_t  vert_4,
MsqError err 
)
inlineprivate

Calculate the volume of the tetrahedron formed by the four vertices.

double compute_corner_volume ( PatchData pd,
size_t  vert_1,
size_t  vert_2,
size_t  vert_3,
size_t  vert_4,
MsqError err 
)
inlineprivate

Calculate the volume of the tetrahedron formed by the four vertices.

Definition at line 111 of file includeLinks/LocalSizeQualityMetric.hpp.

References PatchData::get_vertex_array().

Referenced by LocalSizeQualityMetric::evaluate_vertex().

117  {
118  MsqVertex* verts = pd.get_vertex_array(err);
119  Vector3D vec_1=verts[vert_2]-verts[vert_1];
120  Vector3D vec_2=verts[vert_3]-verts[vert_1];
121  Vector3D vec_3=verts[vert_4]-verts[vert_1];
122  return fabs((vec_3%(vec_1*vec_2))/6.0);
123 
124  }
NVec< 3, double > Vector3D

Here is the call graph for this function:

Here is the caller graph for this function:

bool evaluate_vertex ( PatchData pd,
MsqVertex vert,
double &  fval,
MsqError err 
)
protectedvirtual

For the given vertex, vert, calculate the local size metric value.

Reimplemented from QualityMetric.

bool evaluate_vertex ( PatchData pd,
MsqVertex vert,
double &  fval,
MsqError err 
)
protectedvirtual

For the given vertex, vert, calculate the local size metric value.

For the given vertex, vert, with connected elements, e_i for i=1...K, the LocalSizeQualityMetric computes the corner volumes (or areas) of each e_i at the corner defined by vert. The corner volume is defined as the volume of the tet defined by the edges of an element which contain the common vertex, vert. That volume is then diveded by the average corner volume of all the element corners connected to this vertex. For vertices attached to pyramid elements, this metric is undefined.

Reimplemented from QualityMetric.

Definition at line 61 of file QualityMetric/Volume/LocalSizeQualityMetric.cpp.

References QualityMetric::average_metrics(), LocalSizeQualityMetric::compute_corner_area(), LocalSizeQualityMetric::compute_corner_volume(), MsqMeshEntity::get_connected_vertices(), PatchData::get_element_array(), PatchData::get_vertex_element_adjacencies(), PatchData::get_vertex_index(), i, MsqError::INTERNAL_ERROR, MSQ_ERRZERO, and MSQ_SETERR.

63 {
64  fval=0.0;
65  //get the element array
66  MsqMeshEntity* elems = pd.get_element_array(err); MSQ_ERRZERO(err);
67  //conver the MsqVertex pointer into an index
68  size_t this_vert = pd.get_vertex_index(vert);
69  //get the vertex to element array and the offset array
70  //const size_t* elem_offset = pd.get_vertex_to_elem_offset(err); MSQ_ERRZERO(err);
71  //const size_t* v_to_e_array = pd.get_vertex_to_elem_array(err); MSQ_ERRZERO(err);
72  //find the offset for this vertex
73  //size_t this_offset = elem_offset[this_vert];
74  //get the number of elements attached to this vertex (given by the
75  //first entry in the vertex to element array)
76  //size_t num_elems = v_to_e_array[this_offset];
77  //PRINT_INFO("\nIN LOCAL SIZE CPP, num_elements = %i",num_elems);
78  size_t num_elems, *v_to_e_array;
79  v_to_e_array = pd.get_vertex_element_adjacencies( this_vert, num_elems, err );
80  MSQ_ERRZERO(err);
81 
82  if(num_elems <= 0){
83  return true;
84  }
85 
86  //create an array to store the local metric values before averaging
87  //Can we remove this dynamic allocatio?
88  double* met_vals = new double[num_elems];
89  //vector to hold the other verts which form a corner.
90  vector<size_t> other_vertices;
91  other_vertices.reserve(4);
92  double total_val=0.0;
93  size_t i=0;
94  //loop over the elements attached to this vertex
95  for(i=0;i<num_elems;++i){
96  //get the vertices which (with this_vert) form the corner of
97  //the ith element.
98  elems[v_to_e_array[i]].get_connected_vertices(this_vert,
99  other_vertices,
100  err); MSQ_ERRZERO(err);
102 
103  switch(other_vertices.size()){
104  //if a surface element, compute the corner area
105  case 2:
106  met_vals[i] = compute_corner_area(pd, this_vert, other_vertices[0],
107  other_vertices[1], err); MSQ_ERRZERO(err);
108  break;
109  //if a volume element, compute the corner volume
110  case 3:
111  met_vals[i] = compute_corner_volume(pd, this_vert, other_vertices[0],
112  other_vertices[1],
113  other_vertices[2], err); MSQ_ERRZERO(err);
114  break;
115  default:
116  //otherwise, there is was an error. Either the wrong number
117  //of vertices were returned fom get_connected_vertices or
118  //the element does not have the correct number of edges
119  //connected to this vertex (possibly a pyramid element).
120  met_vals[i]=0.0;
121  MSQ_SETERR(err)("Incorrect number of vertices returned from "
122  "get_connected_vertices.", MsqError::INTERNAL_ERROR);
123  };
124  //keep track of total so that we can compute the linear average
125  total_val+=met_vals[i];
126  //PRINT_INFO("\nIN LOCAL SIZE CPP, total_val = %f, i = %i",total_val,i);
127  //clear the vector of other_vertices for re-use.
128  other_vertices.clear();
129  //PRINT_INFO("\nIN LOCAL SIZE CPP, after clean size = %f",other_vertices.size());
130 
131  }
132  //calculate the linear average... num_elems is non-zero here.
133  total_val /= (double) num_elems;
134  //PRINT_INFO("\nIN LOCAL SIZE CPP, average = %f",total_val);
135  //if the average is non-zero
136  //divide each entry by the linear average
137  if(total_val!=0){
138  for(i=0;i<num_elems;++i){
139  met_vals[i]/=total_val;
140  }
141  //calculate fval by averaging the corner values
142  fval = average_metrics(met_vals, num_elems, err); MSQ_ERRZERO(err);
143  //PRINT_INFO("\nIN LOCAL SIZE CPP, inside if statement");
144  }
145  //PRINT_INFO("\nIN LOCAL SIZE CPP, fval = %f",fval);
146  //clean up the dynamically allocated array
147  delete []met_vals;
148  //always return true... the vertex position is never invalid
149  return true;
150 
151 }
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
double compute_corner_area(PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, MsqError &err)
Calculate the area of the triangle formed by the three vertices.
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
size_t get_vertex_index(MsqVertex *vertex)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
void get_connected_vertices(msq_stdc::size_t vertex_index, msq_std::vector< msq_stdc::size_t > &vert_indices, MsqError &err)
Fills a vector&lt;size_t&gt; with vertices connected to the given vertex through the edges of this MsqMeshE...
double compute_corner_volume(PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, size_t vert_4, MsqError &err)
Calculate the volume of the tetrahedron formed by the four vertices.
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 ...
const MsqMeshEntity * get_element_array(MsqError &err) const
Returns a pointer to the start of the element array.
size_t * get_vertex_element_adjacencies(size_t vertex_index, size_t &array_len_out, MsqError &err)

Here is the call graph for this function:


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