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

ASTNodeBuiltinFunctionExpressionBuilder.cpp

Blame
  • MeshBuilderBase.cpp 7.91 KiB
    #include <mesh/MeshBuilderBase.hpp>
    
    #include <mesh/Connectivity.hpp>
    #include <mesh/ConnectivityDescriptor.hpp>
    #include <mesh/ConnectivityDispatcher.hpp>
    #include <mesh/ItemId.hpp>
    #include <mesh/Mesh.hpp>
    #include <mesh/MeshData.hpp>
    #include <mesh/MeshDataManager.hpp>
    #include <utils/PugsAssert.hpp>
    #include <utils/PugsMacros.hpp>
    
    #include <vector>
    
    template <size_t Dimension>
    void
    MeshBuilderBase::_dispatch()
    {
      if (parallel::size() == 1) {
        return;
      }
    
      using ConnectivityType = Connectivity<Dimension>;
      using Rd               = TinyVector<Dimension>;
      using MeshType         = Mesh<ConnectivityType>;
    
      if (not m_mesh) {
        ConnectivityDescriptor descriptor;
        std::shared_ptr connectivity = ConnectivityType::build(descriptor);
        NodeValue<Rd> xr;
        m_mesh = std::make_shared<MeshType>(connectivity, xr);
      }
    
      const MeshType& mesh = dynamic_cast<const MeshType&>(*m_mesh);
      ConnectivityDispatcher<Dimension> dispatcher(mesh.connectivity());
    
      std::shared_ptr dispatched_connectivity = dispatcher.dispatchedConnectivity();
      NodeValue<Rd> dispatched_xr             = dispatcher.dispatch(mesh.xr());
    
      m_mesh = std::make_shared<MeshType>(dispatched_connectivity, dispatched_xr);
    }
    
    template void MeshBuilderBase::_dispatch<1>();
    template void MeshBuilderBase::_dispatch<2>();
    template void MeshBuilderBase::_dispatch<3>();
    
    template <size_t Dimension>
    void
    MeshBuilderBase::_checkMesh() const
    {
      using ConnectivityType = Connectivity<Dimension>;
      using MeshType         = Mesh<ConnectivityType>;
    
      if (not m_mesh) {
        throw UnexpectedError("mesh is not built yet");
      }
    
      const MeshType& mesh = dynamic_cast<const MeshType&>(*m_mesh);
    
      const ConnectivityType& connectivity = mesh.connectivity();
    
      if constexpr (Dimension > 2) {   // check for duplicated edges
        auto edge_to_node_matrix = connectivity.edgeToNodeMatrix();
    
        std::vector<std::vector<EdgeId>> node_edges(mesh.numberOfNodes());
        for (EdgeId edge_id = 0; edge_id < mesh.numberOfEdges(); ++edge_id) {
          auto node_list = edge_to_node_matrix[edge_id];
          for (size_t i_node = 0; i_node < node_list.size(); ++i_node) {
            node_edges[node_list[i_node]].push_back(edge_id);
          }