Skip to content
Snippets Groups Projects
Select Git revision
  • cbbf958d1cedc84416e786130490f4c700c2f320
  • develop default protected
  • feature/gmsh-reader
  • origin/stage/bouguettaia
  • feature/kinetic-schemes
  • feature/reconstruction
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • feature/variational-hydro
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • master protected
  • feature/escobar-smoother
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

PugsParser.cpp

Blame
    • Stéphane Del Pino's avatar
      cbbf958d
      Add location of variable creation to attributes of symbol tale · cbbf958d
      Stéphane Del Pino authored
      Additionally store position of the end of the declaration instruction so that
      when searching a symbol in a table one also check that the declaration point has
      been passed.
      
      This fix issues generated by the storage of symbol tables within node
      description. The following code is now interpreted correctly
      
      ``
      Z x = 1;
      {
        Z x = x + 1;
        cout << x << "\n";
      }
      cout << x << "\n";
      ``
      
      It now produces the expected output
      
      ``
      2
      1
      ``
      cbbf958d
      History
      Add location of variable creation to attributes of symbol tale
      Stéphane Del Pino authored
      Additionally store position of the end of the declaration instruction so that
      when searching a symbol in a table one also check that the declaration point has
      been passed.
      
      This fix issues generated by the storage of symbol tables within node
      description. The following code is now interpreted correctly
      
      ``
      Z x = 1;
      {
        Z x = x + 1;
        cout << x << "\n";
      }
      cout << x << "\n";
      ``
      
      It now produces the expected output
      
      ``
      2
      1
      ``
    ItemOfItemType.hpp 2.44 KiB
    #ifndef ITEM_OF_ITEM_TYPE_HPP
    #define ITEM_OF_ITEM_TYPE_HPP
    
    #include <mesh/ItemType.hpp>
    
    template <ItemType sub_item_t, ItemType item_t>
    struct ItemOfItemType
    {
      static_assert(sub_item_t != item_t, "item and its sub-item cannot be of same type");
    
      constexpr static ItemType sub_item_type = sub_item_t;
      constexpr static ItemType item_type     = item_t;
    
      using Reversed = ItemOfItemType<item_type, sub_item_type>;
    };
    
    using FaceOfCell = ItemOfItemType<ItemType::face, ItemType::cell>;
    using EdgeOfCell = ItemOfItemType<ItemType::edge, ItemType::cell>;
    using NodeOfCell = ItemOfItemType<ItemType::node, ItemType::cell>;
    
    using CellOfFace = ItemOfItemType<ItemType::cell, ItemType::face>;
    using EdgeOfFace = ItemOfItemType<ItemType::edge, ItemType::face>;
    using NodeOfFace = ItemOfItemType<ItemType::node, ItemType::face>;
    
    using CellOfEdge = ItemOfItemType<ItemType::cell, ItemType::edge>;
    using FaceOfEdge = ItemOfItemType<ItemType::face, ItemType::edge>;
    using NodeOfEdge = ItemOfItemType<ItemType::node, ItemType::edge>;
    
    using CellOfNode = ItemOfItemType<ItemType::cell, ItemType::node>;
    using FaceOfNode = ItemOfItemType<ItemType::face, ItemType::node>;
    using EdgeOfNode = ItemOfItemType<ItemType::edge, ItemType::node>;
    
    template <ItemType sub_item_type, ItemType item_type>
    constexpr inline int item_of_item_type_index;
    
    template <>
    constexpr inline int item_of_item_type_index<ItemType::face, ItemType::cell> = 0;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::edge, ItemType::cell> = 1;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::node, ItemType::cell> = 2;
    
    template <>
    constexpr inline int item_of_item_type_index<ItemType::cell, ItemType::face> = 3;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::edge, ItemType::face> = 4;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::node, ItemType::face> = 5;
    
    template <>
    constexpr inline int item_of_item_type_index<ItemType::cell, ItemType::edge> = 6;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::face, ItemType::edge> = 7;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::node, ItemType::edge> = 8;
    
    template <>
    constexpr inline int item_of_item_type_index<ItemType::cell, ItemType::node> = 9;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::face, ItemType::node> = 10;
    template <>
    constexpr inline int item_of_item_type_index<ItemType::edge, ItemType::node> = 11;
    
    #endif   // ITEM_OF_ITEM_TYPE_HPP