Xyst test code coverage report
Current view: top level - Inciter/AMR - Refinement_State.hpp (source / functions) Coverage Total Hit
Commit: 1fb74642dd9d7732b67f32dec2f2762e238d3fa7 Lines: 100.0 % 13 13
Test Date: 2025-08-13 22:18:46 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 50.0 % 10 5

             Branch data     Line data    Source code
       1                 :             : //
       2                 :             : // Created by Robert Francis Bird on 10/27/16.
       3                 :             : //
       4                 :             : 
       5                 :             : #ifndef TETAMR_AMR_DATA_H
       6                 :             : #define TETAMR_AMR_DATA_H
       7                 :             : 
       8                 :             : #include <cstddef>
       9                 :             : 
      10                 :             : #include "Types.hpp"
      11                 :             : #include "AMR_types.hpp"
      12                 :             : 
      13                 :             : namespace AMR {
      14                 :             :     // Types
      15                 :             :     using real_t = tk::real;
      16                 :             : 
      17                 :             :     const size_t DEFUALT_CHILD_NUMBER = 0; // Used to mark "doesn't have children"
      18                 :             : 
      19                 :             :     // TODO: Populate this enum with the available refinement cases
      20                 :             :     enum Refinement_Case { initial_grid = 0, one_to_two, one_to_four, one_to_eight,
      21                 :             :         two_to_eight, four_to_eight, none };
      22                 :             : 
      23                 :             :     enum Derefinement_Case { two_to_one = 0, four_to_one, four_to_two,
      24                 :             :         eight_to_one, eight_to_two, eight_to_four, skip };
      25                 :             : 
      26 [ +  - ][ +  - ]:     2180229 :     class Refinement_State {
      27                 :             : 
      28                 :             :         public:
      29                 :             :             /// Common to active and master elements
      30                 :             :             size_t active_element_number; // TODO: Some of these can be removed?
      31                 :             :             Refinement_Case refinement_case;
      32                 :             :             child_id_list_t children;
      33                 :             :             size_t refinement_level;
      34                 :             :             size_t child_number;
      35                 :             :             size_t parent_id;
      36                 :             :             bool normal;
      37                 :             :             bool has_parent;
      38                 :             : 
      39         [ +  - ]:      979624 :             Refinement_State() {}
      40                 :             : 
      41                 :             :             /**
      42                 :             :              * @brief Constructor which allows for all data fields to be explicitly
      43                 :             :              * specified
      44                 :             :              *
      45                 :             :              * @param active_element_number_in The active element id
      46                 :             :              * @param refinement_case_in The refinement case
      47                 :             :              * @param children_in The children ids
      48                 :             :              * @param refinement_level_in The level of refinement
      49                 :             :              * @param child_number_in ??  // TODO: What is this?
      50                 :             :              * @param parent_id_in Id of parent element
      51                 :             :              * @param has_parent_in True if element has a parent, default is true
      52                 :             :             */
      53                 :             :             Refinement_State(
      54                 :             :                     size_t active_element_number_in,
      55                 :             :                     Refinement_Case refinement_case_in,
      56                 :             :                     const child_id_list_t& children_in,
      57                 :             :                     size_t refinement_level_in,
      58                 :             :                     size_t child_number_in,
      59                 :             :                     size_t parent_id_in,
      60                 :             :                     bool has_parent_in=true
      61                 :             :             ) :
      62                 :             :                     active_element_number(active_element_number_in),
      63                 :             :                     refinement_case(refinement_case_in),
      64                 :             :                     children(children_in),
      65                 :             :                     refinement_level(refinement_level_in),
      66                 :             :                     child_number(child_number_in),
      67                 :             :                     parent_id(parent_id_in),
      68                 :             :                     normal(0),
      69                 :             :                     has_parent(has_parent_in)
      70                 :             :             {
      71                 :             :                 // Empty
      72                 :             :             }
      73                 :             : 
      74                 :             :             /**
      75                 :             :              * @brief Constructor which assumes sensible Defaults for new nodes
      76                 :             :              *
      77                 :             :              * @param active_element_number_in The active element id
      78                 :             :              * @param refinement_case_in The refinement case
      79                 :             :              * @param refinement_level_in The level of refinement
      80                 :             :              * @param parent_id_in Id of parent element
      81                 :             :              * @param has_parent_in True if element has a parent, default is true
      82                 :             :              */
      83                 :     1200605 :             Refinement_State(
      84                 :             :                     size_t active_element_number_in,
      85                 :             :                     Refinement_Case refinement_case_in,
      86                 :             :                     size_t refinement_level_in,
      87                 :             :                     size_t parent_id_in,
      88                 :             :                     bool has_parent_in=true
      89                 :     1200605 :             ) :
      90                 :     1200605 :                     active_element_number(active_element_number_in),
      91         [ +  - ]:     1200605 :                     refinement_case(refinement_case_in),
      92                 :     1200605 :                     refinement_level(refinement_level_in),
      93                 :     1200605 :                     child_number(DEFUALT_CHILD_NUMBER), // Give it default child id
      94                 :     1200605 :                     parent_id(parent_id_in),
      95                 :     1200605 :                     normal(0),
      96                 :     1200605 :                     has_parent(has_parent_in)
      97                 :             :             {
      98                 :             :                 // Set default size of children to be sensible
      99         [ +  - ]:     1200605 :                 children.reserve(MAX_CHILDREN);
     100                 :     1200605 :             }
     101                 :             :     };
     102                 :             : 
     103                 :             : }
     104                 :             : 
     105                 :             : #endif //TETAMR_AMR_DATA_H
     106                 :             : 
        

Generated by: LCOV version 2.0-1