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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2017:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Martin Scherer, Rebecca Wittum, 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 <cmath>
      34              : #include "tkd_info.h"
      35              : #include "common/math/misc/math_constants.h"
      36              : 
      37              : namespace ug {
      38              : 
      39              : /** Each line corresponds to one element. First entry of each line corresponds
      40              :  * to the number of vertices, the other entries to the vertex index according
      41              :  * to TKDInfo.*/
      42              : static const int INNER_TKD_ELEMENT_INDICES[] = {
      43              :                                         6, 24, 1, 0, 25, 19, 18,
      44              :                                         6, 24, 2, 1, 25, 20, 19,
      45              :                                         6, 24, 3, 2, 25, 21, 20,
      46              :                                         6, 24, 4, 3, 25, 22, 21,
      47              :                                         6, 24, 5, 4, 25, 23, 22,
      48              :                                         6, 24, 0, 5, 25, 18, 23,
      49              : 
      50              :                                         6, 2, 14, 20, 3, 15, 21,
      51              :                                         6, 3, 9, 21, 4, 10, 22,
      52              :                                         6, 4, 16, 22, 5, 17, 23,
      53              :                                         6, 5, 11, 23, 0, 6, 18,
      54              :                                         6, 0, 12, 18, 1, 13, 19,
      55              :                                         6, 1, 7, 19, 2, 8, 20,
      56              : 
      57              :                                         4, 3, 21, 9, 15,
      58              :                                         4, 4, 22, 10, 16,
      59              :                                         4, 5, 23, 11, 17,
      60              :                                         4, 0, 18, 6, 12,
      61              :                                         4, 1, 19, 7, 13,
      62              :                                         4, 2, 20, 8, 14};
      63              : 
      64              : 
      65              : /** Each line corresponds to one element. First entry of each line corresponds
      66              :  * to the number of vertices, the other entries to the vertex index according
      67              :  * to TKDInfo.*/
      68              : static const int OUTER_TKD_ELEMENT_INDICES[] = {
      69              :                                         //top
      70              :                                         6, 24, 1, 0, 26 + 24, 26 + 1, 26 + 0,
      71              :                                         6, 24, 2, 1, 26 + 24, 26 + 2, 26 + 1,
      72              :                                         6, 24, 3, 2, 26 + 24, 26 + 3, 26 + 2,
      73              :                                         6, 24, 4, 3, 26 + 24, 26 + 4, 26 + 3,
      74              :                                         6, 24, 5, 4, 26 + 24, 26 + 5, 26 + 4,
      75              :                                         6, 24, 0, 5, 26 + 24, 26 + 0, 26 + 5,
      76              : 
      77              :                                         //bottom
      78              :                                         6, 25, 18, 19, 26 + 25, 26 + 18, 26 + 19,
      79              :                                         6, 25, 19, 20, 26 + 25, 26 + 19, 26 + 20,
      80              :                                         6, 25, 20, 21, 26 + 25, 26 + 20, 26 + 21,
      81              :                                         6, 25, 21, 22, 26 + 25, 26 + 21, 26 + 22,
      82              :                                         6, 25, 22, 23, 26 + 25, 26 + 22, 26 + 23,
      83              :                                         6, 25, 23, 18, 26 + 25, 26 + 23, 26 + 18,
      84              : 
      85              :                                         //outer edges
      86              :                                         6, 0, 12, 6, 26 + 0, 26 + 12, 26 + 6,
      87              :                                         6, 1, 7, 13, 26 + 1, 26 + 7, 26 + 13,
      88              :                                         6, 2, 14, 8, 26 + 2, 26 + 14, 26 + 8,
      89              :                                         6, 3, 9, 15, 26 + 3, 26 + 9, 26 + 15,
      90              :                                         6, 4, 16, 10, 26 + 4, 26 + 16, 26 + 10,
      91              :                                         6, 5, 11, 17, 26 + 5, 26 + 11, 26 + 17,
      92              : 
      93              :                                         6, 18, 6, 12, 26 + 18, 26 + 6, 26 + 12,
      94              :                                         6, 19, 13, 7, 26 + 19, 26 + 13, 26 + 7,
      95              :                                         6, 20, 8, 14, 26 + 20, 26 + 8, 26 + 14,
      96              :                                         6, 21, 15, 9, 26 + 21, 26 + 15, 26 + 9,
      97              :                                         6, 22, 10, 16, 26 + 22, 26 + 10, 26 + 16,
      98              :                                         6, 23, 17, 11, 26 + 23, 26 + 17, 26 + 11,
      99              : 
     100              :                                         // hexahedra for quads
     101              :                                         8, 1, 2, 8, 7, 26 + 1, 26 + 2, 26 + 8, 26 + 7,
     102              :                                         8, 3, 4, 10, 9, 26 + 3, 26 + 4, 26 + 10, 26 + 9,
     103              :                                         8, 5, 0, 6, 11, 26 + 5, 26 + 0, 26 + 6, 26 + 11,
     104              : 
     105              :                                         8, 0, 1, 13, 12, 26 + 0, 26 + 1, 26 + 13, 26 + 12,
     106              :                                         8, 2, 3, 15, 14, 26 + 2, 26 + 3, 26 + 15, 26 + 14,
     107              :                                         8, 4, 5, 17, 16, 26 + 4, 26 + 5, 26 + 17, 26 + 16,
     108              : 
     109              :                                         8, 7, 8, 20, 19, 26 + 7, 26 + 8, 26 + 20, 26 + 19,
     110              :                                         8, 9, 10, 22, 21, 26 + 9, 26 + 10, 26 + 22, 26 + 21,
     111              :                                         8, 11, 6, 18, 23, 26 + 11, 26 + 6, 26 + 18, 26 + 23,
     112              : 
     113              :                                         8, 12, 13, 19, 18, 26 + 12, 26 + 13, 26 + 19, 26 + 18,
     114              :                                         8, 14, 15, 21, 20, 26 + 14, 26 + 15, 26 + 21, 26 + 20,
     115              :                                         8, 16, 17, 23, 22, 26 + 16, 26 + 17, 26 + 23, 26 + 22};
     116              : 
     117              : 
     118              : 
     119            0 : TKDInfo::
     120            0 : TKDInfo (number a, number w, number h, number d)
     121              : {
     122            0 :         number beta = 1.0 / 2.0 * PI + acos(h / sqrt(h*h+3.0*(w-2.0*a)*(w-2.0*a)));
     123            0 :         number gamma = 1.0 / 2.0 * PI + acos(2.0*h / sqrt(4.0*h*h+3.0*(2.0*w-a)*(2.0*w-a)));
     124            0 :         number m1 = d / (2.0 * tan(beta / 2.0));
     125            0 :         number m2 = d / (2.0 * tan(gamma / 2.0));
     126              : 
     127              :         /*number a2 = sqrt(3) / 3.0 * (sqrt(3) * a + m1 + m2);
     128              :         number h2 = h+d;
     129              :         number w2 = h2 * (w-2*a)/h + 2.0*a2;*/
     130            0 :         m_alip = sqrt(3) / 3.0 * (sqrt(3) * a + m1 + m2);
     131            0 :         m_hlip = h+d;
     132            0 :         m_wlip= m_hlip * (w-2*a)/h + 2.0*m_alip;
     133              : 
     134            0 :         m_coords.resize(NUM_COORDS);
     135            0 :         init_coords (&m_coords[0], a, w, h);
     136            0 :         init_coords (&m_coords[NUM_INNER_COORDS], m_alip, m_wlip, m_hlip);
     137            0 : }
     138              : 
     139              : 
     140            0 : void TKDInfo::
     141              : init_coords (   vector3* coordsOut,
     142              :                                 number a,
     143              :                                 number w,
     144              :                                 number h)
     145              : {
     146              :         //Coordinates of TOP points
     147            0 :         coordsOut[0] = vector3(-a/2, sqrt(3)*a/2, h/2);
     148              :         coordsOut[1] = vector3(a/2, sqrt(3)*a/2, h/2);
     149              :         coordsOut[2] = vector3(a, 0, h/2);
     150              :         coordsOut[3] = vector3(a/2, -sqrt(3)*a/2, h/2);
     151              :         coordsOut[4] = vector3(-a/2, -sqrt(3)*a/2, h/2);
     152              :         coordsOut[5] = vector3(-a, 0, h/2);
     153              : 
     154              :         //Coordinates of point on 2/3 of TKD h
     155            0 :         coordsOut[6] = vector3(-(w-a)/2, sqrt(3)/6*(w+a), h/6);
     156              :         coordsOut[7] = vector3((w-a)/2, sqrt(3)/6*(w+a), h/6);
     157            0 :         coordsOut[8] = vector3(w/2, sqrt(3)/6*(w-2*a), h/6);
     158            0 :         coordsOut[9] = vector3(a/2, -sqrt(3)/3*(w-a/2), h/6);
     159              :         coordsOut[10] = vector3(-a/2, -sqrt(3)/3*(w-a/2), h/6);
     160              :         coordsOut[11] = vector3(-w/2, sqrt(3)/6*(w-2*a), h/6);
     161              : 
     162              :         //Coordinates of point on 1/3 of TKD h
     163              :         coordsOut[12] = vector3(-a/2, +sqrt(3)/3*(w-a/2), -h/6);
     164              :         coordsOut[13] = vector3(+a/2, +sqrt(3)/3*(w-a/2), -h/6);
     165              :         coordsOut[14] = vector3(w/2, -sqrt(3)/6*(w-2*a), -h/6);
     166              :         coordsOut[15] = vector3((w-a)/2, -sqrt(3)/6*(w+a), -h/6);
     167              :         coordsOut[16] = vector3(-(w-a)/2, -sqrt(3)/6*(w+a), -h/6);
     168              :         coordsOut[17] = vector3(-w/2, -sqrt(3)/6*(w-2*a), -h/6);
     169              : 
     170              :         //Coordinates of BOT points
     171              :         coordsOut[18] = vector3(-a/2, sqrt(3)*a/2, -h/2);
     172              :         coordsOut[19] = vector3(a/2, sqrt(3)*a/2, -h/2);
     173              :         coordsOut[20] = vector3(a, 0, -h/2);
     174              :         coordsOut[21] = vector3(a/2, -sqrt(3)*a/2, -h/2);
     175              :         coordsOut[22] = vector3(-a/2, -sqrt(3)*a/2, -h/2);
     176              :         coordsOut[23] = vector3(-a, 0, -h/2);
     177              : 
     178              :         //Coordinates of centre points of TOP and BOT
     179              :         coordsOut[24] = vector3(0, 0, h/2);
     180              :         coordsOut[25] = vector3(0, 0, -h/2);
     181            0 : }
     182              : 
     183            0 : const int* TKDInfo::
     184              : inner_element_indices () const
     185              : {
     186            0 :         return INNER_TKD_ELEMENT_INDICES;
     187              : }
     188              : 
     189              : 
     190            0 : const int* TKDInfo::
     191              : outer_element_indices () const
     192              : {
     193            0 :         return OUTER_TKD_ELEMENT_INDICES;
     194              : }
     195              : 
     196              : 
     197              : }//     end of namespace
        

Generated by: LCOV version 2.0-1