MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / build_dofmap_data

Method build_dofmap_data

cpp/dolfinx/fem/dofmapbuilder.cpp:642–693  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

640
641//-----------------------------------------------------------------------------
642std::tuple<common::IndexMap, int, std::vector<std::vector<std::int32_t>>>
643fem::build_dofmap_data(
644 MPI_Comm comm, const mesh::Topology& topology,
645 const std::vector<ElementDofLayout>& element_dof_layouts,
646 const std::function<std::vector<int>(
647 const graph::AdjacencyList<std::int32_t>&)>& reorder_fn)
648{
649 common::Timer t0("Dofmap builder: build dofmap data");
650
651 // Build a simple dofmap based on mesh entity numbering, returning (i)
652 // a local dofmap, (ii) local-to-global map for dof indices, and (iii)
653 // pair {dimension, mesh entity index} giving the mesh entity that dof
654 // i is associated with.
655 const auto [node_graphs, local_to_global0, dof_entity0, topo_index_maps,
656 offset] = build_basic_dofmaps(topology, element_dof_layouts);
657
658 spdlog::info("Got {} index_maps", topo_index_maps.size());
659
660 // Build re-ordering map for data locality and get number of owned
661 // nodes
662 const auto [old_to_new, num_owned] = compute_reordering_map(
663 node_graphs, dof_entity0, topo_index_maps, reorder_fn);
664
665 spdlog::info("Get global indices");
666
667 // Get global indices for unowned dofs
668 const auto [local_to_global_unowned, local_to_global_owner]
669 = get_global_indices(topo_index_maps, num_owned, offset, local_to_global0,
670 old_to_new, dof_entity0);
671 assert(local_to_global_unowned.size() == local_to_global_owner.size());
672
673 // Create IndexMap for dofs range on this process
674 common::IndexMap index_map(comm, num_owned, local_to_global_unowned,
675 local_to_global_owner);
676
677 // Build re-ordered dofmaps
678 std::vector<std::vector<std::int32_t>> dofmaps(node_graphs.size());
679 for (std::size_t i = 0; i < dofmaps.size(); ++i)
680 {
681 const std::vector<std::int32_t>& node_graphs_i = node_graphs[i].array;
682 dofmaps[i].resize(node_graphs_i.size());
683 std::vector<std::int32_t>& dofmaps_i = dofmaps[i];
684 for (std::size_t j = 0; j < node_graphs_i.size(); ++j)
685 {
686 std::int32_t old_node = node_graphs_i[j];
687 dofmaps_i[j] = old_to_new[old_node];
688 }
689 }
690
691 return {std::move(index_map), element_dof_layouts.front().block_size(),
692 std::move(dofmaps)};
693}
694
695//-----------------------------------------------------------------------------
696fem::DofMap fem::build_real_element_dofmap(

Callers

nothing calls this directly

Calls 5

build_basic_dofmapsFunction · 0.85
compute_reordering_mapFunction · 0.85
get_global_indicesFunction · 0.85
sizeMethod · 0.45
block_sizeMethod · 0.45

Tested by

no test coverage detected