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

           Branch data     Line data    Source code
       1                 :            : /* *****************************************************************
       2                 :            :     MESQUITE -- The Mesh Quality Improvement Toolkit
       3                 :            : 
       4                 :            :     Copyright 2006 Sandia National Laboratories.  Developed at the
       5                 :            :     University of Wisconsin--Madison under SNL contract number
       6                 :            :     624796.  The U.S. Government and the University of Wisconsin
       7                 :            :     retain certain rights to 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                 :            :     (2006) [email protected]
      24                 :            : 
      25                 :            :   ***************************************************************** */
      26                 :            : 
      27                 :            : /** \file TQualityMetric.hpp
      28                 :            :  *  \brief
      29                 :            :  *  \author Jason Kraftcheck
      30                 :            :  */
      31                 :            : 
      32                 :            : #ifndef MSQ_T_QUALITY_METRIC_HPP
      33                 :            : #define MSQ_T_QUALITY_METRIC_HPP
      34                 :            : 
      35                 :            : #include "Mesquite.hpp"
      36                 :            : #include "TMPQualityMetric.hpp"
      37                 :            : #include "MsqMatrix.hpp"
      38                 :            : 
      39                 :            : namespace MBMesquite
      40                 :            : {
      41                 :            : 
      42                 :            : class TMetric;
      43                 :            : 
      44                 :            : /**\brief Compare targets to mapping function Jacobian matrices
      45                 :            :  *
      46                 :            :  * A quality metric defined using 2D and 3D target metrics,
      47                 :            :  * where the active (A) matrix compared to the target by
      48                 :            :  * the underlying metrics is the Jacobian matrix of the
      49                 :            :  * mapping function at a given sample point.  For surface
      50                 :            :  * elements, A is rotated to align the normal with W, such that
      51                 :            :  * both matrices can be reduced from 3x2 to 2x2.
      52                 :            :  */
      53         [ -  + ]:        148 : class TQualityMetric : public TMPQualityMetric
      54                 :            : {
      55                 :            :   public:
      56                 :            :     /** Used in tests and other templatized code */
      57                 :            :     typedef TMetric MetricType;
      58                 :            : 
      59                 :            :     /**
      60                 :            :      *\param tc   The target calculator
      61                 :            :      *\param wc   The weight calculator
      62                 :            :      *\param target_metric The target metric
      63                 :            :      */
      64                 :          7 :     TQualityMetric( TargetCalculator* tc, WeightCalculator* wc, TMetric* target_metric )
      65                 :          7 :         : TMPQualityMetric( tc, wc ), targetMetric( target_metric )
      66                 :            :     {
      67                 :          7 :     }
      68                 :            : 
      69                 :            :     /**
      70                 :            :      *\param tc   The target calculator
      71                 :            :      *\param target_metric The target metric
      72                 :            :      */
      73                 :         72 :     TQualityMetric( TargetCalculator* tc, TMetric* target_metric )
      74                 :         72 :         : TMPQualityMetric( tc, 0 ), targetMetric( target_metric )
      75                 :            :     {
      76                 :         72 :     }
      77                 :            : 
      78                 :            :     MESQUITE_EXPORT virtual std::string get_name() const;
      79                 :            : 
      80                 :            :     MESQUITE_EXPORT virtual bool evaluate_with_gradient( PatchData& pd, size_t handle, double& value,
      81                 :            :                                                          std::vector< size_t >& indices,
      82                 :            :                                                          std::vector< Vector3D >& gradient, MsqError& err );
      83                 :            : 
      84                 :            :     MESQUITE_EXPORT virtual bool evaluate_with_Hessian_diagonal( PatchData& pd, size_t handle, double& value,
      85                 :            :                                                                  std::vector< size_t >& indices,
      86                 :            :                                                                  std::vector< Vector3D >& gradient,
      87                 :            :                                                                  std::vector< SymMatrix3D >& Hessian_diagonal,
      88                 :            :                                                                  MsqError& err );
      89                 :            : 
      90                 :            :     MESQUITE_EXPORT virtual bool evaluate_with_Hessian( PatchData& pd, size_t handle, double& value,
      91                 :            :                                                         std::vector< size_t >& indices,
      92                 :            :                                                         std::vector< Vector3D >& gradient,
      93                 :            :                                                         std::vector< Matrix3D >& Hessian, MsqError& err );
      94                 :            : 
      95                 :        160 :     TMetric* get_target_metric() const
      96                 :            :     {
      97                 :        160 :         return targetMetric;
      98                 :            :     }
      99                 :            :     void set_target_metric( TMetric* m )
     100                 :            :     {
     101                 :            :         targetMetric = m;
     102                 :            :     }
     103                 :            : 
     104                 :            :   protected:
     105                 :            :     MESQUITE_EXPORT virtual bool evaluate_internal( PatchData& pd, size_t handle, double& value, size_t* indices,
     106                 :            :                                                     size_t& num_indices, MsqError& err );
     107                 :            : 
     108                 :            :   private:
     109                 :            :     TMetric* targetMetric;
     110                 :            : };
     111                 :            : 
     112                 :            : }  // namespace MBMesquite
     113                 :            : 
     114                 :            : #endif

Generated by: LCOV version 1.11