LCOV - code coverage report
Current view: top level - src/mesquite/QualityMetric/Shape - IdealWeightInverseMeanRatio.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 1 1 100.0 %
Date: 2020-07-18 00:09:26 Functions: 1 1 100.0 %
Branches: 4 6 66.7 %

           Branch data     Line data    Source code
       1                 :            : /* *****************************************************************
       2                 :            :     MESQUITE -- The Mesh Quality Improvement Toolkit
       3                 :            : 
       4                 :            :     Copyright 2004 Sandia Corporation and Argonne National
       5                 :            :     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
       6                 :            :     with Sandia Corporation, the U.S. Government retains certain
       7                 :            :     rights in 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                 :            :     [email protected], [email protected], [email protected],
      24                 :            :     [email protected], [email protected], [email protected]
      25                 :            : 
      26                 :            :   ***************************************************************** */
      27                 :            : // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3
      28                 :            : // -*-
      29                 :            : 
      30                 :            : /*! \file IdealWeightInverseMeanRatio.hpp
      31                 :            : 
      32                 :            : Header file for the MBMesquite::IdealWeightInverseMeanRatio class
      33                 :            : 
      34                 :            : \author Michael Brewer
      35                 :            : \author Thomas Leurent
      36                 :            : \date   2002-06-19
      37                 :            :  */
      38                 :            : 
      39                 :            : #ifndef IdealWeightInverseMeanRatio_hpp
      40                 :            : #define IdealWeightInverseMeanRatio_hpp
      41                 :            : 
      42                 :            : #include "Mesquite.hpp"
      43                 :            : #include "ElementQM.hpp"
      44                 :            : #include "AveragingQM.hpp"
      45                 :            : #include "Vector3D.hpp"
      46                 :            : #include "Matrix3D.hpp"
      47                 :            : #include "Exponent.hpp"
      48                 :            : 
      49                 :            : namespace MBMesquite
      50                 :            : {
      51                 :            : class MsqMeshEntity;
      52                 :            : class PatchData;
      53                 :            : class MsqError;
      54                 :            : 
      55                 :            : /*! \class IdealWeightInverseMeanRatio
      56                 :            :   \brief Computes the inverse mean ratio of given element.
      57                 :            : 
      58                 :            :   The metric does not use the sample point functionality or the
      59                 :            :   compute_weighted_jacobian.  It evaluates the metric at
      60                 :            :   the element vertices, and uses the isotropic ideal element.
      61                 :            :   Optionally, the metric computation can be raised to the
      62                 :            :   'pow_dbl' power.  This does not necessarily raise the metric
      63                 :            :   value to the 'pow_dbl' power but instead raises each local
      64                 :            :   metric.  For example, if the corner inverse mean ratios of a quadraliteral
      65                 :            :   element were m1,m2,m3, and m4 and we set pow_dbl=2 and
      66                 :            :   used linear averaging, the metric value would then be
      67                 :            :   m = .25(m1*m1 + m2*m2 + m3*m3 + m4*m4).  The metric does
      68                 :            :   require a feasible region, and the metric needs to be minimized
      69                 :            :   if pow_dbl is greater than zero and maximized if pow_dbl
      70                 :            :   is less than zero.  pow_dbl being equal to zero is invalid.
      71                 :            : */
      72                 :            : class IdealWeightInverseMeanRatio : public ElementQM, public AveragingQM
      73                 :            : {
      74                 :            :   public:
      75                 :            :     MESQUITE_EXPORT IdealWeightInverseMeanRatio( MsqError& err, double power = 1.0 );
      76                 :            :     MESQUITE_EXPORT IdealWeightInverseMeanRatio();
      77                 :            : 
      78                 :            :     //! virtual destructor ensures use of polymorphism during destruction
      79 [ +  - ][ +  + ]:       1312 :     MESQUITE_EXPORT virtual ~IdealWeightInverseMeanRatio() {}
                 [ -  + ]
      80                 :            : 
      81                 :            :     virtual std::string get_name() const;
      82                 :            : 
      83                 :            :     //! 1 if metric should be minimized, -1 if metric should be maximized.
      84                 :            :     virtual int get_negate_flag() const;
      85                 :            : 
      86                 :            :     virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err );
      87                 :            : 
      88                 :            :     virtual bool evaluate_with_gradient( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      89                 :            :                                          std::vector< Vector3D >& gradient, MsqError& err );
      90                 :            : 
      91                 :            :     virtual bool evaluate_with_Hessian_diagonal( PatchData& pd, size_t handle, double& value,
      92                 :            :                                                  std::vector< size_t >& indices, std::vector< Vector3D >& gradient,
      93                 :            :                                                  std::vector< SymMatrix3D >& Hessian, MsqError& err );
      94                 :            : 
      95                 :            :     virtual bool evaluate_with_Hessian( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      96                 :            :                                         std::vector< Vector3D >& gradient, std::vector< Matrix3D >& Hessian,
      97                 :            :                                         MsqError& err );
      98                 :            : 
      99                 :            :   private:
     100                 :            :     //! Sets the power value in the metric computation.
     101                 :            :     void set_metric_power( double pow_dbl, MsqError& err );
     102                 :            : 
     103                 :            :     // arrays used in Hessian computations
     104                 :            :     // We allocate them here, so that one allocation only is done.
     105                 :            :     // This gives a big computation speed increase.
     106                 :            :     Vector3D mCoords[4];      // Vertex coordinates for the (decomposed) elements
     107                 :            :     Vector3D mGradients[32];  // Gradient of metric with respect to the coords
     108                 :            :     Matrix3D mHessians[80];   // Hessian of metric with respect to the coords
     109                 :            :     double mMetrics[8];       // Metric values for the (decomposed) elements
     110                 :            :                               // variables used in the definition of the metric (2d and 3d)
     111                 :            :     double a2Con;
     112                 :            :     Exponent b2Con;
     113                 :            :     Exponent c2Con;
     114                 :            : 
     115                 :            :     double a3Con;
     116                 :            :     Exponent b3Con;
     117                 :            :     Exponent c3Con;
     118                 :            : };
     119                 :            : }  // namespace MBMesquite
     120                 :            : 
     121                 :            : #endif  // IdealWeightInverseMeanRatio_hpp

Generated by: LCOV version 1.11