LCOV - code coverage report
Current view: top level - src/mesquite/QualityMetric - VertexPMeanP.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 3 44 6.8 %
Date: 2020-07-18 00:09:26 Functions: 4 11 36.4 %
Branches: 5 78 6.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 VertexPMeanP.cpp
      28                 :            :  *  \brief
      29                 :            :  *  \author Jason Kraftcheck
      30                 :            :  */
      31                 :            : 
      32                 :            : #include "Mesquite.hpp"
      33                 :            : #include "VertexPMeanP.hpp"
      34                 :            : #include "ElemSampleQM.hpp"
      35                 :            : #include "VertexQM.hpp"
      36                 :            : #include "MsqError.hpp"
      37                 :            : #include "PatchData.hpp"
      38                 :            : 
      39                 :            : namespace MBMesquite
      40                 :            : {
      41                 :            : 
      42 [ +  - ][ +  - ]:          1 : VertexPMeanP::VertexPMeanP( double p, ElemSampleQM* metric ) : PMeanPMetric( p ), mMetric( metric ) {}
      43                 :            : 
      44         [ -  + ]:          2 : VertexPMeanP::~VertexPMeanP() {}
      45                 :            : 
      46                 :          0 : std::string VertexPMeanP::get_name() const
      47                 :            : {
      48         [ #  # ]:          0 :     std::string result( "VertexPMeanP(" );
      49 [ #  # ][ #  # ]:          0 :     result += mMetric->get_name();
      50         [ #  # ]:          0 :     result += ")";
      51                 :          0 :     return result;
      52                 :            : }
      53                 :            : 
      54                 :          0 : int VertexPMeanP::get_negate_flag() const
      55                 :            : {
      56                 :          0 :     return mMetric->get_negate_flag();
      57                 :            : }
      58                 :            : 
      59                 :          0 : bool VertexPMeanP::evaluate( PatchData& pd, size_t handle, double& value, MsqError& err )
      60                 :            : {
      61                 :          0 :     mHandles.clear();
      62                 :          0 :     get_vertex_corner_handles( pd, handle, mHandles, err );
      63 [ #  # ][ #  # ]:          0 :     MSQ_ERRFALSE( err );
                 [ #  # ]
      64                 :          0 :     bool result = average( pd, get_quality_metric(), mHandles, value, err );
      65 [ #  # ][ #  # ]:          0 :     return !MSQ_CHKERR( err ) && result;
                 [ #  # ]
      66                 :            : }
      67                 :            : 
      68                 :          0 : bool VertexPMeanP::evaluate_with_indices( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      69                 :            :                                           MsqError& err )
      70                 :            : {
      71                 :          0 :     ElemSampleQM* qm = get_quality_metric();
      72                 :          0 :     mHandles.clear();
      73                 :          0 :     get_vertex_corner_handles( pd, handle, mHandles, err );
      74 [ #  # ][ #  # ]:          0 :     MSQ_ERRFALSE( err );
                 [ #  # ]
      75                 :          0 :     bool result = average_with_indices( pd, qm, mHandles, value, indices, err );
      76 [ #  # ][ #  # ]:          0 :     return !MSQ_CHKERR( err ) && result;
                 [ #  # ]
      77                 :            : }
      78                 :            : 
      79                 :          0 : bool VertexPMeanP::evaluate_with_gradient( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      80                 :            :                                            std::vector< Vector3D >& gradient, MsqError& err )
      81                 :            : {
      82                 :          0 :     ElemSampleQM* qm = get_quality_metric();
      83                 :          0 :     mHandles.clear();
      84                 :          0 :     get_vertex_corner_handles( pd, handle, mHandles, err );
      85 [ #  # ][ #  # ]:          0 :     MSQ_ERRFALSE( err );
                 [ #  # ]
      86                 :          0 :     bool result = average_with_gradient( pd, qm, mHandles, value, indices, gradient, err );
      87 [ #  # ][ #  # ]:          0 :     return !MSQ_CHKERR( err ) && result;
                 [ #  # ]
      88                 :            : }
      89                 :            : 
      90                 :          0 : bool VertexPMeanP::evaluate_with_Hessian( PatchData& pd, size_t handle, double& value, std::vector< size_t >& indices,
      91                 :            :                                           std::vector< Vector3D >& gradient, std::vector< Matrix3D >& Hessian,
      92                 :            :                                           MsqError& err )
      93                 :            : {
      94                 :          0 :     ElemSampleQM* qm = get_quality_metric();
      95                 :          0 :     mHandles.clear();
      96                 :          0 :     get_vertex_corner_handles( pd, handle, mHandles, err );
      97 [ #  # ][ #  # ]:          0 :     MSQ_ERRFALSE( err );
                 [ #  # ]
      98                 :          0 :     bool result = average_with_Hessian( pd, qm, mHandles, value, indices, gradient, Hessian, err );
      99 [ #  # ][ #  # ]:          0 :     return !MSQ_CHKERR( err ) && result;
                 [ #  # ]
     100                 :            : }
     101                 :            : 
     102                 :          0 : bool VertexPMeanP::evaluate_with_Hessian_diagonal( PatchData& pd, size_t handle, double& value,
     103                 :            :                                                    std::vector< size_t >& indices, std::vector< Vector3D >& gradient,
     104                 :            :                                                    std::vector< SymMatrix3D >& diagonal, MsqError& err )
     105                 :            : {
     106                 :          0 :     ElemSampleQM* qm = get_quality_metric();
     107                 :          0 :     mHandles.clear();
     108                 :          0 :     get_vertex_corner_handles( pd, handle, mHandles, err );
     109 [ #  # ][ #  # ]:          0 :     MSQ_ERRFALSE( err );
                 [ #  # ]
     110                 :          0 :     bool result = average_with_Hessian_diagonal( pd, qm, mHandles, value, indices, gradient, diagonal, err );
     111 [ #  # ][ #  # ]:          0 :     return !MSQ_CHKERR( err ) && result;
                 [ #  # ]
     112                 :            : }
     113                 :            : 
     114 [ +  - ][ +  - ]:          4 : }  // namespace MBMesquite

Generated by: LCOV version 1.11