49 if (_type == COM::Connectivity::TET4){
51 v[0]= n[2]-n[1];
v[1]= n[1]-n[2];
v[2]= n[2]-n[0];
52 v[3]= n[1]-n[0];
v[4]= n[3]-n[1];
v[5]= n[3]-n[0];
55 else if (_type == COM::Connectivity::HEX8){
57 v[0]= n[1]-n[0];
v[1]= n[3]-n[0];
v[2]= n[1]-n[2];
v[3]= n[3]-n[2];
58 v[4]= n[5]-n[1];
v[5]= n[7]-n[3];
v[6]= n[5]-n[4];
v[7]= n[7]-n[4];
64 if(ene.type() == COM::Connectivity::TET4){
66 const std::string nc(
"nc");
67 Element_node_vectors_k_const<double>
n;
68 n.set(ene.pane()->attribute(nc),ene);
69 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);
70 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);
71 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);
72 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);
73 v[4][0]=
n(3,0)-
n(1,0);
v[4][1]=
n(3,1)-
n(1,1);
v[4][2]=
n(3,2)-
n(1,2);
74 v[5][0]=
n(3,0)-
n(0,0);
v[5][1]=
n(3,1)-
n(0,1);
v[5][2]=
n(3,2)-
n(0,2);
75 v[6][0]=
n(3,0)-
n(2,0);
v[6][1]=
n(3,1)-
n(2,1);
v[6][2]=
n(3,2)-
n(2,2);
77 else if (ene.type() == COM::Connectivity::HEX8){
79 const std::string nc(
"nc");
80 Element_node_vectors_k_const<double>
n;
81 n.set(ene.pane()->attribute(nc),ene);
82 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);
83 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);
84 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);
85 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);
86 v[4][0]=
n(5,0)-
n(1,0);
v[4][1]=
n(5,1)-
n(1,1);
v[4][2]=
n(5,2)-
n(1,2);
87 v[5][0]=
n(7,0)-
n(3,0);
v[5][1]=
n(7,1)-
n(3,1);
v[5][2]=
n(7,2)-
n(3,2);
88 v[6][0]=
n(5,0)-
n(4,0);
v[6][1]=
n(5,1)-
n(4,1);
v[6][2]=
n(5,2)-
n(4,2);
89 v[7][0]=
n(7,0)-
n(4,0);
v[7][1]=
n(7,1)-
n(4,1);
v[7][2]=
n(7,2)-
n(4,2);
91 else if (ene.type() == COM::Connectivity::PYRIMID5 ||
92 ene.type() == COM::Connectivity::PRISM6){
94 _ene_pane = ene.pane();
101 if (_type == COM::Connectivity::TET4){
102 double a12,a13,a14,a23,a24,a34;
108 min_max6(a12,a13,a14,a23,a24,a34,min,max);
110 else if (_type == COM::Connectivity::HEX8){
111 double a12,a14,a25,a34,a26,a46,a13,a15,a23,a45,a36,a56;
123 min_max12(a12,a15,a34,a36,a13,a25,a45,a46,a14,a23,a26,a56,min,max);
127 const int face_node_lists_pyra[5][8] =
128 { {0,3,2,1,8,7,6,5}, {0,1,4,5,10,9,-1,-1}, {1,2,4,6,11,10,-1,-1},
129 {2,3,4,7,12,11,-1,-1}, {3,0,4,8,9,12,-1,-1}};
131 const int face_node_lists_pris[5][9] =
132 { {0,1,4,3,6,10,12,9,15}, {1,2,5,4,7,11,13,10,16}, {2,0,3,5,8,9,14,11,17},
133 {0,2,1,8,7,6,-1,-1,-1}, {3,4,5,12,13,14,-1,-1,-1}};
136 Element_node_enumerator ene(_ene_pane,
142 std::vector<Vector_3<double> > fnormals(ene.size_of_faces());
143 Element_node_vectors_k_const<double>
n;
144 n.set(ene.pane()->attribute(
"nc"),ene);
146 std::map<std::pair<int,int>,
int> e2f;
147 std::map<std::pair<int,int>,
int>::iterator e2f_it;
149 std::set<std::pair<int,int> > afs;
150 std::set<std::pair<int,int> >::iterator afs_it;
151 for(
int i=0,
ni = ene.size_of_faces();
i<
ni; ++
i){
153 Facet_node_enumerator fne( &ene,
i);
155 const int *fn_list = (_type == COM::Connectivity::PYRIMID5) ?
156 face_node_lists_pyra[
i] : face_node_lists_pris[
i];
164 e1[0] =
n(i1,0)-
n(i0,0);
165 e1[1] =
n(i1,1)-
n(i0,1);
166 e1[2] =
n(i1,2)-
n(i0,2);
167 e2[0] =
n(i2,0)-
n(i1,0);
168 e2[1] =
n(i2,1)-
n(i1,1);
169 e2[2] =
n(i2,2)-
n(i1,2);
172 for(
int j=0,
nj = fne.size_of_edges();
j<
nj;++
j){
177 int node_id1 = fne[
j],node_id2 = fne[(
j+1)%nj];
178 if(node_id1>node_id2)
180 e2f_it = e2f.find(std::make_pair<int,int>(node_id1,node_id2));
181 if(e2f_it != e2f.end()){
182 afs.insert(std::make_pair<int,int>(e2f_it->second,i));
186 e2f.insert(std::make_pair<std::pair<int,int>,
int>(
187 std::make_pair<int,int>(node_id1,node_id2)
191 min = 180.0; max = 0.0;
192 for(afs_it = afs.begin(); afs_it != afs.end(); ++afs_it){
193 int ind1 = afs_it->first;
194 int ind2 = afs_it->second;
197 min = (angle <
min) ? angle : min;
198 max = (angle >
max) ? angle : max;
207 if (_type == COM::Connectivity::TET4){
216 double a_sum = a1+a2+a3+a4;
226 double p1 = len_a * len_ap;
227 double p2 = len_b * len_bp;
228 double p3 = len_c * len_cp;
229 double p_prod =
sqrt((p1+p2+p3)*(p1+p2-p3)*(p1-p2+p3)*(p2+p3-p1));
233 R= p_prod/(24.0*vol);
236 if( len_b < l ){ l = len_b;}
237 if( len_c < l ){ l = len_c;}
238 if( len_ap < l ){ l = len_ap;}
239 if( len_bp < l ){ l = len_bp;}
240 if( len_cp < l ){ l = len_cp;}
250 compute_angles(atts[0],atts[1]);
262 if (_type == COM::Connectivity::HEX8) {
268 compute_aspects(R,r,l);
270 atts[1] = (l/R)*.61237243569579447;
279 if (_type == COM::Connectivity::TET4) {
282 else {
return -1.0; }
286 if (_type == COM::Connectivity::TET4) {
289 else {
return -1.0; }
void swap(int &a, int &b)
void compute_angles(double &min, double &max) const
Compute min and max dihedral angles.
virtual void compute(double atts[]) const
Calculate the metric value on this element.
double maxValue() const
Get the maximum value for this metric.
double minValue() const
Get the minimum value for this metric.
#define COM_assertion_msg(EX, msg)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
3D geometric quality Metric declarations.
double minValue() const
Get the minimum value for this metric.
void compute_aspects(double &R, double &r, double &l) const
Compute circumradius, inradius, and shortest edge length.
*********************************************************************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
double f_angle(Vector_3< double > v1, Vector_3< double >v2)
Compute the angle between two faces.
double maxValue() const
Get the maximum value for this metric.
virtual void compute(double atts[]) const
Calculate the metric value on this element.
double angle(Vector_3< double > v1, Vector_3< double > v2)
Compute the angle between two vectors.
#define MOP_END_NAMESPACE
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
double tet_vol(const Vector_3< double > &a, const Vector_3< double > &b, const Vector_3< double > &c)
Compute the volume of a tetrahedron given three edges from a point as vectors.
double tri_area(const Vector_3< double > &v1, const Vector_3< double > &v2, const Vector_3< double > &v3)
Compute the area of a triangle defined by its three sides as vectors.
#define MOP_BEGIN_NAMESPACE
void min_max12(double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11, double a12, double &min, double &max)
Find minimum and maximum of 12 numbers.
void int int REAL REAL REAL *z blockDim dim * ni
void unit_normal(const Vector_3< double > &v1, const Vector_3< double > &v2, Vector_3< double > &v3)
Compute the unit vector normal to two input vectors.
double edge_length(const Vector_3< double > &v)
Compute the edge length of a vector.
Geometric helper function header file.
void min_max6(double a1, double a2, double a3, double a4, double a5, double a6, double &min, double &max)
Find minimum and maximum of 6 numbers.