MOAB: Mesh Oriented datABase  (version 5.3.0)
MeshUtil.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2010 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     (2010) kraftche@cae.wisc.edu
00024 
00025   ***************************************************************** */
00026 
00027 /** \file MeshUtil.hpp
00028  *  \author Jason Kraftcheck
00029  */
00030 
00031 #ifndef MSQ_MESH_UTIL_HPP
00032 #define MSQ_MESH_UTIL_HPP
00033 
00034 #include "Mesquite.hpp"
00035 
00036 namespace MBMesquite
00037 {
00038 
00039 class Mesh;
00040 class MsqError;
00041 class SimpleStats;
00042 class Settings;
00043 class PatchData;
00044 
00045 /**\brief Miscelanions operations performed on an entire \c Mesh
00046  *        without the conveinience of a \c PatchData.
00047  */
00048 class MeshUtil
00049 {
00050   private:
00051     Mesh* myMesh;
00052     Settings* mySettings;
00053     PatchData* globalPatch;
00054 
00055   protected:
00056     PatchData* get_global_patch( MsqError& err );
00057 
00058   public:
00059     MeshUtil( Mesh* mesh, Settings* settings = 0 ) : myMesh( mesh ), mySettings( settings ), globalPatch( 0 ) {}
00060 
00061     ~MeshUtil();
00062 
00063     /**\brief Calcluate statistics for mesh edge lengths
00064      */
00065     void edge_length_distribution( SimpleStats& result, MsqError& err );
00066 
00067     void lambda_distribution( SimpleStats& result, MsqError& err );
00068 
00069     /**\brief Given two meshes, check if they are different, return true if they are.
00070      *
00071      *\param mesh1 the first mesh to compare
00072      *\param mesh2 the second mesh to compare
00073      *\param tol a relative tolerance for coordinates
00074      *\param do_print flag for printing differences
00075      *
00076      * \NOTE Only basic mesh properties are checked, number of vertices & elements,
00077      * element connectivity, and coordinates (within the given relative tolerance).
00078      */
00079     static bool meshes_are_different( Mesh& mesh1, Mesh& mesh2, MsqError& err, double tol = 1.e-5,
00080                                       bool do_print = false );
00081 };
00082 
00083 }  // namespace MBMesquite
00084 
00085 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines