LCOV - code coverage report
Current view: top level - src/mesquite/Misc - Vector3D.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 3 14 21.4 %
Date: 2020-07-18 00:09:26 Functions: 3 4 75.0 %
Branches: 2 16 12.5 %

           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                 :            : #include "Vector3D.hpp"
      28                 :            : #include "MsqError.hpp"
      29                 :            : 
      30                 :            : #include "moab/Util.hpp"
      31                 :            : 
      32                 :            : #include <iostream>
      33                 :            : #include <math.h>
      34                 :            : 
      35                 :            : #ifdef MSQ_HAVE_IEEEFP_H
      36                 :            : #include <ieeefp.h>
      37                 :            : #endif
      38                 :            : 
      39                 :            : namespace MBMesquite
      40                 :            : {
      41                 :            : 
      42                 :         27 : std::ostream& operator<<( std::ostream& s, const MBMesquite::Vector3D& v )
      43                 :            : {
      44                 :         27 :     return s << v[0] << ' ' << v[1] << ' ' << v[2];
      45                 :            : }
      46                 :            : 
      47                 :          0 : double Vector3D::interior_angle( const Vector3D& lhs, const Vector3D& rhs, MsqError& err )
      48                 :            : {
      49                 :          0 :     double len1      = lhs.length();
      50                 :          0 :     double len2      = rhs.length();
      51                 :          0 :     double angle_cos = ( lhs % rhs ) / ( len1 * len2 );
      52         [ #  # ]:          0 :     if( !moab::Util::is_finite( angle_cos ) )
      53                 :            :     {
      54         [ #  # ]:          0 :         MSQ_SETERR( err )( MsqError::INTERNAL_ERROR );
      55                 :          0 :         return 0.0;
      56                 :            :     }
      57                 :            : 
      58                 :            :     // Adjust the cosine if slightly out of range
      59 [ #  # ][ #  # ]:          0 :     if( ( angle_cos > 1.0 ) && ( angle_cos < 1.0001 ) ) { angle_cos = 1.0; }
      60 [ #  # ][ #  # ]:          0 :     else if( angle_cos < -1.0 && angle_cos > -1.0001 )
      61                 :            :     {
      62                 :          0 :         angle_cos = -1.0;
      63                 :            :     }
      64                 :            : 
      65                 :          0 :     return std::acos( angle_cos );
      66                 :            : }
      67                 :            : 
      68 [ +  - ][ +  - ]:        120 : }  // namespace MBMesquite

Generated by: LCOV version 1.11