MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 /* ***************************************************************** 00002 MESQUITE -- The Mesh Quality Improvement Toolkit 00003 00004 Copyright 2004 Sandia Corporation and Argonne National 00005 Laboratory. Under the terms of Contract DE-AC04-94AL85000 00006 with Sandia Corporation, the U.S. Government retains certain 00007 rights in 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 diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov, 00024 pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov 00025 00026 ***************************************************************** */ 00027 // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3 00028 // -*- 00029 00030 /*! \file IdealWeightMeanRatio.hpp 00031 00032 Header file for the MBMesquite::IdealWeightMeanRatio class 00033 00034 \author Michael Brewer 00035 \author Todd Munson 00036 \date 2002-11-11 00037 */ 00038 00039 #ifndef IdealWeightMeanRatio_hpp 00040 #define IdealWeightMeanRatio_hpp 00041 00042 #include "Mesquite.hpp" 00043 #include "MsqError.hpp" 00044 #include "ElementQM.hpp" 00045 #include "AveragingQM.hpp" 00046 #include "Vector3D.hpp" 00047 #include "Matrix3D.hpp" 00048 #include "Exponent.hpp" 00049 00050 namespace MBMesquite 00051 { 00052 /*! \class IdealWeightMeanRatio 00053 \brief Computes the mean ratio quality metric 00054 of given element. 00055 00056 The metric does not use the sample point functionality or the 00057 compute_weighted_jacobian. It evaluates the metric at 00058 the element vertices, and uses the isotropic ideal element. 00059 It does require a feasible region, and the metric needs 00060 to be maximized. 00061 */ 00062 class IdealWeightMeanRatio : public ElementQM, public AveragingQM 00063 { 00064 public: 00065 MESQUITE_EXPORT IdealWeightMeanRatio() 00066 : AveragingQM( QualityMetric::LINEAR ), a2Con( 2.0 ), b2Con( -1.0 ), c2Con( 1.0 ), a3Con( 3.0 ), b3Con( -1.0 ), 00067 c3Con( 2.0 / 3.0 ) 00068 { 00069 } 00070 00071 //! virtual destructor ensures use of polymorphism during destruction 00072 MESQUITE_EXPORT virtual ~IdealWeightMeanRatio() {} 00073 00074 virtual std::string get_name() const; 00075 00076 //! 1 if metric should be minimized, -1 if metric should be maximized. 00077 virtual int get_negate_flag() const; 00078 00079 virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err ); 00080 00081 virtual bool evaluate_with_gradient( PatchData& pd, 00082 size_t handle, 00083 double& value, 00084 std::vector< size_t >& indices, 00085 std::vector< Vector3D >& gradient, 00086 MsqError& err ); 00087 00088 virtual bool evaluate_with_Hessian_diagonal( PatchData& pd, 00089 size_t handle, 00090 double& value, 00091 std::vector< size_t >& indices, 00092 std::vector< Vector3D >& gradient, 00093 std::vector< SymMatrix3D >& Hessian, 00094 MsqError& err ); 00095 00096 virtual bool evaluate_with_Hessian( PatchData& pd, 00097 size_t handle, 00098 double& value, 00099 std::vector< size_t >& indices, 00100 std::vector< Vector3D >& gradient, 00101 std::vector< Matrix3D >& Hessian, 00102 MsqError& err ); 00103 00104 private: 00105 // arrays used in Hessian computations 00106 // We allocate them here, so that one allocation only is done. 00107 // This gives a big computation speed increase. 00108 Vector3D mCoords[4]; // Vertex coordinates for the (decomposed) elements 00109 Vector3D mGradients[32]; // Gradient of metric with respect to the coords 00110 Matrix3D mHessians[80]; // Hessian of metric with respect to the coords 00111 double mMetrics[8]; // Metric values for the (decomposed) elements 00112 00113 const double a2Con; 00114 const Exponent b2Con; 00115 const Exponent c2Con; 00116 00117 const double a3Con; 00118 const Exponent b3Con; 00119 const Exponent c3Con; 00120 }; 00121 } // namespace MBMesquite 00122 00123 #endif // IdealWeightMeanRatio_hpp