Пример #1
0
void check_parts_allowed(const stk::mesh::BucketVector &buckets, const stk::mesh::PartVector &parts_allowed)
{
    for (unsigned i = 0; i < buckets.size(); ++i)
    {
        const stk::mesh::Bucket &bucket = *buckets[i];
        const stk::mesh::PartVector &parts_found = bucket.supersets();

        for (unsigned j = 0; j < parts_found.size(); ++j)
        {
            const stk::mesh::Part *part = parts_found[j];
            bool found = (std::find(parts_allowed.begin(), parts_allowed.end(), part) != parts_allowed.end());
            EXPECT_TRUE(found);
        }
    }
}
Пример #2
0
TEST(UnitTestRootTopology, TestRootTopologyPartGetters)
{
  const int spatial_dim = 3;
  stk::mesh::MetaData meta(spatial_dim);
  meta.commit();

  for (unsigned i = 0; i < num_test_topologies; ++i)
  {
    stk::mesh::Part &root_part1 = meta.get_topology_root_part(test_topologies[i]);

    stk::mesh::CellTopology cell_topo = stk::mesh::get_cell_topology(test_topologies[i]);
    stk::mesh::Part &root_part2 = meta.get_cell_topology_root_part(cell_topo);

    EXPECT_TRUE(root_part1 == root_part2);

    stk::topology root_topo = root_part1.topology();

    // The root_topology_part has the same topology information as the original topology.
    EXPECT_TRUE(test_topologies[i] == root_topo);

    const stk::mesh::PartVector &subsets = root_part1.subsets();
    const stk::mesh::PartVector &supersets = root_part1.supersets();

    EXPECT_TRUE(subsets.empty());
    EXPECT_EQ(1u, supersets.size());
    EXPECT_EQ(&meta.universal_part(), supersets[0]);

    stk::mesh::Part &root_part3 = meta.get_part(root_part1.mesh_meta_data_ordinal());
    EXPECT_TRUE(root_part1 == root_part3);

    stk::mesh::Part *root_part4 = meta.get_part(root_part1.name());
    EXPECT_TRUE(root_part1 == *root_part4);

    const stk::mesh::PartVector &all_parts = meta.get_parts();
    const stk::mesh::PartVector non_internal_parts = meta.get_mesh_parts();

    EXPECT_TRUE(std::find(all_parts.begin(), all_parts.end(), &root_part1) != all_parts.end());
    EXPECT_TRUE(std::find(non_internal_parts.begin(), non_internal_parts.end(), &root_part1)
                == non_internal_parts.end());
  }
}