Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
V_EdgeMetric.cpp
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: V_EdgeMetric.cpp,v $
00004 
00005   Copyright (c) 2006 Sandia Corporation.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 
00015 /*
00016  *
00017  * V_EdgeMetric.cpp contains quality calcultions for edges
00018  *
00019  * This file is part of VERDICT
00020  *
00021  */
00022 
00023 #define VERDICT_EXPORTS
00024 
00025 #include "moab/verdict.h"
00026 #include <cmath>
00027 
00028 /*!
00029   length of and edge
00030   length is calculated by taking the distance between the end nodes
00031  */
00032 C_FUNC_DEF double v_edge_length( int /*num_nodes*/, double coordinates[][3] )
00033 {
00034 
00035     double x = coordinates[1][0] - coordinates[0][0];
00036     double y = coordinates[1][1] - coordinates[0][1];
00037     double z = coordinates[1][2] - coordinates[0][2];
00038     return (double)( sqrt( x * x + y * y + z * z ) );
00039 }
00040 
00041 /*!
00042 
00043   higher order function for calculating multiple metrics at once.
00044 
00045   for an edge, there is only one metric, edge length.
00046 */
00047 
00048 C_FUNC_DEF void edge_quality( int num_nodes,
00049                               double coordinates[][3],
00050                               unsigned int metrics_request_flag,
00051                               struct EdgeMetricVals* metric_vals )
00052 {
00053     if( metrics_request_flag & V_EDGE_LENGTH ) metric_vals->length = v_edge_length( num_nodes, coordinates );
00054 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines