LCOV - code coverage report
Current view: top level - src/mesquite/QualityImprover/Relaxation - LaplacianSmoother.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 16 18 88.9 %
Date: 2020-07-18 00:09:26 Functions: 4 5 80.0 %
Branches: 23 54 42.6 %

           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                 :            : /*!
      28                 :            :   \file   LaplacianSmoother.cpp
      29                 :            :   \brief
      30                 :            : 
      31                 :            :   The LaplacianSmoother Class is the concrete class
      32                 :            :   that performs Laplacian Smoothing
      33                 :            : 
      34                 :            :   \author Thomas Leurent
      35                 :            :   \date   2002-01-17
      36                 :            : */
      37                 :            : 
      38                 :            : #include "LaplacianSmoother.hpp"
      39                 :            : #include "PatchData.hpp"
      40                 :            : #include "MsqVertex.hpp"
      41                 :            : 
      42                 :            : namespace MBMesquite
      43                 :            : {
      44                 :            : 
      45                 :          0 : std::string LaplacianSmoother::get_name() const
      46                 :            : {
      47         [ #  # ]:          0 :     return "LaplacianSmoother";
      48                 :            : }
      49                 :            : 
      50         [ -  + ]:         12 : LaplacianSmoother::~LaplacianSmoother() {}
      51                 :            : 
      52                 :     768877 : void LaplacianSmoother::optimize_vertex_positions( PatchData& pd, MsqError& err )
      53                 :            : {
      54 [ +  - ][ -  + ]:     768877 :     assert( pd.num_free_vertices() == 1 );
      55                 :     768877 :     const size_t center_vtx_index = 0;
      56                 :            : 
      57                 :     768877 :     adjVtxList.clear();
      58 [ +  - ][ +  - ]:    1537754 :     pd.get_adjacent_vertex_indices( center_vtx_index, adjVtxList, err );MSQ_ERRRTN( err );
         [ -  + ][ #  # ]
         [ #  # ][ -  + ]
      59                 :            : 
      60         [ -  + ]:     768877 :     if( adjVtxList.empty() ) return;
      61                 :            : 
      62         [ +  - ]:     768877 :     const MsqVertex* verts = pd.get_vertex_array( err );
      63                 :     768877 :     const size_t n         = adjVtxList.size();
      64                 :            : 
      65 [ +  - ][ +  - ]:     768877 :     Vector3D new_pos = verts[adjVtxList[0]];
      66         [ +  + ]:    3075008 :     for( size_t i = 1; i < n; ++i )
      67 [ +  - ][ +  - ]:    2306131 :         new_pos += verts[adjVtxList[i]];
      68         [ +  - ]:     768877 :     new_pos *= 1.0 / n;
      69         [ +  - ]:     768877 :     pd.set_vertex_coordinates( new_pos, center_vtx_index, err );
      70 [ +  - ][ +  - ]:     768877 :     pd.snap_vertex_to_domain( center_vtx_index, err );MSQ_ERRRTN( err );
         [ -  + ][ #  # ]
         [ #  # ][ -  + ]
      71                 :            : }
      72                 :            : 
      73 [ +  - ][ +  - ]:         16 : }  // namespace MBMesquite

Generated by: LCOV version 1.11