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

           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 IdealWeightMeanRatio.hpp
      31                 :            : 
      32                 :            : Header file for the MBMesquite::IdealWeightMeanRatio class
      33                 :            : 
      34                 :            : \author Michael Brewer
      35                 :            : \author Todd Munson
      36                 :            : \date   2002-11-11
      37                 :            :  */
      38                 :            : 
      39                 :            : #ifndef IdealWeightMeanRatio_hpp
      40                 :            : #define IdealWeightMeanRatio_hpp
      41                 :            : 
      42                 :            : #include "Mesquite.hpp"
      43                 :            : #include "MsqError.hpp"
      44                 :            : #include "ElementQM.hpp"
      45                 :            : #include "AveragingQM.hpp"
      46                 :            : #include "Vector3D.hpp"
      47                 :            : #include "Matrix3D.hpp"
      48                 :            : #include "Exponent.hpp"
      49                 :            : 
      50                 :            : namespace MBMesquite
      51                 :            : {
      52                 :            : /*! \class IdealWeightMeanRatio
      53                 :            :   \brief Computes the mean ratio quality metric
      54                 :            :   of given element.
      55                 :            : 
      56                 :            :   The metric does not use the sample point functionality or the
      57                 :            :   compute_weighted_jacobian.  It evaluates the metric at
      58                 :            :   the element vertices, and uses the isotropic ideal element.
      59                 :            :   It does require a feasible region, and the metric needs
      60                 :            :   to be maximized.
      61                 :            : */
      62                 :            : class IdealWeightMeanRatio : public ElementQM, public AveragingQM
      63                 :            : {
      64                 :            :   public:
      65                 :          2 :     MESQUITE_EXPORT IdealWeightMeanRatio()
      66                 :            :         : AveragingQM( QualityMetric::LINEAR ), a2Con( 2.0 ), b2Con( -1.0 ), c2Con( 1.0 ), a3Con( 3.0 ), b3Con( -1.0 ),
      67 [ +  - ][ +  - ]:        234 :           c3Con( 2.0 / 3.0 )
         [ +  + ][ +  - ]
         [ +  + ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  #  #  
             #  #  #  # ]
      68                 :            :     {
      69         [ #  # ]:          2 :     }
      70                 :            : 
      71                 :            :     //! virtual destructor ensures use of polymorphism during destruction
      72 [ +  - ][ +  + ]:        164 :     MESQUITE_EXPORT virtual ~IdealWeightMeanRatio() {}
                 [ -  + ]
      73                 :            : 
      74                 :            :     virtual std::string get_name() const;
      75                 :            : 
      76                 :            :     //! 1 if metric should be minimized, -1 if metric should be maximized.
      77                 :            :     virtual int get_negate_flag() const;
      78                 :            : 
      79                 :            :     virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err );
      80                 :            : 
      81                 :            :     virtual bool evaluate_with_gradient( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      82                 :            :                                          std::vector< Vector3D >& gradient, MsqError& err );
      83                 :            : 
      84                 :            :     virtual bool evaluate_with_Hessian_diagonal( PatchData& pd, size_t handle, double& value,
      85                 :            :                                                  std::vector< size_t >& indices, std::vector< Vector3D >& gradient,
      86                 :            :                                                  std::vector< SymMatrix3D >& Hessian, MsqError& err );
      87                 :            : 
      88                 :            :     virtual bool evaluate_with_Hessian( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      89                 :            :                                         std::vector< Vector3D >& gradient, std::vector< Matrix3D >& Hessian,
      90                 :            :                                         MsqError& err );
      91                 :            : 
      92                 :            :   private:
      93                 :            :     // arrays used in Hessian computations
      94                 :            :     // We allocate them here, so that one allocation only is done.
      95                 :            :     // This gives a big computation speed increase.
      96                 :            :     Vector3D mCoords[4];      // Vertex coordinates for the (decomposed) elements
      97                 :            :     Vector3D mGradients[32];  // Gradient of metric with respect to the coords
      98                 :            :     Matrix3D mHessians[80];   // Hessian of metric with respect to the coords
      99                 :            :     double mMetrics[8];       // Metric values for the (decomposed) elements
     100                 :            : 
     101                 :            :     const double a2Con;
     102                 :            :     const Exponent b2Con;
     103                 :            :     const Exponent c2Con;
     104                 :            : 
     105                 :            :     const double a3Con;
     106                 :            :     const Exponent b3Con;
     107                 :            :     const Exponent c3Con;
     108                 :            : };
     109                 :            : }  // namespace MBMesquite
     110                 :            : 
     111                 :            : #endif  // IdealWeightMeanRatio_hpp

Generated by: LCOV version 1.11