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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2012-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 "mg_hnode_adjuster.h"
      34              : #include "lib_grid/algorithms/debug_util.h"
      35              : 
      36              : namespace ug{
      37              : 
      38            0 : void MGHNodeAdjuster::
      39              : ref_marks_changed(IRefiner& ref,
      40              :                                   const std::vector<Vertex*>& vrts,
      41              :                                   const std::vector<Edge*>& edges,
      42              :                                   const std::vector<Face*>& faces,
      43              :                                   const std::vector<Volume*>& vols)
      44              : {
      45              :         UG_ASSERT(ref.grid(), "A refiner has to operate on a grid, before marks can be adjusted!");
      46            0 :         if(!ref.grid()){
      47            0 :                 return;
      48              :         }
      49              :         
      50            0 :         MultiGrid* pmg = dynamic_cast<MultiGrid*>(ref.grid());
      51              :         UG_ASSERT(pmg, "MGHNodeAdjuster can only operate on multi-grids, not on standard grids.");
      52            0 :         if(!pmg)
      53              :                 return;
      54              :         MultiGrid& mg = *pmg;
      55              : 
      56              : //      select all associated vertices of marked objects,
      57              : //      since we have to create new vertices in the next levels of the hierarchies.
      58              : //      only vertices which do not already have child vertices are selected.
      59            0 :         for(size_t i_edge = 0; i_edge < edges.size(); ++i_edge){
      60            0 :                 Edge* e = edges[i_edge];
      61            0 :                 for(size_t i = 0; i < e->num_vertices(); ++i){
      62            0 :                         if(!mg.has_children(e->vertex(i)))
      63            0 :                                 ref.mark(e->vertex(i));
      64              :                 }
      65              :         }
      66              : 
      67            0 :         for(size_t i_face = 0; i_face < faces.size(); ++i_face){
      68            0 :                 Face* f = faces[i_face];
      69            0 :                 for(size_t i = 0; i < f->num_vertices(); ++i){
      70            0 :                         if(!mg.has_children(f->vertex(i)))
      71            0 :                                 ref.mark(f->vertex(i));
      72              :                 }
      73              :         }
      74              : 
      75            0 :         for(size_t i_vol = 0; i_vol < vols.size(); ++i_vol){
      76            0 :                 Volume* v = vols[i_vol];
      77            0 :                 for(size_t i = 0; i < v->num_vertices(); ++i){
      78            0 :                         if(!mg.has_children(v->vertex(i)))
      79            0 :                                 ref.mark(v->vertex(i));
      80              :                 }
      81              :         }
      82              : 
      83              : 
      84              : //      since we have to make sure that surface elements which meet at a vertex have
      85              : //      a level-distance of at most 1, we now mark parent vertices of marked vertices
      86              : //      which are connected to a constrained edge.
      87              : //      Those marked parents are then used to mark associated edges, faces and volumes
      88              :         Grid::edge_traits::secure_container assEdges;
      89              :         Grid::face_traits::secure_container assFaces;
      90              :         Grid::volume_traits::secure_container assVols;
      91            0 :         for(size_t i_vrt = 0; i_vrt < vrts.size(); ++i_vrt){
      92            0 :                 Vertex* vrt = vrts[i_vrt];
      93            0 :                 if(vrt->is_constrained())
      94            0 :                         continue;
      95              : 
      96              :                 if(mg.num_child_vertices(vrt) > 0){
      97              :                 //      we have to mark all associated edges, faces and volumes
      98            0 :                         mg.associated_elements(assEdges, vrt);
      99            0 :                         for(size_t i = 0; i < assEdges.size(); ++i)
     100            0 :                                 if (ref.get_mark(assEdges[i]) == RM_NONE) // might already be marked RM_CLOSURE, do not overwrite
     101            0 :                                         ref.mark(assEdges[i]);
     102              :                         mg.associated_elements(assFaces, vrt);
     103            0 :                         for(size_t i = 0; i < assFaces.size(); ++i)
     104            0 :                                 if (ref.get_mark(assFaces[i]) == RM_NONE)
     105            0 :                                         ref.mark(assFaces[i]);
     106              :                         mg.associated_elements(assVols, vrt);
     107            0 :                         for(size_t i = 0; i < assVols.size(); ++i)
     108            0 :                                 if (ref.get_mark(assVols[i]) == RM_NONE)
     109            0 :                                         ref.mark(assVols[i]);
     110              :                 }
     111            0 :                 else if(ref.get_mark(vrt) != RM_DUMMY){
     112              :                 //      we don't have to select parents of dummy vertices, since we assume
     113              :                 //      that the maximum level-distance is 1
     114            0 :                         Vertex* parent = dynamic_cast<Vertex*>(mg.get_parent(vrt));
     115            0 :                         if(parent)
     116            0 :                                 ref.mark(parent, RM_DUMMY);
     117              :                 }
     118              :         }
     119              : }
     120              : }// end of namespace
        

Generated by: LCOV version 2.0-1