LCOV - code coverage report
Current view: top level - ugbase/common/node_tree - traverser.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 26 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 8 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2007-2015:  Sebastian Reiter
       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 "traverser.h"
      34              : #include "node_tree.h"
      35              : #include <iostream>
      36              : 
      37              : namespace ug{
      38              : namespace node_tree
      39              : {
      40              : 
      41            0 : Traverser::Traverser()
      42              : {
      43              : //      initialise the handler-function array to reduce the number of resizes
      44            0 :         m_vHandlerFuncs.resize(OC_NODES_END, 0);
      45              : 
      46              : //      register handler functions
      47            0 :         register_handler_function(OC_GROUP_NODE, &Traverser::handle_group);
      48            0 :         register_handler_function(OC_BOXED_GROUP_NODE, &Traverser::handle_boxed_group);
      49            0 : }
      50              : 
      51            0 : Traverser::~Traverser()
      52              : {
      53            0 : }
      54              : 
      55            0 : bool Traverser::handler_function_registered(unsigned int oc)
      56              : {
      57              :         // the first expression has been always true for unsigned int (AV)
      58            0 :         if(/*oc >= 0 &&*/ oc < m_vHandlerFuncs.size())
      59              :         {
      60            0 :                 if(m_vHandlerFuncs[oc] != 0)
      61            0 :                         return true;
      62              :         }
      63              :         return false;
      64              : }
      65              : 
      66            0 : void Traverser::apply(SPNode& node)
      67              : {
      68            0 :         traverse_object(node.get());
      69            0 : }
      70              : 
      71            0 : void Traverser::traverse_object(Object* obj)
      72              : {
      73              :         unsigned int oc = obj->getObjectCode();
      74            0 :         if(handler_function_registered(oc))
      75              :         {
      76            0 :                 (this->*(m_vHandlerFuncs[oc]))(obj);
      77              :         }
      78            0 : }
      79              : 
      80            0 : void Traverser::handle_group(GroupNode* group)
      81              : {
      82              :         //std::cout << "handling group" << std::endl;
      83              : 
      84              : //      traverse all children of the group
      85            0 :         int numChildren = group->num_children();
      86            0 :         for(int i = 0; i < numChildren; ++i)
      87            0 :                 traverse_object(group->get_child(i).get());
      88            0 : }
      89              : 
      90            0 : void Traverser::handle_boxed_group(BoxedGroupNode* boxedGroup)
      91              : {
      92              :         //std::cout << "handling boxed group" << std::endl;
      93              : 
      94              : //      traverse the group
      95            0 :         handle_group(boxedGroup);
      96            0 : }
      97              : 
      98              : }//     end of namespace node_tree
      99              : }//     end of namespace ug
        

Generated by: LCOV version 2.0-1