MOAB: Mesh Oriented datABase
(version 5.2.1)
|
00001 /* ***************************************************************** 00002 MESQUITE -- The Mesh Quality Improvement Toolkit 00003 00004 Copyright 2009 Sandia National Laboratories. Developed at the 00005 University of Wisconsin--Madison under SNL contract number 00006 624796. The U.S. Government and the University of Wisconsin 00007 retain certain rights to this software. 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 (lgpl.txt) along with this library; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00023 (2009) kraftche@cae.wisc.edu 00024 00025 ***************************************************************** */ 00026 00027 /** \file EdgeQM.hpp 00028 * \brief 00029 * \author Jason Kraftcheck 00030 */ 00031 00032 #ifndef MSQ_EDGE_QM_HPP 00033 #define MSQ_EDGE_QM_HPP 00034 00035 #include "Mesquite.hpp" 00036 #include "QualityMetric.hpp" 00037 00038 namespace MBMesquite 00039 { 00040 00041 /**\brief Base type for quality metrics evaluated for each edge */ 00042 class EdgeQM : public QualityMetric 00043 { 00044 public: 00045 MESQUITE_EXPORT virtual ~EdgeQM(); 00046 00047 MESQUITE_EXPORT virtual MetricType get_metric_type() const 00048 { 00049 return VERTEX_BASED; 00050 } 00051 00052 /**\brief Returns list of edge indices in PatchData 00053 * 00054 *This method returns metric evaluation points for every 00055 *logical edge in the patch if \c free_vertices_only is 00056 *false. If \c free_vertices_only is true then only the 00057 *subset of edges adjacent to at least one free vertex are 00058 *returned. 00059 */ 00060 MESQUITE_EXPORT virtual void get_evaluations( PatchData& pd, std::vector< size_t >& handles, 00061 bool free_vertices_only, MsqError& err ); 00062 00063 /**\brief Returns list of edge indices in PatchData 00064 * 00065 *This method returns metric evaluation points only a subset 00066 *of the logical edges in a patch such that if one iterates 00067 *over the mesh using element-on-vertex patches a given edge 00068 *is returned only once for the set of all patches. This is 00069 *accomplished by returning only edges adjacent to vertices 00070 *without the MSQ_PATCH_FIXED flag set, and only if the handle for 00071 *the opposite vertex is greater than the one with the flag 00072 *set. 00073 */ 00074 MESQUITE_EXPORT virtual void get_single_pass( PatchData& pd, std::vector< size_t >& handles, 00075 bool free_vertices_only, MsqError& err ); 00076 00077 MESQUITE_EXPORT static void get_edge_evaluations( PatchData& pd, std::vector< size_t >& handles, 00078 bool free_vertices_only, bool single_pass_evaluate, 00079 MsqError& err ); 00080 00081 /**\brief Default implementation for all edge-based metrics 00082 * 00083 * Fill 'indices' with all free vertex indices in element, 00084 * and call 'evaluate'. 00085 */ 00086 MESQUITE_EXPORT virtual bool evaluate_with_indices( PatchData& pd, size_t handle, double& value, 00087 std::vector< size_t >& indices, MsqError& err ); 00088 00089 enum 00090 { 00091 ELEM_EDGE_BITS = 4, 00092 ELEM_INDEX_BITS = 8 * sizeof( size_t ) - ELEM_EDGE_BITS, 00093 ELEM_EDGE_MASK = ( ( (size_t)1 ) << ELEM_INDEX_BITS ) - 1 00094 }; 00095 00096 inline static size_t handle( unsigned edge_no, size_t elem_idx ) 00097 { 00098 assert( elem_idx <= ELEM_EDGE_MASK ); 00099 return ( ( (size_t)edge_no ) << ELEM_INDEX_BITS ) | elem_idx; 00100 } 00101 00102 inline static unsigned edge( size_t handle ) 00103 { 00104 return handle >> ELEM_INDEX_BITS; 00105 } 00106 00107 inline static unsigned elem( size_t handle ) 00108 { 00109 return handle & ELEM_EDGE_MASK; 00110 } 00111 }; 00112 00113 } // namespace MBMesquite 00114 00115 #endif