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

2D Geometric Metric Base Class More...

#include <Geometric_Metrics_2.h>

Inheritance diagram for Geo_Metric_Base_2:
Collaboration diagram for Geo_Metric_Base_2:

Public Member Functions

 Geo_Metric_Base_2 ()
 Constructor. More...
 
virtual void initialize (Vector_3< double > n[], int type)
 Initialize a 2D Geometric Metric. More...
 
virtual void initialize (Element_node_enumerator &ene)
 
virtual double maxValue () const
 The maximum value for this metric. More...
 
virtual double minValue () const
 The minimum value for this metric. More...
 
- Public Member Functions inherited from Metric
 Metric ()
 
virtual ~Metric ()
 
virtual void compute (double atts[]) const =0
 Compute the value of this metric. More...
 

Protected Member Functions

void compute_angles (double &min, double &max) const
 Compute the min and max angles. More...
 
void compute_aspects (double &R, double &r, double &l) const
 Compute the circumradius, inradius, and shortest edge length. More...
 

Protected Attributes

Vector_3< double > v [4]
 
int type_
 

Detailed Description

2D Geometric Metric Base Class

This class is the base class for the implementation of various 2D geometric element quality metrics.

Definition at line 41 of file Geometric_Metrics_2.h.

Constructor & Destructor Documentation

Geo_Metric_Base_2 ( )
inline

Constructor.

Definition at line 46 of file Geometric_Metrics_2.h.

46 {}

Member Function Documentation

void compute_angles ( double &  min,
double &  max 
) const
protected

Compute the min and max angles.

Definition at line 76 of file Geometric_Metrics_2.C.

References angle(), min_max3(), min_max4(), and v.

76  {
77  if (type_ == COM::Connectivity::TRI3){
78  double a1,a2,a3;
79  a1= angle(v[0],v[2]); a2= angle(v[1],v[3]); a3= angle(v[2],v[3]);
80  min_max3(a1,a2,a3,min,max);
81  }
82  if (type_ == COM::Connectivity::QUAD4){
83  double a1,a2,a3,a4;
84  a1 = angle (v[0],v[1]); a2 = angle (v[0],v[2]);
85  a3 = angle (v[2],v[3]); a4 = angle (v[1],v[3]);
86  min_max4(a1,a2,a3,a4,min,max);
87  }
88 }
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
Vector_3< double > v[4]
void min_max4(double a1, double a2, double a3, double a4, double &min, double &max)
Find minimum and maximum of 4 numbers.
Definition: geometry.C:41
MOP_BEGIN_NAMESPACE void min_max3(double a1, double a2, double a3, double &min, double &max)
Find minimum and maximum of 3 numbers.
Definition: geometry.C:36
double angle(Vector_3< double > v1, Vector_3< double > v2)
Compute the angle between two vectors.
Definition: geometry.C:61
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346

Here is the call graph for this function:

void compute_aspects ( double &  R,
double &  r,
double &  l 
) const
protected

Compute the circumradius, inradius, and shortest edge length.

Definition at line 90 of file Geometric_Metrics_2.C.

References edge_length(), sqrt(), and v.

90  {
91  // Defined for Triangles only
92  assert (type_ == COM::Connectivity::TRI3);
93 
94  double a = edge_length(v[0]);
95  double b = edge_length(v[2]);
96  double c = edge_length(v[3]);
97 
98  // Use formulas from mathworld to find circumradius (R),
99  // inradius (r), and shortest edge length (l)
100 
101  l = ( a < b )? a : b;
102  l = ( l < c ) ? l : c;
103  R = (a*b*c) / sqrt( (a+b+c)*(b+c-a)*(c+a-b)*(a+b-c) );
104  r = .5*sqrt( ((b+c-a)*(c+a-b)*(a+b-c))/(a+b+c) );
105 
106 }
Vector_3< double > v[4]
double sqrt(double d)
Definition: double.h:73
double edge_length(const Vector_3< double > &v)
Compute the edge length of a vector.
Definition: geometry.C:89

Here is the call graph for this function:

void initialize ( Vector_3< double >  n[],
int  type 
)
virtual

Initialize a 2D Geometric Metric.

Parameters
n[]Ordered set of nodal coordinates.
typeElement type: TRI or QUAD

Implements Metric.

Definition at line 65 of file Geometric_Metrics_2.C.

References v.

Referenced by main().

66  {
67  type_ = type;
68  if (type_ == COM::Connectivity::TRI3){
69  v[0]= n[2]-n[1]; v[1]= n[1]-n[2]; v[2]= n[2]-n[0]; v[3]= n[1]-n[0];
70  }
71  else if (type_ == COM::Connectivity::QUAD4){
72  v[0]= n[1]-n[0]; v[1]= n[3]-n[0]; v[2]= n[1]-n[2]; v[3]= n[3] - n[2];
73  }
74 }
Vector_3< double > v[4]

Here is the caller graph for this function:

void initialize ( Element_node_enumerator ene)
virtual

Implements Metric.

Definition at line 46 of file Geometric_Metrics_2.C.

References COM_assertion_msg, n, and v.

46  {
47  type_ = ene.type();
48  Element_node_vectors_k_const<double> n;
49  n.set(ene.pane()->attribute("nc"),ene);
50  if(type_ == COM::Connectivity::TRI3){
51  v[0][0]=n(2,0)-n(1,0); v[0][1]=n(2,1)-n(1,1); v[0][2]=n(2,2)-n(1,2);
52  v[1][0]=n(1,0)-n(2,0); v[1][1]=n(1,1)-n(2,1); v[1][2]=n(1,2)-n(2,2);
53  v[2][0]=n(2,0)-n(0,0); v[2][1]=n(2,1)-n(0,1); v[2][2]=n(2,2)-n(0,2);
54  v[3][0]=n(1,0)-n(0,0); v[3][1]=n(1,1)-n(0,1); v[3][2]=n(1,2)-n(0,2);
55  }
56  else if (type_ == COM::Connectivity::QUAD4){
57  v[0][0]=n(1,0)-n(0,0); v[0][1]=n(1,1)-n(0,1); v[0][2]=n(1,2)-n(0,2);
58  v[1][0]=n(3,0)-n(0,0); v[1][1]=n(3,1)-n(0,1); v[1][2]=n(3,2)-n(0,2);
59  v[2][0]=n(1,0)-n(2,0); v[2][1]=n(1,1)-n(2,1); v[2][2]=n(1,2)-n(2,2);
60  v[3][0]=n(3,0)-n(2,0); v[3][1]=n(3,1)-n(2,1); v[3][2]=n(3,2)-n(2,2);
61  }
62  else COM_assertion_msg(0,"Element type not supported for 2D geometric metrics");
63 }
#define COM_assertion_msg(EX, msg)
Vector_3< double > v[4]
const NT & n
virtual double maxValue ( ) const
inlinevirtual

The maximum value for this metric.

Implements Metric.

Reimplemented in Aspect_Metric_2, and Angle_Metric_2.

Definition at line 58 of file Geometric_Metrics_2.h.

58 { return 1.0; }
virtual double minValue ( ) const
inlinevirtual

The minimum value for this metric.

Implements Metric.

Reimplemented in Aspect_Metric_2, and Angle_Metric_2.

Definition at line 61 of file Geometric_Metrics_2.h.

61 { return 0.0; }

Member Data Documentation

int type_
protected

Definition at line 73 of file Geometric_Metrics_2.h.

Vector_3<double> v[4]
protected

Definition at line 72 of file Geometric_Metrics_2.h.


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