TEST(Mesh, MappingLineXZ2)
{
    UnstructuredMesh* msh = createLineElement(GeoLib::Point(1,0,1), GeoLib::Point(2,0,2), CoordinateSystemType::XZ);
    ElementCoordinatesMappingLocal emap(msh, *msh->getElement(0), msh->getGeometricProperty()->getCoordinateSystem());

    GeoLib::Point* p1 = emap.getNodePoint(0);
    GeoLib::Point* p2 = emap.getNodePoint(1);

    ASSERT_EQ(GeoLib::Point(0,0,0), *p1);
    ASSERT_EQ(GeoLib::Point(sqrt(2.),0,0), *p2);
}
TEST(Mesh, MappingTriYZ1)
{
    UnstructuredMesh* msh = createTriangleElement(GeoLib::Point(0,1,1), GeoLib::Point(0,3,1), GeoLib::Point(0,1,3), CoordinateSystemType::YZ);
    ElementCoordinatesMappingLocal emap(msh, *msh->getElement(0), msh->getGeometricProperty()->getCoordinateSystem());

    GeoLib::Point* p1 = emap.getNodePoint(0);
    GeoLib::Point* p2 = emap.getNodePoint(1);
    GeoLib::Point* p3 = emap.getNodePoint(2);

//    ASSERT_EQ(GeoLib::Point(0,0,0), *p1);
//    ASSERT_EQ(GeoLib::Point(2,0,0), *p2);
//    ASSERT_EQ(GeoLib::Point(0,2,0), *p3);

    ASSERT_EQ(GeoLib::Point(1,1,0), *p1);
    ASSERT_EQ(GeoLib::Point(3,1,0), *p2);
    ASSERT_EQ(GeoLib::Point(1,3,0), *p3);
}
예제 #3
0
void calculateMeshGeometricProperties(UnstructuredMesh &msh)
{
    MeshGeometricProperty* geo_prop = msh.getGeometricProperty();
    //double tol = std::numeric_limits<double>::epsilon();

    // coordinate systems
    geo_prop->setCoordinateSystem(getCoordinateSystemFromBoundingBox(geo_prop->getBoundingBox()));

    //
//    GeoLib::Point pt_diff = geo_prop->getBoundingBox().getMaxPoint() - geo_prop->getBoundingBox().getMinPoint();
//    double max_len = std::max(pt_diff[0], pt_diff[1]);
//    max_len = std::max(max_len, pt_diff[2]);
//    double min_edge_len = max_len / msh.getNumberOfNodes();
    double min_edge_len = calculateMeshMinimumEdgeLength(msh);
    geo_prop->setMinEdgeLength(min_edge_len);

    INFO("-> calculate mesh geometric properties");
    INFO("* min. edge length = %f", min_edge_len);

}