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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2016:  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 "quadrilateral_util.h"
      34              : #include "lib_grid/algorithms/geom_obj_util/edge_util.h"
      35              : 
      36              : namespace ug{
      37              : 
      38            0 : Quadrilateral* CreateQuadrilateral_NoRegistration(Grid& g, Face* tri1, Face* tri2)
      39              : {
      40            0 :         UG_COND_THROW(tri1->num_vertices() != 3 || tri2->num_vertices() != 3,
      41              :                                   "Only 2 triangles can be converted to quadrilaterals, "
      42              :                                   "but non-triangle specifed.");
      43              : 
      44            0 :         Edge* e = GetConnectingEdge(g, tri1, tri2);
      45            0 :         UG_COND_THROW(e == NULL, "Only triangles sharing one edge may be converted "
      46              :                                   "to a quadrilateral. This is not the case here.");
      47              : 
      48            0 :         Vertex* v1 = GetConnectedVertex(e, tri1);
      49            0 :         Vertex* v3 = GetConnectedVertex(e, tri2);
      50              : 
      51            0 :         UG_COND_THROW(v1 == NULL || v3 == NULL || v1 == v3,
      52              :                                   "Invalid triangles specified. Only two triangles sharing "
      53              :                                   "exactly 2 vertices can be converted to a triangle.");
      54              : 
      55            0 :         int i1 = GetVertexIndex(tri1, v1);
      56            0 :         Vertex* v2 = tri1->vertex((i1+1)%3);
      57            0 :         Vertex* v4 = tri1->vertex((i1+2)%3);
      58              : 
      59            0 :         return new Quadrilateral(v1, v2, v3, v4);
      60              : }
      61              : 
      62            0 : Quadrilateral* CreateQuadrilateral(Grid& g, Face* tri1, Face* tri2)
      63              : {
      64            0 :         Quadrilateral* q = CreateQuadrilateral_NoRegistration(g, tri1, tri2);
      65              :         g.register_element(q);
      66            0 :         return q;
      67              : }
      68              : 
      69            0 : Quadrilateral* ReplaceByQuadrilateral(Grid& g, Face* tri1, Face* tri2)
      70              : {
      71            0 :         Quadrilateral* q = CreateQuadrilateral_NoRegistration(g, tri1, tri2);
      72            0 :         Edge* e = GetConnectingEdge(g, tri1, tri2);
      73            0 :         g.erase(tri2);
      74              :         g.register_element(q, tri1);
      75            0 :         g.erase(tri1);
      76            0 :         g.erase(e);
      77            0 :         return q;
      78              : }
      79              :         
      80              : }//     end of namespace
        

Generated by: LCOV version 2.0-1