Example #1
0
TEST_F(NumLibMeshComponentMapTest, DISABLED_SubsetOfNodesByLocation)
#endif
{
    cmap = new MeshComponentMap(components,
        NumLib::ComponentOrder::BY_LOCATION);

    // Select some nodes from the full mesh.
    std::vector<std::size_t> const ids = {0, 5, 9};
    // A smaller mesh without elements containing the selected nodes.
    auto boundary_mesh = createMeshFromSelectedNodes(*mesh, ids);

    MeshLib::MeshSubset const selected_component(boundary_mesh,
                                                 boundary_mesh.getNodes());

    int const selected_component_id = 1;

    // Subset the original cmap.
    MeshComponentMap const cmap_subset = cmap->getSubset(
        components, selected_component, {selected_component_id});

    // Check number of components as selected
    ASSERT_EQ(ids.size(), cmap_subset.dofSizeWithGhosts());

    // .. and the content of the subset.
    for (auto const* n : boundary_mesh.getNodes())
    {
        std::size_t const id = n->getID();
        Location const l_bulk(mesh->getID(), MeshItemType::Node, ids[id]);
        Location const l_boundary(boundary_mesh.getID(), MeshItemType::Node,
                                  id);
        EXPECT_EQ(cmap->getGlobalIndex(l_bulk, comp1_id),
                  cmap_subset.getGlobalIndex(l_boundary, comp1_id));
    }
}
Example #2
0
 // Returns global index of a node location and a component.
 std::size_t giAtNodeForComponent(std::size_t const n, std::size_t const c) const
 {
     return cmap->getGlobalIndex(Location(mesh->getID(), MeshItemType::Node, n), c);
 }