LCOV - code coverage report
Current view: top level - src/utils - NekUility.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 35 37 94.6 %
Date: 2025-07-15 20:50:38 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /********************************************************************/
       2             : /*                  SOFTWARE COPYRIGHT NOTIFICATION                 */
       3             : /*                             Cardinal                             */
       4             : /*                                                                  */
       5             : /*                  (c) 2021 UChicago Argonne, LLC                  */
       6             : /*                        ALL RIGHTS RESERVED                       */
       7             : /*                                                                  */
       8             : /*                 Prepared by UChicago Argonne, LLC                */
       9             : /*               Under Contract No. DE-AC02-06CH11357               */
      10             : /*                With the U. S. Department of Energy               */
      11             : /*                                                                  */
      12             : /*             Prepared by Battelle Energy Alliance, LLC            */
      13             : /*               Under Contract No. DE-AC07-05ID14517               */
      14             : /*                With the U. S. Department of Energy               */
      15             : /*                                                                  */
      16             : /*                 See LICENSE for full restrictions                */
      17             : /********************************************************************/
      18             : 
      19             : #include "NekUtility.h"
      20             : 
      21             : namespace nekrs
      22             : {
      23             : 
      24             : std::vector<std::vector<int>>
      25         812 : cornerGLLIndices(const int & n, const bool exact)
      26             : {
      27             :   std::vector<std::vector<int>> corner_indices;
      28             : 
      29         812 :   if (!exact)
      30             :   {
      31         739 :     corner_indices.resize(1);
      32         739 :     int back_corner = (n + 1) * (n + 1) * n;
      33             :     corner_indices[0] = {0,
      34             :                          n,
      35         739 :                          (n + 1) * n,
      36         739 :                          (n + 1) * (n + 1) - 1,
      37             :                          back_corner,
      38         739 :                          back_corner + n,
      39         739 :                          back_corner + (n + 1) * n,
      40         739 :                          back_corner + (n + 1) * (n + 1) - 1};
      41             :   }
      42             :   else
      43             :   {
      44         335 :     for (int depth = 0; depth < n; ++depth)
      45             :     {
      46        1340 :       for (int row = 0; row < n; ++row)
      47             :       {
      48        6194 :         for (int col = 0; col < n; ++col)
      49             :         {
      50        5116 :           int start = row * (n + 1) + col + depth * (n + 1) * (n + 1);
      51        5116 :           int back_corner = (n + 1) * (n + 1) + start;
      52        5116 :           corner_indices.push_back({start,
      53        5116 :                                     start + 1,
      54        5116 :                                     start + n + 1,
      55        5116 :                                     start + n + 2,
      56             :                                     back_corner,
      57        5116 :                                     back_corner + 1,
      58        5116 :                                     back_corner + n + 1,
      59        5116 :                                     back_corner + n + 2});
      60             :         }
      61             :       }
      62             :     }
      63             :   }
      64             : 
      65         812 :   return corner_indices;
      66           0 : }
      67             : 
      68             : std::vector<std::vector<int>>
      69         809 : nestedElementsOnFace(const int & n)
      70             : {
      71             :   std::vector<std::vector<int>> e;
      72         809 :   e.resize(6);
      73             : 
      74             :   // face 0 and face 5
      75         809 :   int n_per_face = n * n;
      76       18954 :   for (int i = 0; i < n_per_face; ++i)
      77             :   {
      78       18145 :     e[0].push_back(i);
      79       18145 :     e[5].push_back(i + n_per_face * (n - 1));
      80             :   }
      81             : 
      82             :   // faces 1 through 4
      83        4298 :   for (int row = 0; row < n; ++row)
      84             :   {
      85       21634 :     for (int col = 0; col < n; ++col)
      86             :     {
      87       18145 :       e[1].push_back(n_per_face * row + col);
      88       18145 :       e[2].push_back(row * n * n + col * n + n - 1);
      89       18145 :       e[3].push_back(row * n * n + col + n * (n - 1));
      90       18145 :       e[4].push_back(row * n * n + col * n);
      91             :     }
      92             :   }
      93             : 
      94         809 :   return e;
      95           0 : }
      96             : 
      97             : } // end namespace nekrs

Generated by: LCOV version 1.14