Пример #1
0
TEST(NumLib_SparsityPattern, DISABLED_SingleComponentQuadraticMesh)
#endif
{
    std::unique_ptr<MeshLib::Mesh> linear_mesh(
        MeshLib::MeshGenerator::generateLineMesh(3u, 1.));
    std::unique_ptr<MeshLib::Mesh> mesh(
        MeshLib::createQuadraticOrderMesh(*linear_mesh));
    std::unique_ptr<MeshLib::MeshSubset const> nodesSubset(
        new MeshLib::MeshSubset(*mesh, &mesh->getNodes()));

    std::vector<std::unique_ptr<MeshLib::MeshSubsets>> components;
    components.emplace_back(new MeshLib::MeshSubsets{nodesSubset.get()});
    NumLib::LocalToGlobalIndexMap dof_map(
                      std::move(components),
                      NumLib::ComponentOrder::BY_COMPONENT);

    GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh.get());

    ASSERT_EQ(7u, sp.size());
    EXPECT_EQ(3u, sp[0]);
    EXPECT_EQ(5u, sp[1]);
    EXPECT_EQ(5u, sp[2]);
    EXPECT_EQ(3u, sp[3]);
    EXPECT_EQ(3u, sp[4]);
    EXPECT_EQ(3u, sp[5]);
    EXPECT_EQ(3u, sp[6]);
}
Пример #2
0
 /// Read from HDF5
 friend void h5_read(h5::group fg, std::string subgroup_name, linear_mesh &m) {
  h5::group gr = fg.open_group(subgroup_name);
  typename linear_mesh::domain_t dom;
  double a, b;
  long L;
  h5_read(gr, "domain", dom);
  h5_read(gr, "min", a);
  h5_read(gr, "max", b);
  h5_read(gr, "size", L);
  m = linear_mesh(std::move(dom), a, b, L);
 }
Пример #3
0
TEST(NumLib_SparsityPattern, DISABLED_MultipleComponentsLinearQuadraticMesh)
#endif
{
    std::unique_ptr<MeshLib::Mesh> linear_mesh(
        MeshLib::MeshGenerator::generateLineMesh(3u, 1.));
    std::unique_ptr<MeshLib::Mesh> mesh(
        MeshLib::createQuadraticOrderMesh(*linear_mesh));
    auto base_nodes = MeshLib::getBaseNodes(mesh->getElements());
    std::unique_ptr<MeshLib::MeshSubset const> baseNodesSubset(
        new MeshLib::MeshSubset(*mesh, &base_nodes));
    std::unique_ptr<MeshLib::MeshSubset const> allNodesSubset(
        new MeshLib::MeshSubset(*mesh, &mesh->getNodes()));

    std::vector<std::unique_ptr<MeshLib::MeshSubsets>> components;
    components.emplace_back(new MeshLib::MeshSubsets{baseNodesSubset.get()});
    components.emplace_back(new MeshLib::MeshSubsets{allNodesSubset.get()});
    NumLib::LocalToGlobalIndexMap dof_map(
                      std::move(components),
                      NumLib::ComponentOrder::BY_COMPONENT);

    GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh.get());

    ASSERT_EQ(11u, sp.size());
    // 1st component
    EXPECT_EQ(5u, sp[0]);
    EXPECT_EQ(8u, sp[1]);
    EXPECT_EQ(8u, sp[2]);
    EXPECT_EQ(5u, sp[3]);
    // 2nd component
    EXPECT_EQ(5u, sp[4]);
    EXPECT_EQ(8u, sp[5]);
    EXPECT_EQ(8u, sp[6]);
    EXPECT_EQ(5u, sp[7]);
    EXPECT_EQ(5u, sp[8]);
    EXPECT_EQ(5u, sp[9]);
    EXPECT_EQ(5u, sp[10]);
}