1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*=========================================================================

  Module:    $RCSfile: V_EdgeMetric.cpp,v $

  Copyright (c) 2006 Sandia Corporation.
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

/*
 *
 * V_EdgeMetric.cpp contains quality calcultions for edges
 *
 * This file is part of VERDICT
 *
 */

#define VERDICT_EXPORTS

#include "moab/verdict.h"
#include <cmath>

/*!
  length of and edge
  length is calculated by taking the distance between the end nodes
 */
C_FUNC_DEF double v_edge_length( int /*num_nodes*/, double coordinates[][3] )
{

    double x = coordinates[1][0] - coordinates[0][0];
    double y = coordinates[1][1] - coordinates[0][1];
    double z = coordinates[1][2] - coordinates[0][2];
    return (double)( sqrt( x * x + y * y + z * z ) );
}

/*!

  higher order function for calculating multiple metrics at once.

  for an edge, there is only one metric, edge length.
*/

C_FUNC_DEF void edge_quality( int num_nodes,<--- The function 'edge_quality' is never used.
                              double coordinates[][3],
                              unsigned int metrics_request_flag,
                              struct EdgeMetricVals* metric_vals )
{
    if( metrics_request_flag & V_EDGE_LENGTH ) metric_vals->length = v_edge_length( num_nodes, coordinates );
}