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::TET4){
47 for (
int i = 0;
i < 4;
i ++){
48 for (
int j = 0;
j < 3;
j ++){
49 v[0][
j] = premult * (
n((
i+1)%4,
j) -
n(
i,
j));
50 v[1][
j] = premult * (
n((
i+2)%4,
j) -
n(
i,
j));
51 v[2][
j] = premult * (
n((
i+3)%4,
j) -
n(
i,
j));
53 A[
i] = J_Matrix(&v[0],3);
55 alpha[
i] =
A[
i].det();
59 else if (type_ == COM::Connectivity::HEX8){
61 for (
int i = 0;
i < 8;
i ++){
63 if ( (
i==0) || (
i==3) || (
i==5) || (
i==6) ) { premult = 1.0; }
64 else if ( (
i==1) || (
i==2) || (
i==4) || (
i==7) ) { premult = -1.0; }
66 if ( (
i == 0) || (
i == 4) ) { a=1; b=3; c=4; }
67 else if ( (
i ==3) || (
i==7) ) { a=4;b=5;c=7; }
70 for (
int j = 0;
j < 3;
j ++){
71 v[0][
j] = premult*(
n((
i+a)%8,
j) -
n(
i,
j));
72 v[1][
j] = premult*(
n((
i+b)%8,
j) -
n(
i,
j));
73 v[2][
j] = premult*(
n((
i+c)%8,
j) -
n(
i,
j));
75 A[
i] = J_Matrix(&v[0],3);
77 alpha[
i] =
A[
i].det();
84 vector<Vector_3<double> >
v(3);
85 if (type_ == COM::Connectivity::TET4){
87 for (
int i = 0;
i < 4;
i ++){
88 for (
int j = 0;
j < 3;
j ++){
89 v[0][
j] = premult * (n[(
i+1)%4][
j] - n[
i][
j]);
90 v[1][
j] = premult * (n[(
i+2)%4][j] - n[
i][j]);
91 v[2][
j] = premult * (n[(
i+3)%4][j] - n[
i][j]);
93 A[
i] = J_Matrix(&v[0],3);
95 alpha[
i] =
A[
i].det();
99 else if (type_ == COM::Connectivity::HEX8){
100 double premult = 1.0;
101 for (
int i = 0;
i < 8;
i ++){
103 if ( (
i==0) || (
i==3) || (
i==5) || (
i==6) ) { premult = 1.0; }
104 else if ( (
i==1) || (
i==2) || (
i==4) || (
i==7) ) { premult = -1.0; }
106 if ( (
i == 0) || (
i == 4) ) { a=1; b=3; c=4; }
107 else if ( (
i ==3) || (
i==7) ) { a=4;b=5;c=7; }
110 for (
int j = 0;
j < 3;
j ++){
111 v[0][
j] = premult*( n[(
i+a)%8][
j] - n[
i][
j]);
112 v[1][
j] = premult*( n[(
i+b)%8][j] - n[
i][j]);
113 v[2][
j] = premult*( n[(
i+c)%8][j] - n[
i][j]);
115 A[
i] = J_Matrix(&v[0],3);
117 alpha[
i] =
A[
i].det();
124 if (type_ == COM::Connectivity::TET4){
125 size = (alpha[0]/6.0)/ref_vol;
126 size = (size < (1/size))? size : (1/size);
128 if (type_ == COM::Connectivity::HEX8){
129 for (
int i = 0;
i < 8;
i++){
132 if (size < 0) {size = 0;}
134 size = size / ( 8.0 * ref_vol );
135 size = (size < (1/size))? size: (1/size);
142 if (type_ == COM::Connectivity::TET4){
143 double num = (3.0 *
pow(alpha[0]*
sqrt(2.0),(2.0/3.0)) );
144 double denom = 1.5*(L[0](0,0)+L[0](1,1)+L[0](2,2))-
145 (L[0](0,1)+L[0](1,2)+L[0](0,2));
149 assert (type_ == COM::Connectivity::HEX8);
151 for (
int i = 0;
i < 8;
i ++){
152 denom += (L[
i](0,0) + L[
i](1,1) + L[
i](2,2))/(
pow(
abs(alpha[
i]),(2.0/3.0)));
160 if (type_ == COM::Connectivity::TET4) {
166 assert (type_ == COM::Connectivity::HEX8);
169 for (
int i = 0;
i < 8;
i ++){
170 double root =
sqrt(L[
i](0,0)*L[
i](1,1)*L[
i](2,2));
171 if (root == 0) { flag = 1;}
172 denom +=
pow(
abs(root/alpha[
i]), (2.0/3.0));
174 if (flag) {
return 0.0;}
175 else {
return 8.0/
denom; }
180 atts[0] = compute_shape();
184 atts[0] = compute_size(ref_vol);
188 atts[0] = compute_size(ref_vol) * compute_shape();
192 atts[0] = compute_skew();
196 atts[0] = compute_size(ref_vol) * compute_skew();
200 for(
int i =0;
i < (m.
type_-100);
i ++){
201 output <<
"A[" <<
i <<
"]:" << endl << m.
A[
i];
202 output <<
"L[" <<
i <<
"]:" << endl << m.
L[
i];
203 output <<
"alpha"<<
i <<
": " << m.
alpha[
i] << endl << endl;
double compute_size(double ref_voume=1.) const
Compute the size metric.
virtual void compute(double atts[]) const
Calculate the metric value on this element.
virtual void compute(double atts[]) const
Calculate the metric value on this element.
virtual void compute(double atts[]) const
Calculate the metric value on this element.
virtual void compute(double atts[]) const
Calculate the metric value on this element.
double compute_skew() const
Compute the skew metric.
*********************************************************************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
3D Algebraic Metric Base Class
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Algebraic Metric.
#define MOP_END_NAMESPACE
3d algebraic quality Metric declarations.
virtual void compute(double atts[]) const
Calculate the metric value on this element.
#define MOP_BEGIN_NAMESPACE
double compute_shape() const
Compute the shape metric.
std::ostream & operator<<(std::ostream &os, const COM_exception &ex)
Print out a given exception.
double pow(double value, const Exponent &exp)
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom