Skip to content
Snippets Groups Projects
Select Git revision
  • d8118c4870135edd5d50acefe6c2d915119583ba
  • develop default protected
  • feature/variational-hydro
  • origin/stage/bouguettaia
  • feature/gmsh-reader
  • feature/reconstruction
  • save_clemence
  • feature/kinetic-schemes
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • 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
  • 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

main.cpp

Blame
  • ConnectivityDispatcher.cpp 30.18 KiB
    #include <mesh/ConnectivityDispatcher.hpp>
    
    #include <mesh/ItemOfItemType.hpp>
    #include <utils/CRSGraph.hpp>
    #include <utils/Partitioner.hpp>
    
    #include <iostream>
    #include <unordered_map>
    
    template <int Dimension>
    template <ItemType item_type>
    void
    ConnectivityDispatcher<Dimension>::_buildNewOwner()
    {
      if constexpr (item_type == ItemType::cell) {
        CRSGraph connectivity_graph = m_connectivity.cellToCellGraph();
        Partitioner P;
    
        CellValue<int> cell_new_owner(m_connectivity, P.partition(connectivity_graph));
    
        this->_dispatchedInfo<ItemType::cell>().m_new_owner = cell_new_owner;
      } else {
        const auto& item_to_cell_matrix = m_connectivity.template getItemToItemMatrix<item_type, ItemType::cell>();
    
        const auto& cell_number    = m_connectivity.cellNumber();
        const auto& cell_new_owner = this->_dispatchedInfo<ItemType::cell>().m_new_owner;
    
        using ItemId = ItemIdT<item_type>;
        ItemValue<int, item_type> item_new_owner(m_connectivity);
        parallel_for(
          item_new_owner.numberOfItems(), PUGS_LAMBDA(const ItemId& l) {
            const auto& item_to_cell = item_to_cell_matrix[l];
            CellId Jmin              = item_to_cell[0];
    
            for (size_t j = 1; j < item_to_cell.size(); ++j) {
              const CellId J = item_to_cell[j];
              if (cell_number[J] < cell_number[Jmin]) {
                Jmin = J;
              }
            }
            item_new_owner[l] = cell_new_owner[Jmin];
          });
    
        synchronize(item_new_owner);
        this->_dispatchedInfo<item_type>().m_new_owner = item_new_owner;
      }
    }
    
    template <int Dimension>
    template <ItemType item_type>
    void
    ConnectivityDispatcher<Dimension>::_buildItemToExchangeLists()
    {
      this->_buildItemListToSend<item_type>();
      this->_buildNumberOfItemToExchange<item_type>();
      if constexpr (item_type == ItemType::cell) {
        this->_buildCellNumberIdMap();
      }
      this->_buildRecvItemIdCorrespondanceByProc<item_type>();
    }
    
    template <int Dimension>
    template <ItemType item_type>
    void
    ConnectivityDispatcher<Dimension>::_buildItemListToSend()
    {
      if constexpr (item_type == ItemType::cell) {
        const auto& node_to_cell_matrix = m_connectivity.nodeToCellMatrix();
        const auto& cell_to_node_matrix = m_connectivity.cellToNodeMatrix();