Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
verdict_defines.hpp File Reference
#include <cmath>
#include "v_vector.h"
#include "VerdictVector.hpp"
+ Include dependency graph for verdict_defines.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define VERDICT_MIN(a, b)   ( ( a ) < ( b ) ? ( a ) : ( b ) )
 
#define VERDICT_MAX(a, b)   ( ( a ) > ( b ) ? ( a ) : ( b ) )
 
#define jacobian_matrix(a, b, c, d, e, f, g)
 
#define form_t(m11, m21, m12, m22, mw11, mw21, mw12, mw22, detmw, xm11, xm21, xm12, xm22)
 
#define metric_matrix(m11, m21, m12, m22, gm11, gm12, gm22)
 

Enumerations

enum  VerdictBoolean { VERDICT_FALSE = 0 , VERDICT_TRUE = 1 }
 

Functions

double determinant (double a, double b, double c, double d)
 
double determinant (const VerdictVector &v1, const VerdictVector &v2, const VerdictVector &v3)
 
double normalize_jacobian (double jacobi, VerdictVector &v1, VerdictVector &v2, VerdictVector &v3, int tet_flag=0)
 
double norm_squared (double m11, double m21, double m12, double m22)
 
int skew_matrix (double gm11, double gm12, double gm22, double det, double &qm11, double &qm21, double &qm12, double &qm22)
 
void inverse (const VerdictVector &x1, const VerdictVector &x2, const VerdictVector &x3, VerdictVector &u1, VerdictVector &u2, VerdictVector &u3)
 
void form_Q (const VerdictVector &v1, const VerdictVector &v2, const VerdictVector &v3, VerdictVector &q1, VerdictVector &q2, VerdictVector &q3)
 
void product (VerdictVector &a1, VerdictVector &a2, VerdictVector &a3, VerdictVector &b1, VerdictVector &b2, VerdictVector &b3, VerdictVector &c1, VerdictVector &c2, VerdictVector &c3)
 
double norm_squared (VerdictVector &x1, VerdictVector &x2, VerdictVector &x3)
 
double skew_x (VerdictVector &q1, VerdictVector &q2, VerdictVector &q3, VerdictVector &qw1, VerdictVector &qw2, VerdictVector &qw3)
 

Variables

double verdictSqrt2
 

Macro Definition Documentation

◆ form_t

#define form_t (   m11,
  m21,
  m12,
  m22,
  mw11,
  mw21,
  mw12,
  mw22,
  detmw,
  xm11,
  xm21,
  xm12,
  xm22 
)
Value:
xm11 = ( ( m11 ) * ( mw22 ) - ( m12 ) * ( mw21 ) ) / ( detmw ); \
( xm21 ) = ( ( m21 ) * ( mw22 ) - ( m22 ) * ( mw21 ) ) / ( detmw ); \
( xm12 ) = ( ( m12 ) * ( mw11 ) - ( m11 ) * ( mw12 ) ) / ( detmw ); \
( xm22 ) = ( ( m22 ) * ( mw11 ) - ( m21 ) * ( mw12 ) ) / ( detmw );

Definition at line 67 of file verdict_defines.hpp.

◆ jacobian_matrix

#define jacobian_matrix (   a,
  b,
  c,
  d,
  e,
  f,
 
)
Value:
double jac_mat_tmp; \
jac_mat_tmp = sqrt( a ); \
if( jac_mat_tmp == 0 ) \
{ \
( d ) = 0; \
( e ) = 0; \
( f ) = 0; \
( g ) = 0; \
} \
else \
{ \
( d ) = jac_mat_tmp; \
( e ) = 0; \
( f ) = ( b ) / jac_mat_tmp; \
( g ) = ( c ) / jac_mat_tmp; \
}

Definition at line 48 of file verdict_defines.hpp.

◆ metric_matrix

#define metric_matrix (   m11,
  m21,
  m12,
  m22,
  gm11,
  gm12,
  gm22 
)
Value:
gm11 = ( m11 ) * ( m11 ) + ( m21 ) * ( m21 ); \
( gm12 ) = ( m11 ) * ( m12 ) + ( m21 ) * ( m22 ); \
( gm22 ) = ( m12 ) * ( m12 ) + ( m22 ) * ( m22 );

Definition at line 116 of file verdict_defines.hpp.

◆ VERDICT_MAX

#define VERDICT_MAX (   a,
 
)    ( ( a ) > ( b ) ? ( a ) : ( b ) )

Definition at line 36 of file verdict_defines.hpp.

◆ VERDICT_MIN

#define VERDICT_MIN (   a,
 
)    ( ( a ) < ( b ) ? ( a ) : ( b ) )

Definition at line 35 of file verdict_defines.hpp.

Enumeration Type Documentation

◆ VerdictBoolean

Enumerator
VERDICT_FALSE 
VERDICT_TRUE 

Definition at line 29 of file verdict_defines.hpp.

30 {
31  VERDICT_FALSE = 0,
32  VERDICT_TRUE = 1
33 };

Function Documentation

◆ determinant() [1/2]

double determinant ( const VerdictVector v1,
const VerdictVector v2,
const VerdictVector v3 
)
inline

Definition at line 43 of file verdict_defines.hpp.

44 {
45  return v1 % ( v2 * v3 );
46 }

◆ determinant() [2/2]

double determinant ( double  a,
double  b,
double  c,
double  d 
)
inline

Definition at line 38 of file verdict_defines.hpp.

39 {
40  return ( ( a ) * ( d ) - ( b ) * ( c ) );
41 }

Referenced by get_weight(), inverse(), v_quad_quality(), v_quad_relative_size_squared(), v_tri_quality(), and v_tri_relative_size_squared().

◆ form_Q()

void form_Q ( const VerdictVector v1,
const VerdictVector v2,
const VerdictVector v3,
VerdictVector q1,
VerdictVector q2,
VerdictVector q3 
)
inline

Definition at line 210 of file verdict_defines.hpp.

216 {
217 
218  double g11, g12, g13, g22, g23, g33;
219 
220  g11 = v1 % v1;
221  g12 = v1 % v2;
222  g13 = v1 % v3;
223  g22 = v2 % v2;
224  g23 = v2 % v3;
225  g33 = v3 % v3;
226 
227  double rtg11 = sqrt( g11 );
228  double rtg22 = sqrt( g22 );
229  double rtg33 = sqrt( g33 );
230  VerdictVector temp1;
231 
232  temp1 = v1 * v2;
233 
234  double cross = sqrt( temp1 % temp1 );
235 
236  double q11, q21, q31;
237  double q12, q22, q32;
238  double q13, q23, q33;
239 
240  q11 = 1;
241  q21 = 0;
242  q31 = 0;
243 
244  q12 = g12 / rtg11 / rtg22;
245  q22 = cross / rtg11 / rtg22;
246  q32 = 0;
247 
248  q13 = g13 / rtg11 / rtg33;
249  q23 = ( g11 * g23 - g12 * g13 ) / rtg11 / rtg33 / cross;
250  temp1 = v2 * v3;
251  q33 = ( v1 % temp1 ) / rtg33 / cross;
252 
253  q1.set( q11, q21, q31 );
254  q2.set( q12, q22, q32 );
255  q3.set( q13, q23, q33 );
256 }

References moab::cross(), and VerdictVector::set().

◆ inverse()

void inverse ( const VerdictVector x1,
const VerdictVector x2,
const VerdictVector x3,
VerdictVector u1,
VerdictVector u2,
VerdictVector u3 
)
inline

Definition at line 143 of file verdict_defines.hpp.

149 {
150  double detx = determinant( x1, x2, x3 );
151  VerdictVector rx1, rx2, rx3;
152 
153  rx1.set( x1.x(), x2.x(), x3.x() );
154  rx2.set( x1.y(), x2.y(), x3.y() );
155  rx3.set( x1.z(), x2.z(), x3.z() );
156 
157  u1 = rx2 * rx3;
158  u2 = rx3 * rx1;
159  u3 = rx1 * rx2;
160 
161  u1 /= detx;
162  u2 /= detx;
163  u3 /= detx;
164 }

References determinant(), VerdictVector::set(), VerdictVector::x(), VerdictVector::y(), and VerdictVector::z().

Referenced by skew_x(), and test_spectral_hex().

◆ norm_squared() [1/2]

double norm_squared ( double  m11,
double  m21,
double  m12,
double  m22 
)
inline

Definition at line 111 of file verdict_defines.hpp.

112 {
113  return m11 * m11 + m21 * m21 + m12 * m12 + m22 * m22;
114 }

Referenced by skew_x().

◆ norm_squared() [2/2]

double norm_squared ( VerdictVector x1,
VerdictVector x2,
VerdictVector x3 
)
inline

Definition at line 280 of file verdict_defines.hpp.

282 {
283  return ( x1 % x1 ) + ( x2 % x2 ) + ( x3 % x3 );
284 }

◆ normalize_jacobian()

double normalize_jacobian ( double  jacobi,
VerdictVector v1,
VerdictVector v2,
VerdictVector v3,
int  tet_flag = 0 
)
inline

Definition at line 75 of file verdict_defines.hpp.

80 {
81  double return_value = 0.0;
82 
83  if( jacobi != 0.0 )
84  {
85 
86  double l1, l2, l3, length_product;
87  // Note: there may be numerical problems if one is a lot shorter
88  // than the others this way. But scaling each vector before the
89  // triple product would involve 3 square roots instead of just
90  // one.
91  l1 = v1.length_squared();
92  l2 = v2.length_squared();
93  l3 = v3.length_squared();
94  length_product = sqrt( l1 * l2 * l3 );
95 
96  // if some numerical scaling problem, or just plain roundoff,
97  // then push back into range [-1,1].
98  if( length_product < fabs( jacobi ) )
99  {
100  length_product = fabs( jacobi );
101  }
102 
103  if( tet_flag == 1 )
104  return_value = verdictSqrt2 * jacobi / length_product;
105  else
106  return_value = jacobi / length_product;
107  }
108  return return_value;
109 }

References VerdictVector::length_squared(), and verdictSqrt2.

◆ product()

void product ( VerdictVector a1,
VerdictVector a2,
VerdictVector a3,
VerdictVector b1,
VerdictVector b2,
VerdictVector b3,
VerdictVector c1,
VerdictVector c2,
VerdictVector c3 
)
inline

Definition at line 258 of file verdict_defines.hpp.

267 {
268 
269  VerdictVector x1, x2, x3;
270 
271  x1.set( a1.x(), a2.x(), a3.x() );
272  x2.set( a1.y(), a2.y(), a3.y() );
273  x3.set( a1.z(), a2.z(), a3.z() );
274 
275  c1.set( x1 % b1, x2 % b1, x3 % b1 );
276  c2.set( x1 % b2, x2 % b2, x3 % b2 );
277  c3.set( x1 % b3, x2 % b3, x3 % b3 );
278 }

References VerdictVector::set(), VerdictVector::x(), VerdictVector::y(), and VerdictVector::z().

Referenced by skew_x().

◆ skew_matrix()

int skew_matrix ( double  gm11,
double  gm12,
double  gm22,
double  det,
double &  qm11,
double &  qm21,
double &  qm12,
double &  qm22 
)
inline

Definition at line 121 of file verdict_defines.hpp.

129 {
130  double tmp = sqrt( gm11 * gm22 );
131  if( tmp == 0 )
132  {
133  return false;
134  }
135 
136  qm11 = 1;
137  qm21 = 0;
138  qm12 = gm12 / tmp;
139  qm22 = det / tmp;
140  return true;
141 }

◆ skew_x()

double skew_x ( VerdictVector q1,
VerdictVector q2,
VerdictVector q3,
VerdictVector qw1,
VerdictVector qw2,
VerdictVector qw3 
)
inline

Definition at line 286 of file verdict_defines.hpp.

292 {
293  double normsq1, normsq2, kappa;
294  VerdictVector u1, u2, u3;
295  VerdictVector x1, x2, x3;
296 
297  inverse( qw1, qw2, qw3, u1, u2, u3 );
298  product( q1, q2, q3, u1, u2, u3, x1, x2, x3 );
299  inverse( x1, x2, x3, u1, u2, u3 );
300  normsq1 = norm_squared( x1, x2, x3 );
301  normsq2 = norm_squared( u1, u2, u3 );
302  kappa = sqrt( normsq1 * normsq2 );
303 
304  double skew = 0;
305  if( kappa > VERDICT_DBL_MIN ) skew = 3 / kappa;
306 
307  return skew;
308 }

References inverse(), norm_squared(), product(), and VERDICT_DBL_MIN.

Variable Documentation

◆ verdictSqrt2

double verdictSqrt2
extern

Definition at line 30 of file V_GaussIntegration.cpp.

Referenced by normalize_jacobian().