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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2010-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              : #ifndef __H__LIBGRID__SELECTOR_INTERFACE_IMPL__
      34              : #define __H__LIBGRID__SELECTOR_INTERFACE_IMPL__
      35              : 
      36              : namespace ug
      37              : {
      38              : inline bool
      39              : ISelector::elements_are_supported(uint shElements) const
      40              : {
      41            0 :         return (m_supportedElements & shElements) == shElements;
      42              : }
      43              : 
      44              : template <class TElem>
      45            0 : inline void ISelector::select(TElem* elem, byte status){
      46            0 :         if(status != 0){
      47            0 :                 if(!is_selected(elem)){
      48            0 :                         add_to_list(elem);
      49              :                 }
      50              :                 mark_selected(elem, status);
      51              :         }
      52              :         else
      53            0 :                 deselect(elem);
      54            0 : }
      55              : 
      56            0 : inline void ISelector::select(GridObject* elem, byte status){
      57            0 :         int elemID = elem->base_object_id();
      58            0 :         switch(elemID){
      59            0 :                 case VERTEX:
      60            0 :                         select(static_cast<Vertex*>(elem), status);
      61            0 :                         break;
      62            0 :                 case EDGE:
      63            0 :                         select(static_cast<Edge*>(elem), status);
      64            0 :                         break;
      65            0 :                 case FACE:
      66            0 :                         select(static_cast<Face*>(elem), status);
      67            0 :                         break;
      68            0 :                 case VOLUME:
      69            0 :                         select(static_cast<Volume*>(elem), status);
      70            0 :                         break;
      71              :                 default:
      72              :                         LOG("  ERROR: Bad Element Type in ISelector::select. Aborting.\n");
      73              :                         assert(0);
      74              :                         break;
      75              :         }
      76            0 : }
      77              : 
      78              : template <class TIterator>
      79            0 : inline void ISelector::select(TIterator iterBegin, TIterator iterEnd, byte status)
      80              : {
      81            0 :         while(iterBegin != iterEnd){
      82            0 :                 select(*iterBegin, status);
      83            0 :                 iterBegin++;
      84              :         }
      85            0 : }
      86              : 
      87              : 
      88              : template <class TElem>
      89            0 : inline void ISelector::deselect(TElem* elem){
      90            0 :         if(is_selected(elem)){
      91            0 :                 erase_from_list(elem);
      92              :                 mark_deselected(elem);
      93              :         }
      94            0 : }
      95              : 
      96              : inline void ISelector::deselect(GridObject* elem){
      97              :         int elemID = elem->base_object_id();
      98              :         switch(elemID){
      99              :                 case VERTEX:
     100              :                         deselect(static_cast<Vertex*>(elem));
     101              :                         break;
     102              :                 case EDGE:
     103              :                         deselect(static_cast<Edge*>(elem));
     104              :                         break;
     105              :                 case FACE:
     106              :                         deselect(static_cast<Face*>(elem));
     107              :                         break;
     108              :                 case VOLUME:
     109              :                         deselect(static_cast<Volume*>(elem));
     110              :                         break;
     111              :         }
     112              : }
     113              : 
     114              : template <class TIterator>
     115              : inline void ISelector::deselect(TIterator iterBegin, TIterator iterEnd)
     116              : {
     117            0 :         while(iterBegin != iterEnd){
     118            0 :                 typename TIterator::value_type val = *iterBegin;
     119              :                 ++iterBegin;
     120            0 :                 deselect(val);
     121              :         }
     122              : }
     123              : 
     124              : 
     125            0 : byte ISelector::get_selection_status(GridObject* elem) const{
     126            0 :         int elemID = elem->base_object_id();
     127            0 :         switch(elemID){
     128              :                 case VERTEX:
     129              :                         return get_selection_status(static_cast<Vertex*>(elem));
     130              :                 case EDGE:
     131              :                         return get_selection_status(static_cast<Edge*>(elem));
     132              :                 case FACE:
     133              :                         return get_selection_status(static_cast<Face*>(elem));
     134              :                 case VOLUME:
     135              :                         return get_selection_status(static_cast<Volume*>(elem));
     136              :         }
     137              :         return 0;
     138              : }
     139              : 
     140              : }//     end of namespace
     141              : 
     142              : #endif
        

Generated by: LCOV version 2.0-1