LCOV - code coverage report
Current view: top level - ugbase/common/node_tree/traversers - traverser_intersect_faces.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 35 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 9 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 <iostream>
      34              : #include "traverser_intersect_faces.h"
      35              : #include "../node_tree.h"
      36              : #include "common/log.h"
      37              : #include "common/profiler/profiler.h"
      38              : 
      39              : using namespace std;
      40              : 
      41              : namespace ug{
      42              : namespace node_tree
      43              : {
      44              : 
      45            0 : Traverser_IntersectFaces::Traverser_IntersectFaces()
      46              : {
      47            0 : }
      48              : 
      49            0 : Traverser_IntersectFaces::~Traverser_IntersectFaces()
      50              : {
      51            0 : }
      52              : 
      53            0 : bool Traverser_IntersectFaces::
      54              : intersect_tri(const vector3& v0, const vector3& v1,
      55              :                           const vector3& v2, SPNode nodeGraph)
      56              : {
      57              :         m_vrts[0] = v0; m_vrts[1] = v1; m_vrts[2] = v2;
      58            0 :         m_numVrts = 3;
      59              :         
      60              :         m_intersectedElementIDs.clear();
      61              :         
      62            0 :         Traverser_CollisionTree::apply(nodeGraph);
      63              : 
      64            0 :         return !m_intersectedElementIDs.empty();
      65              : }
      66              : 
      67            0 : const std::vector<CollisionElementID>& Traverser_IntersectFaces::
      68              : get_intersected_element_ids() const
      69              : {
      70            0 :         return m_intersectedElementIDs;
      71              : }
      72              : 
      73            0 : void Traverser_IntersectFaces::
      74              : handle_boxed_group(BoxedGroupNode* boxedGroup)
      75              : {
      76              : //      check whether our element intersects the given box
      77              : //      todo: consider quadrilaterals
      78            0 :         if(TriangleBoxIntersection(m_vrts[0], m_vrts[1], m_vrts[2],
      79            0 :                                                                 boxedGroup->min_corner(),
      80            0 :                                                                 boxedGroup->max_corner()))
      81              :         {
      82            0 :                 handle_group(boxedGroup);
      83              :         }
      84            0 : }
      85              : 
      86            0 : void Traverser_IntersectFaces::
      87              : handle_collision_triangles(CollisionTrianglesNode* colTrisNode)
      88              : {
      89            0 :         CollisionTreeRootNode* root = get_current_root_node();
      90            0 :         const vector3* pPoints = root->get_points();
      91            0 :         int numIndices = colTrisNode->num_triangles() * 3;
      92            0 :         const int* indices = colTrisNode->get_triangles();
      93              : 
      94              : //      iterate over all triangles of this node
      95            0 :         for(int i = 0; i < numIndices; i+=3)
      96              :         {
      97              :         //      todo: instead of checking the ignore list after intersection, it should
      98              :         //                      probably be checked before. This depends on the size of the
      99              :         //                      ignore list. Probably an ignore hash would be better.
     100              : 
     101              :         //      perform intersection
     102              :         //      todo: store local coordinates
     103            0 :                 if(TriangleTriangleIntersection(m_vrts[0], m_vrts[1], m_vrts[2],
     104            0 :                                                                                 pPoints[indices[i]],
     105            0 :                                                                                 pPoints[indices[i+1]],
     106            0 :                                                                                 pPoints[indices[i+2]]))
     107              :                 {
     108              :                 //      check whether the element is in the ignore list
     109            0 :                         const CollisionElementID& id = colTrisNode->get_triangle_id(i/3);
     110            0 :                         if(find(m_ignoreList.begin(), m_ignoreList.end(), id) == m_ignoreList.end()){
     111            0 :                                 m_intersectedElementIDs.push_back(id);
     112              :                         }
     113              :                 }
     114              :         }
     115            0 : }
     116              : 
     117            0 : void Traverser_IntersectFaces::
     118              : ignore_element(const CollisionElementID& elemID)
     119              : {
     120            0 :         m_ignoreList.push_back(elemID);
     121            0 : }
     122              : 
     123            0 : void Traverser_IntersectFaces::
     124              : clear_ignore_list()
     125              : {
     126              :         m_ignoreList.clear();
     127            0 : }
     128              : 
     129              : }//     end of namespace node_tree
     130              : }//     end of namespace ug
        

Generated by: LCOV version 2.0-1