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

2D Algebraic Metric Base Class More...

#include <Algebraic_Metrics_2.h>

Inheritance diagram for Alg_Metric_Base_2:
Collaboration diagram for Alg_Metric_Base_2:

Public Member Functions

 Alg_Metric_Base_2 ()
 Constructor. More...
 
virtual ~Alg_Metric_Base_2 ()
 Virtual Destructor. More...
 
virtual void initialize (Vector_3< double > n[], int type)
 Initialize a 2D Algebraic 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

double compute_size (double ref_area=1.) const
 Compute the size metric. More...
 
double compute_shape () const
 Compute the shape metric. More...
 
double compute_skew () const
 Compute the skew metric. More...
 

Protected Attributes

double alpha [4]
 
J_Matrix A [4]
 
Matrix L [4]
 
int type_
 

Friends

std::ostream & operator<< (std::ostream &, const Alg_Metric_Base_2 &)
 

Detailed Description

2D Algebraic Metric Base Class

This class is the base class for the implementation of the specific 2D algebraic metrics defined by Patrick Knupp in "Aglebraic Mesh Quality Metrics for Unstructured Initial Meshes"

Definition at line 42 of file Algebraic_Metrics_2.h.

Constructor & Destructor Documentation

Alg_Metric_Base_2 ( )
inline

Constructor.

Definition at line 48 of file Algebraic_Metrics_2.h.

48 {}
virtual ~Alg_Metric_Base_2 ( )
inlinevirtual

Virtual Destructor.

Although the destructor does nothing, this member function must be declared since the class has other virtual functions.

Definition at line 55 of file Algebraic_Metrics_2.h.

55 {}

Member Function Documentation

double compute_shape ( ) const
protected

Compute the shape metric.

Definition at line 117 of file Algebraic_Metrics_2.C.

References denom, i, and sqrt().

117  {
118  // Triangles
119  if (type_ == COM::Connectivity::TRI3){
120  return sqrt(3.0) * alpha[0] /
121  ( L[0](0,0) + L[0](1,1) - L[0](0,1));
122  }
123 
124  // Quads
125  else{
126  assert (type_ == COM::Connectivity::QUAD4);
127  double denom = 0;
128  for (int i = 0; i < 4; i ++){
129  denom += ( (L[i](0,0) + L[i](1,1))/alpha[i] );
130  }
131  return 8.0/denom;
132  }
133 }
double sqrt(double d)
Definition: double.h:73
blockLoc i
Definition: read.cpp:79
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom

Here is the call graph for this function:

double compute_size ( double  ref_area = 1.) const
protected

Compute the size metric.

Parameters
ref_areathe ideal area for this element.

Definition at line 104 of file Algebraic_Metrics_2.C.

104  {
105  double tau;
106  if (type_ == COM::Connectivity::TRI3){
107  tau = alpha[0]/(2.0*ref_area);
108  return (tau < (1/tau))? tau : (1/tau);
109  }
110  else {
111  assert (type_ == COM::Connectivity::QUAD4);
112  tau = (alpha[0] + alpha[2])/(2*ref_area);
113  return (tau < (1/tau))? tau : (1/tau);
114  }
115 }
double compute_skew ( ) const
protected

Compute the skew metric.

Definition at line 135 of file Algebraic_Metrics_2.C.

References denom, i, and sqrt().

135  {
136  // only defined for quads, so return 1 if triangle
137  if (type_ == COM::Connectivity::TRI3) {
138  return 1;
139  }
140  // flag checks for divide by 0
141  else {
142  double denom = 0;
143  int flag = 0;
144  for (int i = 0; i < 4 ; i++) {
145  if (alpha[i]==0) { flag = 1;}
146  else {
147  denom += ( sqrt ( L[i](0,0) * L[i](1,1)) / alpha[i] );
148  }
149  }
150  if (flag){ return 0; }
151  else { return 4.0/denom; }
152  }
153 }
double sqrt(double d)
Definition: double.h:73
blockLoc i
Definition: read.cpp:79
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom

Here is the call graph for this function:

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

Initialize a 2D Algebraic Metric.

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

Implements Metric.

Definition at line 79 of file Algebraic_Metrics_2.C.

References A, i, j, and v.

Referenced by main().

79  {
80  type_ = type;
81  vector<Vector_3<double> > v(type_);
82  if (type_ == COM::Connectivity::TRI3){
83  for ( int i = 0; i < 3; i ++){
84  v[0] = n[(i+1)%3] - n[i];
85  v[1] = n[(i+2)%3] - n[i];
86  A[i] = J_Matrix(&v[0],2);
87  L[i] ^= A[i];
88  alpha[i] = A[i].det();
89  }
90  }
91  else if (type_ == COM::Connectivity::QUAD4){
92  for ( int i = 0; i < 4; i ++){
93  for (int j = 0; j < 3; j ++){
94  v[0][j] = (n[(i+1)%4][j] - n[i][j]);
95  v[1][j] = (n[(i+3)%4][j] - n[i][j]);
96  }
97  A[i] = J_Matrix(&v[0],2);
98  L[i] ^= A[i];
99  alpha[i] = A[i].det();
100  }
101  }
102 }
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6

Here is the caller graph for this function:

MOP_BEGIN_NAMESPACE void initialize ( Element_node_enumerator ene)
virtual

Implements Metric.

Definition at line 40 of file Algebraic_Metrics_2.C.

References A, COM_assertion_msg, i, j, n, and v.

40  {
41  type_ = ene.type();
42  Element_node_vectors_k_const<double> n;
43  n.set(ene.pane()->attribute("nc"),ene);
44  vector<Vector_3<double> > v(2);
45  if (type_ == COM::Connectivity::TRI3){
46  for ( int i = 0; i < 3; i ++){
47  int i1 = (i+1)%3, i2 = (i+2)%3;
48 
49  v[0][0] = n(i1,0)-n(i,0);
50  v[0][1] = n(i1,1)-n(i,1);
51  v[0][2] = n(i1,2)-n(i,2);
52 
53  v[1][0] = n(i2,0)-n(i,0);
54  v[1][1] = n(i2,1)-n(i,1);
55  v[1][2] = n(i2,2)-n(i,2);
56 
57  A[i] = J_Matrix(&v[0],2);
58  L[i] ^= A[i];
59  alpha[i] = A[i].det();
60  }
61  }
62  else if (type_ == COM::Connectivity::QUAD4){
63  for ( int i = 0; i < 4; i ++){
64  for (int j = 0; j < 3; j ++){
65  int i1 = (i+1)%4, i3 = (i+3)%4;
66 
67  v[0][j] = n(i1,j)-n(i,j);
68  v[1][j] = n(i3,0)-n(i,j);
69  }
70  A[i] = J_Matrix(&v[0],2);
71  L[i] ^= A[i];
72  alpha[i] = A[i].det();
73  }
74  }
75  else COM_assertion_msg(0,"Element type not supported for 2D Algebraic Metrics");
76 }
#define COM_assertion_msg(EX, msg)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
blockLoc i
Definition: read.cpp:79
const NT & n
j indices j
Definition: Indexing.h:6
virtual double maxValue ( ) const
inlinevirtual

The maximum value for this metric.

Implements Metric.

Definition at line 67 of file Algebraic_Metrics_2.h.

Referenced by main().

67 { return 1.0; }

Here is the caller graph for this function:

virtual double minValue ( ) const
inlinevirtual

The minimum value for this metric.

Implements Metric.

Definition at line 70 of file Algebraic_Metrics_2.h.

Referenced by main().

70 { return 0.0; }

Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const Alg_Metric_Base_2 m 
)
friend

Definition at line 175 of file Algebraic_Metrics_2.C.

175  {
176  for(int i =0; i < m.type_; i ++){
177  output << "A[" << i << "]:" << endl << m.A[i];
178  output << "L[" << i << "]:" << endl << m.L[i];
179  output << "alpha"<<i << ": " << m.alpha[i] << endl << endl;
180  }
181  return output;
182 }
blockLoc i
Definition: read.cpp:79

Member Data Documentation

J_Matrix A[4]
protected

Definition at line 88 of file Algebraic_Metrics_2.h.

Referenced by operator<<().

double alpha[4]
protected

Definition at line 87 of file Algebraic_Metrics_2.h.

Referenced by operator<<().

Matrix L[4]
protected

Definition at line 89 of file Algebraic_Metrics_2.h.

Referenced by operator<<().

int type_
protected

Definition at line 90 of file Algebraic_Metrics_2.h.

Referenced by operator<<().


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