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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2017:  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 "local_mark_adjuster.h"
      34              : 
      35              : namespace ug{
      36              :         
      37            0 : void LocalMarkAdjuster::
      38              : ref_marks_changed(IRefiner& ref,
      39              :                                   const std::vector<Vertex*>& vrts,
      40              :                                   const std::vector<Edge*>& edges,
      41              :                                   const std::vector<Face*>& faces,
      42              :                                   const std::vector<Volume*>& vols)
      43              : {
      44            0 :         if(!ref.grid())
      45            0 :                 return;
      46            0 :         Grid& grid = *ref.grid();
      47              : 
      48              :         Grid::edge_traits::secure_container             assEdges;
      49              :         
      50            0 :         for(size_t iface = 0; iface < faces.size(); ++iface){
      51            0 :                 Face* f = faces[iface];
      52            0 :                 if(ref.marked_local(f)){
      53              :                         grid.associated_elements_sorted(assEdges, f);
      54              :                         const size_t numEdges = f->num_edges();
      55            0 :                         for(size_t iedge = 0; iedge < numEdges; ++iedge){
      56              :                                 Edge* e = assEdges[iedge];
      57            0 :                                 if(ref.get_local_edge_mark(f, e)){
      58            0 :                                         if(!ref.marked_full(e))
      59            0 :                                                 ref.mark(e, RM_FULL);
      60              :                                 }
      61              :                         }
      62              : 
      63            0 :                         if(f->is_constraining()){
      64              :                         //      check which edges are also constraining and have a constrained
      65              :                         //      vertex. If the local mark does not match those constraints,
      66              :                         //      we have to perform a full refine.
      67              :                         //todo: instead of a full refine, only regularize associated vol-marks?
      68              :                                 int constraintMark = 0;
      69            0 :                                 for(size_t iedge = 0; iedge < numEdges; ++iedge){
      70            0 :                                         if(ConstrainingEdge* cge =
      71            0 :                                                         dynamic_cast<ConstrainingEdge*>(assEdges[iedge]))
      72              :                                         {
      73            0 :                                                 if(cge->num_constrained_vertices())
      74            0 :                                                         constraintMark |= (1<<iedge);
      75              :                                         }
      76              :                                 }
      77              : 
      78            0 :                                 if((constraintMark & ref.get_local_mark(f)) != constraintMark){
      79            0 :                                         ref.mark(f, RM_FULL);
      80              :                                 }
      81              :                         }
      82              :                 }
      83              : 
      84              :         }
      85              : 
      86              : 
      87              : 
      88              :         Grid::face_traits::secure_container             assFaces;
      89              :         std::vector<int>  vinds;
      90            0 :         vinds.reserve(4);
      91              : 
      92            0 :         for(size_t ivol = 0; ivol < vols.size(); ++ivol){
      93            0 :                 Volume* vol = vols[ivol];
      94            0 :                 if(!ref.marked_local(vol))
      95            0 :                         continue;
      96              : 
      97            0 :                 const size_t numEdges = vol->num_edges();
      98            0 :                 for(size_t iedge = 0; iedge < numEdges; ++iedge){
      99            0 :                         Edge* e = grid.get_edge(vol, iedge);
     100            0 :                         if(!ref.get_local_edge_mark(vol, e))
     101            0 :                                 continue;
     102              : 
     103            0 :                         const RefinementMark edgeMark = ref.get_mark(e);
     104              : 
     105            0 :                         if(edgeMark != RM_FULL)
     106            0 :                                 ref.mark(e, RM_FULL);
     107              :                 }
     108              : 
     109              :                 grid.associated_elements(assFaces, vol);
     110            0 :                 for(size_t iface = 0; iface < assFaces.size(); ++iface){
     111              :                         Face* f = assFaces[iface];
     112            0 :                         const int sideMark = ref.get_local_face_mark(vol, f);
     113            0 :                         if(sideMark){
     114            0 :                                 const int curMark = ref.get_mark(f);
     115            0 :                                 if(curMark == RM_FULL)
     116            0 :                                         continue;
     117            0 :                                 else if(curMark < RM_LOCAL){
     118            0 :                                         ref.mark_local(f, sideMark);
     119              :                                 }
     120              :                                 else{
     121            0 :                                         int curLocal = ref.get_local_mark(f);
     122              : 
     123            0 :                                         if(curLocal != sideMark){
     124            0 :                                                 if((curLocal & sideMark) == curLocal){
     125              :                                                 //      curLocal is contained in sideMark
     126            0 :                                                         ref.mark_local(f, sideMark);
     127              :                                                 }
     128            0 :                                                 else if((curLocal & sideMark) != sideMark){
     129              :                                                 //      we have to fully refine the face, since aniso-marks do not match
     130            0 :                                                         ref.mark(f, RM_FULL);
     131              :                                                 }
     132              :                                         }
     133              :                                 }
     134              :                         }
     135              :                 }
     136              :         }
     137            0 : }
     138              : 
     139              : }//     end of namespace
        

Generated by: LCOV version 2.0-1