Beispiel #1
0
TEST(FileIO, DISABLED_TetGenSmeshInterface)
#endif
{
    std::string const file_name (BaseLib::BuildInfo::data_path + "/FileIO/AmmerSubsurfaceCoarse.vtu");
    std::unique_ptr<MeshLib::Mesh const> const mesh (MeshLib::IO::readMeshFromFile(file_name));

    std::string const tg_new_name ("TestSmeshWriter");
    std::string const output_name(BaseLib::BuildInfo::tests_tmp_path + tg_new_name + ".smesh");
    std::vector<MeshLib::Node> attr_pnts;
    FileIO::TetGenInterface tgi;
    bool result (tgi.writeTetGenSmesh(output_name, *mesh, attr_pnts));
    ASSERT_TRUE(result);

    GeoLib::GEOObjects geo_objects;
    result = tgi.readTetGenGeometry(output_name, geo_objects);
    ASSERT_TRUE(result);
    std::string const ref_name(BaseLib::BuildInfo::data_path + "/FileIO/AmmerSubsurfaceCoarse.smesh");
    result = tgi.readTetGenGeometry(ref_name, geo_objects);
    ASSERT_TRUE(result);

    std::vector<GeoLib::Point*> const& ref_pnts (*geo_objects.getPointVec("AmmerSubsurfaceCoarse"));
    std::vector<GeoLib::Point*> const& new_pnts (*geo_objects.getPointVec(tg_new_name));
    ASSERT_EQ(ref_pnts.size(), new_pnts.size());

    std::vector<GeoLib::Surface*> const& ref_sfc (*geo_objects.getSurfaceVec("AmmerSubsurfaceCoarse"));
    std::vector<GeoLib::Surface*> const& new_sfc (*geo_objects.getSurfaceVec(tg_new_name));
    ASSERT_EQ(ref_sfc.size(), new_sfc.size());

    for (std::size_t i=0; i<ref_sfc.size(); ++i)
        ASSERT_EQ(ref_sfc[i]->getNumberOfTriangles(), new_sfc[i]->getNumberOfTriangles());

    std::remove(output_name.c_str());
}
Beispiel #2
0
// read TetGen geometry
TEST(FileIO, TetGenSmeshReader)
{
    std::string const file_name (BaseLib::BuildInfo::data_path + "/FileIO/twolayermdl.smesh");
    GeoLib::GEOObjects geo_objects;
    FileIO::TetGenInterface tgi;
    bool const result (tgi.readTetGenGeometry(file_name, geo_objects));
    ASSERT_TRUE(result);

    std::vector<GeoLib::Point*> const& pnts (*geo_objects.getPointVec("twolayermdl"));
    ASSERT_EQ(744, pnts.size());
    std::vector<GeoLib::Surface*> const& sfcs (*geo_objects.getSurfaceVec("twolayermdl"));
    ASSERT_EQ(5, sfcs.size());
    ASSERT_EQ(468, sfcs[2]->getNumberOfTriangles());
    ASSERT_EQ(191, sfcs[3]->getNumberOfTriangles());
}