LCOV - code coverage report
Current view: top level - src/mesquite/Wrappers - SizeAdaptShapeWrapper.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 28 28 100.0 %
Date: 2020-07-18 00:09:26 Functions: 3 3 100.0 %
Branches: 56 128 43.8 %

           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 SizeAdaptShapeWrapper.cpp
      28                 :            :  *  \brief
      29                 :            :  *  \author Jason Kraftcheck
      30                 :            :  */
      31                 :            : 
      32                 :            : #include "Mesquite.hpp"
      33                 :            : #include "SizeAdaptShapeWrapper.hpp"
      34                 :            : 
      35                 :            : #include "TerminationCriterion.hpp"
      36                 :            : #include "InstructionQueue.hpp"
      37                 :            : #include "QualityAssessor.hpp"
      38                 :            : #include "MeshImpl.hpp"
      39                 :            : #include "PlanarDomain.hpp"
      40                 :            : 
      41                 :            : #include "PMeanPTemplate.hpp"
      42                 :            : #include "ElementPMeanP.hpp"
      43                 :            : #include "TrustRegion.hpp"
      44                 :            : #include "TQualityMetric.hpp"
      45                 :            : #include "IdealShapeTarget.hpp"
      46                 :            : #include "TShapeSizeB1.hpp"
      47                 :            : #include "RefMeshTargetCalculator.hpp"
      48                 :            : #include "ReferenceMesh.hpp"
      49                 :            : #include "TagVertexMesh.hpp"
      50                 :            : #include "LambdaTarget.hpp"
      51                 :            : #include "EdgeLengthMetric.hpp"
      52                 :            : 
      53                 :            : namespace MBMesquite
      54                 :            : {
      55                 :            : 
      56                 :          3 : void SizeAdaptShapeWrapper::run_wrapper( MeshDomainAssoc* mesh_and_domain, ParallelMesh* pmesh, Settings* settings,
      57                 :            :                                          QualityAssessor* qa, MsqError& err )
      58                 :            : {
      59         [ +  - ]:          3 :     InstructionQueue q;
      60         [ +  - ]:          3 :     Mesh* mesh = mesh_and_domain->get_mesh();
      61                 :            : 
      62                 :            :     // calculate average lambda for mesh
      63 [ +  - ][ +  - ]:          6 :     TagVertexMesh init_mesh( err, mesh );MSQ_ERRRTN( err );
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ -  + ][ +  - ]
      64 [ +  - ][ +  - ]:          6 :     ReferenceMesh ref_mesh( &init_mesh );
      65 [ +  - ][ +  - ]:          6 :     RefMeshTargetCalculator W_0( &ref_mesh );
      66 [ +  - ][ +  - ]:          3 :     q.add_tag_vertex_mesh( &init_mesh, err );MSQ_ERRRTN( err );
         [ -  + ][ #  # ]
         [ #  # ][ -  + ]
      67                 :            : 
      68                 :            :     // create objective function
      69         [ +  - ]:          3 :     IdealShapeTarget W_i;
      70 [ +  - ][ +  - ]:          6 :     LambdaTarget W( &W_0, &W_i );
      71         [ +  - ]:          3 :     TShapeSizeB1 tm;
      72 [ +  - ][ +  - ]:          6 :     TQualityMetric mu_0( &W, &tm );
      73 [ +  - ][ +  - ]:          6 :     ElementPMeanP mu( 1.0, &mu_0 );
      74 [ +  - ][ +  - ]:          6 :     PMeanPTemplate of( 1.0, &mu );
      75                 :            : 
      76                 :            :     // create quality assessor
      77 [ +  - ][ +  - ]:          6 :     EdgeLengthMetric len( 0.0 );
      78         [ +  - ]:          3 :     qa->add_quality_assessment( &mu );
      79         [ +  - ]:          3 :     qa->add_quality_assessment( &len );
      80         [ +  - ]:          3 :     q.add_quality_assessor( qa, err );
      81                 :            : 
      82                 :            :     // create solver
      83 [ +  - ][ +  - ]:          6 :     TrustRegion solver( &of );
      84 [ +  - ][ +  - ]:          6 :     TerminationCriterion tc, ptc;
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      85         [ +  - ]:          3 :     tc.add_absolute_vertex_movement( maxVtxMovement );
      86         [ +  - ]:          3 :     tc.add_iteration_limit( iterationLimit );
      87 [ -  + ][ +  - ]:          3 :     ptc.add_iteration_limit( pmesh ? parallelIterations : 1 );
      88         [ +  - ]:          3 :     solver.set_inner_termination_criterion( &tc );
      89         [ +  - ]:          3 :     solver.set_outer_termination_criterion( &ptc );
      90 [ +  - ][ +  - ]:          3 :     q.set_master_quality_improver( &solver, err );MSQ_ERRRTN( err );
         [ -  + ][ #  # ]
         [ #  # ][ -  + ]
      91         [ +  - ]:          3 :     q.add_quality_assessor( qa, err );
      92                 :            : 
      93                 :            :     // Optimize mesh
      94 [ +  - ][ +  - ]:          6 :     q.run_common( mesh_and_domain, pmesh, settings, err );MSQ_CHKERR( err );
         [ -  + ][ #  # ]
         [ #  # ][ +  - ]
      95                 :            : }
      96                 :            : 
      97 [ +  - ][ +  - ]:          8 : }  // namespace MBMesquite

Generated by: LCOV version 1.11