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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2009-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Martin Stepniewski
       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 "grid_statistics.h"
      34              : #include "geom_obj_util/volume_util.h"
      35              : 
      36              : using namespace std;
      37              : 
      38              : namespace ug
      39              : {
      40              : //**********************************************************************
      41              : //**********************************************************************
      42              : //**********************************************************************
      43              : //**********************************************************************
      44              : //                                                              definitions
      45              : //**********************************************************************
      46              : //**********************************************************************
      47              : //**********************************************************************
      48              : //**********************************************************************
      49              : 
      50              : //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      51              : //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      52              : //      AssignTetrahedronAttributesByAspectRatio
      53              : /// assigns attributes to tetrahedral elements of a grid respecting their aspect ratio
      54            0 : bool AssignTetrahedronAttributesByAspectRatio(  Grid& grid,
      55              :                                                                                                 SubsetHandler& shVolume,
      56              :                                                                                                 AInt& aTetrahedronAspectRatioClass,
      57              :                                                                                                 vector<double>& offsets,
      58              :                                                                                                 Grid::VertexAttachmentAccessor<APosition>& aaPos)
      59              : {
      60            0 :         VolumeSelector VolumeSel(grid);
      61              :         Grid::VolumeAttachmentAccessor<AInt> aaTARC(grid, aTetrahedronAspectRatioClass);
      62              : 
      63              : //      order the volume subsets correctly, regarding user-specified aElementAttribute
      64            0 :         for(int i = 1; i < (int)offsets.size(); ++i)
      65              :         {
      66              :                 int moveTo = i;
      67            0 :                 for(int j = i-1; j >= 0; --j)
      68              :                 {
      69            0 :                         if(offsets[i] > offsets[j])
      70              :                                 moveTo = j;
      71              :                         else
      72              :                                 break;
      73              :                 }
      74              : 
      75            0 :                 if(moveTo != i)
      76              :                 {
      77            0 :                         swap(offsets[i], offsets[moveTo]);
      78              :                 }
      79              :         }
      80              : 
      81              : //      add zero as last offset
      82            0 :         offsets.push_back(0.0);
      83              : 
      84              : //      iterate through all tetrahedrons and assign attributes by their aspect ratio
      85            0 :         for(TetrahedronIterator vIter = grid.begin<Tetrahedron>(); vIter != grid.end<Tetrahedron>(); ++vIter)
      86              :         {
      87              :                 Tetrahedron* tet = *vIter;
      88            0 :                 number AspectRatio = CalculateTetrahedronAspectRatio(grid, tet, aaPos);
      89              : 
      90            0 :                 for(size_t i = 0; i<offsets.size(); ++i)
      91              :                 {
      92            0 :                         if(AspectRatio >= offsets[i])
      93              :                         {
      94            0 :                                 shVolume.assign_subset(tet, i);
      95            0 :                                 aaTARC[tet] = i;
      96            0 :                                 break;
      97              :                         }
      98              :                 }
      99              :         }
     100              : 
     101            0 :         return true;
     102              : }
     103              : 
     104              : }//     end of namespace
        

Generated by: LCOV version 2.0-1