LCOV - code coverage report
Current view: top level - src/utils - NekUility.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: 920dc5 Lines: 35 37 94.6 %
Date: 2025-08-10 20:41:39 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         838 : cornerGLLIndices(const int & n, const bool exact)
      26             : {
      27             :   std::vector<std::vector<int>> corner_indices;
      28             : 
      29         838 :   if (!exact)
      30             :   {
      31         765 :     corner_indices.resize(1);
      32         765 :     int back_corner = (n + 1) * (n + 1) * n;
      33             :     corner_indices[0] = {0,
      34             :                          n,
      35         765 :                          (n + 1) * n,
      36         765 :                          (n + 1) * (n + 1) - 1,
      37             :                          back_corner,
      38         765 :                          back_corner + n,
      39         765 :                          back_corner + (n + 1) * n,
      40         765 :                          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         838 :   return corner_indices;
      66           0 : }
      67             : 
      68             : std::vector<std::vector<int>>
      69         835 : nestedElementsOnFace(const int & n)
      70             : {
      71             :   std::vector<std::vector<int>> e;
      72         835 :   e.resize(6);
      73             : 
      74             :   // face 0 and face 5
      75         835 :   int n_per_face = n * n;
      76       19246 :   for (int i = 0; i < n_per_face; ++i)
      77             :   {
      78       18411 :     e[0].push_back(i);
      79       18411 :     e[5].push_back(i + n_per_face * (n - 1));
      80             :   }
      81             : 
      82             :   // faces 1 through 4
      83        4380 :   for (int row = 0; row < n; ++row)
      84             :   {
      85       21956 :     for (int col = 0; col < n; ++col)
      86             :     {
      87       18411 :       e[1].push_back(n_per_face * row + col);
      88       18411 :       e[2].push_back(row * n * n + col * n + n - 1);
      89       18411 :       e[3].push_back(row * n * n + col + n * (n - 1));
      90       18411 :       e[4].push_back(row * n * n + col * n);
      91             :     }
      92             :   }
      93             : 
      94         835 :   return e;
      95           0 : }
      96             : 
      97             : } // end namespace nekrs

Generated by: LCOV version 1.14