1 /* ***************************************************************** 2 MESQUITE -- The Mesh Quality Improvement Toolkit 3 4 Copyright 2010 Sandia National Laboratories. Developed at the 5 University of Wisconsin--Madison under SNL contract number 6 624796. The U.S. Government and the University of Wisconsin 7 retain certain rights to this software. 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2.1 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public License 20 (lgpl.txt) along with this library; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 (2010) kraftche@cae.wisc.edu 24 25 ***************************************************************** */ 26 27 28 /** \file MeshUtil.hpp 29 * \author Jason Kraftcheck 30 */ 31 32 #ifndef MSQ_MESH_UTIL_HPP 33 #define MSQ_MESH_UTIL_HPP 34 35 #include "Mesquite.hpp" 36 37 namespace MBMesquite { 38 39 class Mesh; 40 class MsqError; 41 class SimpleStats; 42 class Settings; 43 class PatchData; 44 45 /**\brief Miscelanions operations performed on an entire \c Mesh 46 * without the conveinience of a \c PatchData. 47 */ 48 class MeshUtil 49 { 50 private: 51 Mesh* myMesh; 52 Settings* mySettings; 53 PatchData* globalPatch; 54 55 protected: 56 PatchData* get_global_patch( MsqError& err ); 57 58 public: MeshUtil(Mesh * mesh,Settings * settings=0)59 MeshUtil( Mesh* mesh, Settings* settings = 0 ) 60 : myMesh( mesh ), 61 mySettings( settings ), 62 globalPatch(0) 63 {} 64 65 ~MeshUtil(); 66 67 /**\brief Calcluate statistics for mesh edge lengths 68 */ 69 void edge_length_distribution( SimpleStats& result, MsqError& err ); 70 71 void lambda_distribution( SimpleStats& result, MsqError& err ); 72 73 /**\brief Given two meshes, check if they are different, return true if they are. 74 * 75 *\param mesh1 the first mesh to compare 76 *\param mesh2 the second mesh to compare 77 *\param tol a relative tolerance for coordinates 78 *\param do_print flag for printing differences 79 * 80 * \NOTE Only basic mesh properties are checked, number of vertices & elements, 81 * element connectivity, and coordinates (within the given relative tolerance). 82 */ 83 static bool meshes_are_different(Mesh& mesh1, Mesh& mesh2, MsqError& err, double tol=1.e-5, bool do_print = false); 84 85 86 }; 87 88 89 } // namespace MBMesquite 90 91 #endif 92