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;
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);
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);
57 A[
i] = J_Matrix(&v[0],2);
59 alpha[
i] =
A[
i].det();
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;
68 v[1][
j] =
n(i3,0)-
n(
i,
j);
70 A[
i] = J_Matrix(&v[0],2);
72 alpha[
i] =
A[
i].det();
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);
88 alpha[
i] = A[
i].det();
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]);
97 A[
i] = J_Matrix(&v[0],2);
99 alpha[
i] =
A[
i].det();
106 if (type_ == COM::Connectivity::TRI3){
107 tau = alpha[0]/(2.0*ref_area);
108 return (tau < (1/tau))? tau : (1/tau);
111 assert (type_ == COM::Connectivity::QUAD4);
112 tau = (alpha[0] + alpha[2])/(2*ref_area);
113 return (tau < (1/tau))? tau : (1/tau);
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));
126 assert (type_ == COM::Connectivity::QUAD4);
128 for (
int i = 0;
i < 4;
i ++){
129 denom += ( (L[
i](0,0) + L[
i](1,1))/alpha[
i] );
137 if (type_ == COM::Connectivity::TRI3) {
144 for (
int i = 0;
i < 4 ;
i++) {
145 if (alpha[
i]==0) { flag = 1;}
147 denom += (
sqrt ( L[
i](0,0) * L[
i](1,1)) / alpha[
i] );
150 if (flag){
return 0; }
151 else {
return 4.0/
denom; }
156 atts[0] = compute_shape();
160 atts[0] = compute_size(ref_area);
164 atts[0] = compute_size(ref_area) * compute_shape();
168 atts[0] = compute_skew();
172 atts[0] = compute_size(ref_area) * compute_skew();
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;
double compute_shape() const
Compute the shape metric.
#define COM_assertion_msg(EX, msg)
virtual void compute(double atts[]) const
Calculate the shape metric value.
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
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 2D Algebraic Metric.
virtual void compute(double atts[]) const
Calculate the metric value.
virtual void compute(double atts[]) const
Calculate the metric value.
2D Algebraic Metric Base Class
virtual void compute(double atts[]) const
Calculate the metric value.
#define MOP_END_NAMESPACE
double compute_size(double ref_area=1.) const
Compute the size metric.
2D algebraic quality Metric declaration..
#define MOP_BEGIN_NAMESPACE
std::ostream & operator<<(std::ostream &os, const COM_exception &ex)
Print out a given exception.
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
virtual void compute(double atts[]) const
Calculate the shape metric value.