MOAB: Mesh Oriented datABase
(version 5.2.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 IdealWeightInverseMeanRatio.hpp 00031 00032 Header file for the MBMesquite::IdealWeightInverseMeanRatio class 00033 00034 \author Michael Brewer 00035 \author Thomas Leurent 00036 \date 2002-06-19 00037 */ 00038 00039 #ifndef IdealWeightInverseMeanRatio_hpp 00040 #define IdealWeightInverseMeanRatio_hpp 00041 00042 #include "Mesquite.hpp" 00043 #include "ElementQM.hpp" 00044 #include "AveragingQM.hpp" 00045 #include "Vector3D.hpp" 00046 #include "Matrix3D.hpp" 00047 #include "Exponent.hpp" 00048 00049 namespace MBMesquite 00050 { 00051 class MsqMeshEntity; 00052 class PatchData; 00053 class MsqError; 00054 00055 /*! \class IdealWeightInverseMeanRatio 00056 \brief Computes the inverse mean ratio of given element. 00057 00058 The metric does not use the sample point functionality or the 00059 compute_weighted_jacobian. It evaluates the metric at 00060 the element vertices, and uses the isotropic ideal element. 00061 Optionally, the metric computation can be raised to the 00062 'pow_dbl' power. This does not necessarily raise the metric 00063 value to the 'pow_dbl' power but instead raises each local 00064 metric. For example, if the corner inverse mean ratios of a quadraliteral 00065 element were m1,m2,m3, and m4 and we set pow_dbl=2 and 00066 used linear averaging, the metric value would then be 00067 m = .25(m1*m1 + m2*m2 + m3*m3 + m4*m4). The metric does 00068 require a feasible region, and the metric needs to be minimized 00069 if pow_dbl is greater than zero and maximized if pow_dbl 00070 is less than zero. pow_dbl being equal to zero is invalid. 00071 */ 00072 class IdealWeightInverseMeanRatio : public ElementQM, public AveragingQM 00073 { 00074 public: 00075 MESQUITE_EXPORT IdealWeightInverseMeanRatio( MsqError& err, double power = 1.0 ); 00076 MESQUITE_EXPORT IdealWeightInverseMeanRatio(); 00077 00078 //! virtual destructor ensures use of polymorphism during destruction 00079 MESQUITE_EXPORT virtual ~IdealWeightInverseMeanRatio() {} 00080 00081 virtual std::string get_name() const; 00082 00083 //! 1 if metric should be minimized, -1 if metric should be maximized. 00084 virtual int get_negate_flag() const; 00085 00086 virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err ); 00087 00088 virtual bool evaluate_with_gradient( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices, 00089 std::vector< Vector3D >& gradient, MsqError& err ); 00090 00091 virtual bool evaluate_with_Hessian_diagonal( PatchData& pd, size_t handle, double& value, 00092 std::vector< size_t >& indices, std::vector< Vector3D >& gradient, 00093 std::vector< SymMatrix3D >& Hessian, MsqError& err ); 00094 00095 virtual bool evaluate_with_Hessian( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices, 00096 std::vector< Vector3D >& gradient, std::vector< Matrix3D >& Hessian, 00097 MsqError& err ); 00098 00099 private: 00100 //! Sets the power value in the metric computation. 00101 void set_metric_power( double pow_dbl, MsqError& err ); 00102 00103 // arrays used in Hessian computations 00104 // We allocate them here, so that one allocation only is done. 00105 // This gives a big computation speed increase. 00106 Vector3D mCoords[4]; // Vertex coordinates for the (decomposed) elements 00107 Vector3D mGradients[32]; // Gradient of metric with respect to the coords 00108 Matrix3D mHessians[80]; // Hessian of metric with respect to the coords 00109 double mMetrics[8]; // Metric values for the (decomposed) elements 00110 // variables used in the definition of the metric (2d and 3d) 00111 double a2Con; 00112 Exponent b2Con; 00113 Exponent c2Con; 00114 00115 double a3Con; 00116 Exponent b3Con; 00117 Exponent c3Con; 00118 }; 00119 } // namespace MBMesquite 00120 00121 #endif // IdealWeightInverseMeanRatio_hpp