LCOV - code coverage report
Current view: top level - ugbase/lib_grid/algorithms - problem_detection_util.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 23 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 5 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2014-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Sebastian Reiter
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : #include "problem_detection_util.h"
      34              : #include "lib_grid/grid_objects/tetrahedron_rules.h"
      35              : #include "common/math/misc/math_util.h"
      36              : #include "lib_grid/grid/grid.h"
      37              : #include "debug_util.h"
      38              : #include "isolated_elements.h"
      39              : 
      40              : namespace ug{
      41              : 
      42            0 : int IsSliver(const vector3& v0, const vector3& v1, const vector3& v2,
      43              :                           const vector3& v3, number thresholdRatio)
      44              : {
      45              :         using namespace tet_rules;
      46              :         vector3 v[] = {v0, v1, v2, v3};
      47              : 
      48              :         number maxLenSq = 0;
      49            0 :         for(int iedge = 0; iedge < NUM_EDGES; ++iedge){
      50            0 :                 maxLenSq = VecDistanceSq(v[EDGE_VRT_INDS[iedge][0]], v[EDGE_VRT_INDS[iedge][1]]);
      51              :         }
      52              : 
      53            0 :         number thresholdDist = sqrt(maxLenSq) * thresholdRatio;
      54              : 
      55            0 :         for(int iedge = 0; iedge + 1 < NUM_EDGES; ++iedge){
      56            0 :                 int iop = OPPOSED_EDGE[iedge];
      57            0 :                 if(iop > iedge){
      58            0 :                         number dist = DistanceLineToLine(v[EDGE_VRT_INDS[iedge][0]], v[EDGE_VRT_INDS[iedge][1]],
      59            0 :                                                                                          v[EDGE_VRT_INDS[iop][0]], v[EDGE_VRT_INDS[iop][1]]);
      60            0 :                         if(dist < thresholdDist)
      61            0 :                                 return iedge;
      62              :                 }
      63              :         }
      64              : 
      65              :         return -1;
      66              : }
      67              : 
      68              : 
      69              : template <class TSide>
      70            0 : static bool CheckForUnconnectedSidesIMPL(Grid& grid)
      71              : {
      72              :         bool gotOne = false;
      73              :         std::vector<TSide*> sides;
      74            0 :         if( CollectUnconnectedSides( sides,
      75              :                                                                  grid,
      76              :                                                                  grid.begin<TSide>(),
      77              :                                                                  grid.end<TSide>()))
      78              :         {
      79              :                 gotOne = true;
      80              :                 size_t numSides = sides.size();
      81              :                 UG_LOG("WARNING: Found " << numSides << " unconnected sides (those may lead to solver issues!): \n");
      82            0 :                 UG_ERR_LOG("Found " << numSides << " unconnected sides (those may lead to solver issues!): \n");
      83            0 :                 for(size_t i = 0; i < numSides; ++i){
      84            0 :                         UG_LOG("  - " << ElementDebugInfo(grid, sides[i]) << std::endl);
      85            0 :                         UG_ERR_LOG("  - " << ElementDebugInfo(grid, sides[i]) << std::endl);
      86              :                 }
      87              :         }
      88            0 :         return gotOne;
      89            0 : }
      90              : 
      91            0 : bool CheckForUnconnectedSides(Grid& grid)
      92              : {
      93            0 :         if(grid.num<Edge>() > 0 && CheckForUnconnectedSidesIMPL<Vertex>(grid))
      94              :                 return true;
      95            0 :         if(grid.num<Face>() > 0 && CheckForUnconnectedSidesIMPL<Edge>(grid))
      96              :                 return true;
      97            0 :         if(grid.num<Volume>() > 0 && CheckForUnconnectedSidesIMPL<Face>(grid))
      98              :                 return true;
      99              :         return false;
     100              : }
     101              : 
     102              : }//     end of namespace
        

Generated by: LCOV version 2.0-1