LCOV - code coverage report
Current view: top level - src/mesquite/TargetMetric/Misc - TOffset.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 14 34 41.2 %
Date: 2020-07-18 00:09:26 Functions: 6 10 60.0 %
Branches: 12 46 26.1 %

           Branch data     Line data    Source code
       1                 :            : /* *****************************************************************
       2                 :            :     MESQUITE -- The Mesh Quality Improvement Toolkit
       3                 :            : 
       4                 :            :     Copyright 2009 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                 :            :     (2009) [email protected]
      24                 :            : 
      25                 :            :   ***************************************************************** */
      26                 :            : 
      27                 :            : /** \file TOffset.cpp
      28                 :            :  *  \brief
      29                 :            :  *  \author Jason Kraftcheck
      30                 :            :  */
      31                 :            : 
      32                 :            : #include "Mesquite.hpp"
      33                 :            : #include "TOffset.hpp"
      34                 :            : #include "TMetricBarrier.hpp"
      35                 :            : #include "MsqMatrix.hpp"
      36                 :            : #include "MsqError.hpp"
      37                 :            : 
      38                 :            : namespace MBMesquite
      39                 :            : {
      40                 :            : 
      41                 :          1 : std::string TOffset::get_name() const
      42                 :            : {
      43 [ +  - ][ +  - ]:          1 :     return "offset(" + mMetric->get_name() + ')';
      44                 :            : }
      45                 :            : 
      46         [ -  + ]:          2 : TOffset::~TOffset() {}
      47                 :            : 
      48                 :        355 : bool TOffset::evaluate( const MsqMatrix< 2, 2 >& T, double& result, MsqError& err )
      49                 :            : {
      50                 :        355 :     bool rval = mMetric->evaluate( T, result, err );
      51 [ +  + ][ +  - ]:        355 :     MSQ_ERRZERO( err );
                 [ +  + ]
      52                 :        352 :     result += mAlpha;
      53                 :        352 :     return rval;
      54                 :            : }
      55                 :            : 
      56                 :        100 : bool TOffset::evaluate_with_grad( const MsqMatrix< 2, 2 >& T, double& result, MsqMatrix< 2, 2 >& deriv_wrt_T,
      57                 :            :                                   MsqError& err )
      58                 :            : {
      59                 :        100 :     bool rval = mMetric->evaluate_with_grad( T, result, deriv_wrt_T, err );
      60 [ -  + ][ #  # ]:        100 :     MSQ_ERRZERO( err );
                 [ -  + ]
      61                 :        100 :     result += mAlpha;
      62                 :        100 :     return rval;
      63                 :            : }
      64                 :            : 
      65                 :          0 : bool TOffset::evaluate_with_hess( const MsqMatrix< 2, 2 >& T, double& result, MsqMatrix< 2, 2 >& deriv_wrt_T,
      66                 :            :                                   MsqMatrix< 2, 2 > second_wrt_T[3], MsqError& err )
      67                 :            : {
      68                 :          0 :     bool rval = mMetric->evaluate_with_hess( T, result, deriv_wrt_T, second_wrt_T, err );
      69 [ #  # ][ #  # ]:          0 :     MSQ_ERRZERO( err );
                 [ #  # ]
      70                 :          0 :     result += mAlpha;
      71                 :          0 :     return rval;
      72                 :            : }
      73                 :            : 
      74                 :          0 : bool TOffset::evaluate( const MsqMatrix< 3, 3 >& T, double& result, MsqError& err )
      75                 :            : {
      76                 :          0 :     bool rval = mMetric->evaluate( T, result, err );
      77 [ #  # ][ #  # ]:          0 :     MSQ_ERRZERO( err );
                 [ #  # ]
      78                 :          0 :     result += mAlpha;
      79                 :          0 :     return rval;
      80                 :            : }
      81                 :            : 
      82                 :          0 : bool TOffset::evaluate_with_grad( const MsqMatrix< 3, 3 >& T, double& result, MsqMatrix< 3, 3 >& deriv_wrt_T,
      83                 :            :                                   MsqError& err )
      84                 :            : {
      85                 :          0 :     bool rval = mMetric->evaluate_with_grad( T, result, deriv_wrt_T, err );
      86 [ #  # ][ #  # ]:          0 :     MSQ_ERRZERO( err );
                 [ #  # ]
      87                 :          0 :     result += mAlpha;
      88                 :          0 :     return rval;
      89                 :            : }
      90                 :            : 
      91                 :          0 : bool TOffset::evaluate_with_hess( const MsqMatrix< 3, 3 >& T, double& result, MsqMatrix< 3, 3 >& deriv_wrt_T,
      92                 :            :                                   MsqMatrix< 3, 3 > second_wrt_T[6], MsqError& err )
      93                 :            : {
      94                 :          0 :     bool rval = mMetric->evaluate_with_hess( T, result, deriv_wrt_T, second_wrt_T, err );
      95 [ #  # ][ #  # ]:          0 :     MSQ_ERRZERO( err );
                 [ #  # ]
      96                 :          0 :     result += mAlpha;
      97                 :          0 :     return rval;
      98                 :            : }
      99                 :            : 
     100 [ +  - ][ +  - ]:          4 : }  // namespace MBMesquite

Generated by: LCOV version 1.11