Quinoa all test code coverage report
Current view: top level - Inciter/AMR - AMR_types.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 2 2 100.0 %
Date: 2024-04-22 13:03:21 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : #ifndef AMR_types_h
       2                 :            : #define AMR_types_h
       3                 :            : 
       4                 :            : #include <array>
       5                 :            : #include <vector>
       6                 :            : #include <map>
       7                 :            : 
       8                 :            : #include "../Base/Types.hpp"
       9                 :            : #include "edge.hpp"
      10                 :            : #include "UnsMesh.hpp"
      11                 :            : 
      12                 :            : // TODO: Do we need to merge this with Base/Types.h?
      13                 :            : 
      14                 :            : namespace AMR {
      15                 :            : 
      16                 :            : const int DIMENSION = 3;
      17                 :            : const size_t NUM_TET_NODES = 4;
      18                 :            : const size_t NUM_FACE_NODES = 3;
      19                 :            : const size_t NUM_TET_EDGES = 6;
      20                 :            : const size_t NUM_TET_FACES = 4;
      21                 :            : const size_t ID_SHIFT = 3;
      22                 :            : const size_t MAX_CHILDREN = 8;
      23                 :            : const char KEY_DELIM = '-';
      24                 :            : 
      25                 :            : using real_t = tk::real;
      26                 :            : using coordinate_t = std::array<real_t, DIMENSION>;
      27                 :            : using tet_t = std::array<size_t, NUM_TET_NODES>;
      28                 :            : 
      29                 :            : using node_pair_t  = std::array<std::size_t, 2>;
      30                 :            : 
      31                 :            : using face_ids_t = std::array<std::size_t, NUM_FACE_NODES>;
      32                 :            : using face_list_t  = std::array< face_ids_t, NUM_TET_FACES>;
      33                 :            : 
      34                 :            : //using child_id_list_t = std::array<size_t, MAX_CHILDREN>;
      35                 :            : using child_id_list_t = std::vector<size_t>;
      36                 :            : 
      37                 :            : using tet_list_t = std::map<size_t, tet_t>;
      38                 :            : 
      39                 :            : using inpoel_t = std::vector< std::size_t >;     //!< Tetrahedron connectivity
      40                 :            : using node_list_t = std::vector<real_t>;
      41                 :            : 
      42                 :            : enum Edge_Lock_Case {unlocked = 0, locked, intermediate, temporary};
      43                 :            : 
      44                 :            :  // TODO: Make these class enums? (breaks printing)
      45                 :            : struct Edge_Refinement {
      46                 :            :     size_t A;
      47                 :            :     size_t B;
      48                 :            :     int needs_refining; // value of 1= refinement; 2= deref-ref (as in for 8:4)
      49                 :            :     bool needs_derefining; // TODO: Marge this with needs_refining
      50                 :            :     Edge_Lock_Case lock_case; // TODO: Refactor this to match _ style?
      51                 :            : 
      52                 :            :     // Explicit Empty Constructor
      53                 :    1715485 :     Edge_Refinement() :
      54                 :            :         A(0),
      55                 :            :         B(0),
      56                 :            :         needs_refining(0),
      57                 :            :         needs_derefining(false),
      58         [ -  + ]:    1715485 :         lock_case(Edge_Lock_Case::unlocked)
      59                 :            :     {
      60                 :            :         // Empty
      61                 :            :     }
      62                 :            : 
      63                 :            :    // bool operator==( const Edge_Refinement& r ) const {
      64                 :            :    //   return A == r.A &&
      65                 :            :    //          B == r.B &&
      66                 :            :    //          //std::abs(refinement_criteria-r.refinement_criteria) < 1.0e-12 &&
      67                 :            :    //          needs_refining == r.needs_refining &&
      68                 :            :    //          needs_derefining == r.needs_derefining &&
      69                 :            :    //          is_dead == r.is_dead &&
      70                 :            :    //          lock_case == r.lock_case;
      71                 :            :    // }
      72                 :            : 
      73                 :            :     // This abstraction is hardly any better than using an explicit initialisation
      74                 :            :     // list but it makes it easier if we decide to add/remove a parameter
      75                 :            :     Edge_Refinement(
      76                 :            :             size_t A_in,
      77                 :            :             size_t B_in,
      78                 :            :             int needs_refining_in,
      79                 :            :             bool needs_derefining_in,
      80                 :            :             Edge_Lock_Case lock_case_in
      81                 :            :             ) :
      82                 :            :         A(A_in),
      83                 :            :         B(B_in),
      84                 :            :         needs_refining(needs_refining_in),
      85                 :            :         needs_derefining(needs_derefining_in),
      86                 :            :         lock_case(lock_case_in)
      87                 :            :     {
      88                 :            :         // Empty, all implicit.
      89                 :            :         // Could add logic here to reconcile needs_refining and needs_derefining
      90                 :            :     }
      91                 :            : };
      92                 :            : 
      93                 :            : // Complex types
      94                 :            : struct Edge_Refinement; // forward declare
      95                 :            : using edges_t = std::map<edge_t, Edge_Refinement>;
      96                 :            : using edge_list_t  = std::array<edge_t, NUM_TET_EDGES>;
      97                 :            : using edge_list_ids_t  = std::array<std::size_t, NUM_TET_EDGES>;
      98                 :            : 
      99                 :            : using coord_type = std::vector< tk::real >;
     100                 :            : 
     101                 :            : //! \brief Needs refinement and edge lock case associated to an edge given by global
     102                 :            : //!    parent IDs
     103                 :            : using EdgeData =
     104                 :            :    std::unordered_map< tk::UnsMesh::Edge,
     105                 :            :                        std::tuple< int, int, Edge_Lock_Case >,
     106                 :            :                        tk::UnsMesh::Hash<2>,
     107                 :            :                        tk::UnsMesh::Eq<2> >;
     108                 :            : 
     109                 :            : //! Enum used to tag an edge for refinement or derefinement
     110                 :            : enum class edge_tag : uint8_t { REFINE, DEREFINE };
     111                 :            : 
     112                 :            : }  // AMR::
     113                 :            : 
     114                 :            : #endif

Generated by: LCOV version 1.14