LCOV - code coverage report
Current view: top level - src/mesquite/QualityMetric - ElementPMeanP.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 31 38 81.6 %
Date: 2020-07-18 00:09:26 Functions: 9 10 90.0 %
Branches: 24 66 36.4 %

           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 ElementPMeanP.cpp
      28                 :            :  *  \brief
      29                 :            :  *  \author Jason Kraftcheck
      30                 :            :  */
      31                 :            : 
      32                 :            : #include "Mesquite.hpp"
      33                 :            : #include "ElementPMeanP.hpp"
      34                 :            : #include "ElemSampleQM.hpp"
      35                 :            : #include "MsqError.hpp"
      36                 :            : #include "PatchData.hpp"
      37                 :            : 
      38                 :            : namespace MBMesquite
      39                 :            : {
      40                 :            : 
      41 [ +  - ][ +  - ]:         45 : ElementPMeanP::ElementPMeanP( double p, ElemSampleQM* metric ) : PMeanPMetric( p ), mMetric( metric ) {}
      42                 :            : 
      43         [ -  + ]:         90 : ElementPMeanP::~ElementPMeanP() {}
      44                 :            : 
      45                 :         34 : std::string ElementPMeanP::get_name() const
      46                 :            : {
      47         [ +  - ]:         34 :     std::string result( "ElementPMeanP(" );
      48 [ +  - ][ +  - ]:         34 :     result += mMetric->get_name();
      49         [ +  - ]:         34 :     result += ")";
      50                 :         34 :     return result;
      51                 :            : }
      52                 :            : 
      53                 :     411266 : int ElementPMeanP::get_negate_flag() const
      54                 :            : {
      55                 :     411266 :     return get_quality_metric()->get_negate_flag();
      56                 :            : }
      57                 :            : 
      58                 :    4360452 : bool ElementPMeanP::evaluate( PatchData& pd, size_t handle, double& value, MsqError& err )
      59                 :            : {
      60                 :    4360452 :     ElemSampleQM* qm = get_quality_metric();
      61                 :    4360452 :     mHandles.clear();
      62                 :    4360452 :     qm->get_element_evaluations( pd, handle, mHandles, err );
      63 [ -  + ][ #  # ]:    4360452 :     MSQ_ERRFALSE( err );
                 [ -  + ]
      64                 :    4360452 :     bool result = average( pd, qm, mHandles, value, err );
      65 [ +  + ][ -  + ]:    4360452 :     return !MSQ_CHKERR( err ) && result;
                 [ +  + ]
      66                 :            : }
      67                 :            : 
      68                 :     741906 : bool ElementPMeanP::evaluate_with_gradient( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      69                 :            :                                             std::vector< Vector3D >& gradient, MsqError& err )
      70                 :            : {
      71                 :     741906 :     ElemSampleQM* qm = get_quality_metric();
      72                 :     741906 :     mHandles.clear();
      73                 :     741906 :     qm->get_element_evaluations( pd, handle, mHandles, err );
      74 [ -  + ][ #  # ]:     741906 :     MSQ_ERRFALSE( err );
                 [ -  + ]
      75                 :     741906 :     bool result = average_with_gradient( pd, qm, mHandles, value, indices, gradient, err );
      76 [ -  + ][ #  # ]:     741906 :     return !MSQ_CHKERR( err ) && result;
                 [ +  - ]
      77                 :            : }
      78                 :            : 
      79                 :     124856 : bool ElementPMeanP::evaluate_with_Hessian( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      80                 :            :                                            std::vector< Vector3D >& gradient, std::vector< Matrix3D >& Hessian,
      81                 :            :                                            MsqError& err )
      82                 :            : {
      83                 :     124856 :     ElemSampleQM* qm = get_quality_metric();
      84                 :     124856 :     mHandles.clear();
      85                 :     124856 :     qm->get_element_evaluations( pd, handle, mHandles, err );
      86 [ -  + ][ #  # ]:     124856 :     MSQ_ERRFALSE( err );
                 [ -  + ]
      87                 :     124856 :     bool result = average_with_Hessian( pd, qm, mHandles, value, indices, gradient, Hessian, err );
      88 [ -  + ][ #  # ]:     124856 :     return !MSQ_CHKERR( err ) && result;
                 [ +  - ]
      89                 :            : }
      90                 :            : 
      91                 :          0 : bool ElementPMeanP::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 >& diagonal, MsqError& err )
      94                 :            : {
      95                 :          0 :     ElemSampleQM* qm = get_quality_metric();
      96                 :          0 :     mHandles.clear();
      97                 :          0 :     qm->get_element_evaluations( pd, handle, mHandles, err );
      98 [ #  # ][ #  # ]:          0 :     MSQ_ERRFALSE( err );
                 [ #  # ]
      99                 :          0 :     bool result = average_with_Hessian_diagonal( pd, qm, mHandles, value, indices, gradient, diagonal, err );
     100 [ #  # ][ #  # ]:          0 :     return !MSQ_CHKERR( err ) && result;
                 [ #  # ]
     101                 :            : }
     102                 :            : 
     103 [ +  - ][ +  - ]:        120 : }  // namespace MBMesquite

Generated by: LCOV version 1.11