示例#1
0
TEST(WingComponentSegment5, IntersectEta_bug)
{
    const char* filename = "TestData/compseg-rotated.xml";
    ReturnCode tixiRet;
    TiglReturnCode tiglRet;

    TiglCPACSConfigurationHandle tiglHandle = -1;
    TixiDocumentHandle tixiHandle = -1;

    tixiRet = tixiOpenDocument(filename, &tixiHandle);
    ASSERT_EQ (SUCCESS, tixiRet);
    tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle);
    ASSERT_EQ(TIGL_SUCCESS, tiglRet);

    double xsi;
    TiglBoolean hasWarning;
    ASSERT_EQ(TIGL_SUCCESS, tiglWingComponentSegmentComputeEtaIntersection(tiglHandle, "D150_wing_CS", 0.0, 0.5, 1.0, 0.5, 0.9, &xsi, &hasWarning));
    ASSERT_NEAR(0.5, xsi, 1e-6);

    ASSERT_EQ(TIGL_SUCCESS, tiglWingComponentSegmentComputeEtaIntersection(tiglHandle, "D150_wing_CS", 0.0, 0.5, 1.0, 0.5, 0.1, &xsi, &hasWarning));
    ASSERT_NEAR(0.5, xsi, 1e-6);

    // Test some invalid inputs
    ASSERT_EQ(TIGL_MATH_ERROR, tiglWingComponentSegmentComputeEtaIntersection(tiglHandle, "D150_wing_CS", 0.0, 0.5, 1.0, 0.5, 1.1, &xsi, &hasWarning));
    ASSERT_EQ(TIGL_MATH_ERROR, tiglWingComponentSegmentComputeEtaIntersection(tiglHandle, "D150_wing_CS", 0.0, 0.5, 1.0, 0.5, -0.1, &xsi, &hasWarning));
    ASSERT_EQ(TIGL_ERROR, tiglWingComponentSegmentComputeEtaIntersection(tiglHandle, "D150_wing_CS", -0.1, 0.5, 1.0, 0.5, 0.7, &xsi, &hasWarning));
    ASSERT_EQ(TIGL_ERROR, tiglWingComponentSegmentComputeEtaIntersection(tiglHandle, "D150_wing_CS", 0.0, 0.5, 1.1, 0.5, 0.7, &xsi, &hasWarning));

    ASSERT_EQ(TIGL_SUCCESS, tiglCloseCPACSConfiguration(tiglHandle));
    ASSERT_EQ(SUCCESS, tixiCloseDocument(tixiHandle));
}
示例#2
0
    static void SetUpTestCase()
    {
        const char* filename = "TestData/CPACS_21_D150.xml";
        ReturnCode tixiRet;
        TiglReturnCode tiglRet;

        tiglHandle = -1;
        tixiHandle = -1;

        tixiRet = tixiOpenDocument(filename, &tixiHandle);
        ASSERT_TRUE (tixiRet == SUCCESS);
        tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "D150_VAMP", &tiglHandle);
        ASSERT_TRUE(tiglRet == TIGL_SUCCESS);
    }
示例#3
0
    virtual void SetUp()
    {
        const char* filename = "TestData/CPACS_20_D250_10.xml";
        ReturnCode tixiRet;
        TiglReturnCode tiglRet;

        tiglHandle = -1;
        tixiHandle = -1;
        
        tixiRet = tixiOpenDocument(filename, &tixiHandle);
        ASSERT_EQ (SUCCESS, tixiRet);
        tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "D250_VAMP", &tiglHandle);
        ASSERT_EQ(TIGL_SUCCESS, tiglRet);
    }
示例#4
0
    static void SetUpTestCase()
    {
        const char* filename = "TestData/simpletest.cpacs.xml";
        ReturnCode tixiRet;
        TiglReturnCode tiglRet;

        tiglHandle = -1;
        tixiHandle = -1;
        
        tixiRet = tixiOpenDocument(filename, &tixiHandle);
        ASSERT_TRUE (tixiRet == SUCCESS);
        tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "Cpacs2Test", &tiglHandle);
        ASSERT_TRUE(tiglRet == TIGL_SUCCESS);
    }
示例#5
0
TEST(TiglSimpleFuselage, getSurfaceArea_HalfModel)
{
    const char* filename = "TestData/simpletest-halfmodel.cpacs.xml";

    TiglCPACSConfigurationHandle tiglHandle = -1;
    TixiDocumentHandle tixiHandle = -1;

    ASSERT_EQ(SUCCESS, tixiOpenDocument(filename, &tixiHandle));
    ASSERT_EQ(TIGL_SUCCESS, tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle));

    double area = 0.;
    tiglFuselageGetSurfaceArea(tiglHandle, 1, &area);

    ASSERT_NEAR(M_PI, area, M_PI * 0.1);

    tiglCloseCPACSConfiguration(tiglHandle);
    tixiCloseDocument(tixiHandle);
}
示例#6
0
/// This is a component segment with many segments
TEST(WingComponentSegment5, GetPointPerformance)
{
    const char* filename = "TestData/component-segment-bwb.xml";
    char* csUID = NULL;
    ReturnCode tixiRet;
    TiglReturnCode tiglRet;

    TiglCPACSConfigurationHandle tiglHandle = -1;
    TixiDocumentHandle tixiHandle = -1;

    tixiRet = tixiOpenDocument(filename, &tixiHandle);
    ASSERT_EQ (SUCCESS, tixiRet);
    tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle);
    ASSERT_EQ(TIGL_SUCCESS, tiglRet);
    
    tiglWingGetComponentSegmentUID(tiglHandle, 1, 1, &csUID);

    int nruns = 50;
    double x, y, z;
    double w = 0.;
    
    // first run takes longer due to creation of leading edge. we dont count it
    tiglRet = tiglWingComponentSegmentGetPoint(tiglHandle, csUID, 0.95, 0.8, &x, &y, &z);
    
    clock_t start = clock();
    for(int i = 0; i < nruns; ++i){
        tiglRet = tiglWingComponentSegmentGetPoint(tiglHandle, csUID, 0.95, 0.8, &x, &y, &z);
        //just some dummy to prevent compiler optimization
        w = w + 1.0;
    }

    clock_t stop = clock();
    ASSERT_EQ((double)nruns, w);
        
    double time_elapsed = (double)(stop - start)/(double)CLOCKS_PER_SEC/(double)nruns;
    time_elapsed *= 1000.;
    printf("Average time: %f [ms]\n", time_elapsed);
    
    ASSERT_EQ(TIGL_SUCCESS, tiglCloseCPACSConfiguration(tiglHandle));
    ASSERT_EQ(SUCCESS, tixiCloseDocument(tixiHandle));
}
示例#7
0
/// A reported bug, where tigl creates an invalid error
TEST(WingComponentSegment5, GetSegmentIntersection_BUG2)
{
    const char* filename = "TestData/component-segment-bwb.xml";

    TiglCPACSConfigurationHandle tiglHandle = -1;
    TixiDocumentHandle tixiHandle = -1;

    ASSERT_EQ (SUCCESS, tixiOpenDocument(filename, &tixiHandle));
    ASSERT_EQ(TIGL_SUCCESS, tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle));

    double xsi = 0;
    TiglBoolean hasWarning;
    ASSERT_EQ(TIGL_SUCCESS, tiglWingComponentSegmentGetSegmentIntersection(
               tiglHandle, "BWB_CST_wing_CS", "BWB_CST_wingSegment49ID", 
               0.81268, 1., 0.96, 1., 1., 
               &xsi, &hasWarning));

    ASSERT_EQ(TIGL_TRUE, hasWarning);
    ASSERT_EQ(TIGL_SUCCESS, tiglCloseCPACSConfiguration(tiglHandle));
    ASSERT_EQ(SUCCESS, tixiCloseDocument(tixiHandle));
}
示例#8
0
/// A reported bug, where the specified points do only
/// almost intersect the section border. TiGL has to be
/// friendly enough to let this small deviation happen
TEST(WingComponentSegment5, GetSegmentIntersection_BUG3)
{
    const char* filename = "TestData/simpletest.cpacs.xml";

    TiglCPACSConfigurationHandle tiglHandle = -1;
    TixiDocumentHandle tixiHandle = -1;

    ASSERT_EQ (SUCCESS, tixiOpenDocument(filename, &tixiHandle));
    ASSERT_EQ(TIGL_SUCCESS, tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle));

    double xsi = 0;
    // The segment border is at eta = 0.5. we test if 0.499995 is okay (all values below should fail)
    ASSERT_EQ(TIGL_SUCCESS, tiglWingComponentSegmentGetSegmentIntersection(
               tiglHandle, "WING_CS1", "Cpacs2Test_Wing_Seg_1_2", 
               0.0, 0.7, (1. - 1e-5)/2. + 1e-6, 0.7, 1., 
               &xsi, NULL));

    ASSERT_NEAR(0.7, xsi, 1e-7);
    // This is too inaccurate now
    ASSERT_EQ(TIGL_MATH_ERROR, tiglWingComponentSegmentGetSegmentIntersection(
               tiglHandle, "WING_CS1", "Cpacs2Test_Wing_Seg_1_2", 
               0.0, 0.7, (1. - 1e-5)/2. - 1e-5, 0.7, 1., 
               &xsi, NULL));

    // check inner section
    // The segment border is at eta = 0.0. we test if 0.000005 is okay (all values below should fail)
    ASSERT_EQ(TIGL_SUCCESS, tiglWingComponentSegmentGetSegmentIntersection(
               tiglHandle, "WING_CS1", "Cpacs2Test_Wing_Seg_1_2", 
               (1e-5)/2. - 1e-6, 0.7, 0.5 + 1e-5, 0.7, 0., 
               &xsi, NULL));

    // This should be too inaccurate now
    ASSERT_EQ(TIGL_MATH_ERROR, tiglWingComponentSegmentGetSegmentIntersection(
               tiglHandle, "WING_CS1", "Cpacs2Test_Wing_Seg_1_2", 
               (1e-5)/2. + 1e-5, 0.7, 0.5 + 1e-5, 0.7, 0., 
               &xsi, NULL));

    ASSERT_EQ(TIGL_SUCCESS, tiglCloseCPACSConfiguration(tiglHandle));
    ASSERT_EQ(SUCCESS, tixiCloseDocument(tixiHandle));
}
示例#9
0
TEST(WingComponentSegment5, GetSegmentIntersection_BUG)
{
    const char* filename = "TestData/CS_SegIntersectionBUG.xml";
    ReturnCode tixiRet;
    TiglReturnCode tiglRet;

    TiglCPACSConfigurationHandle tiglHandle = -1;
    TixiDocumentHandle tixiHandle = -1;

    tixiRet = tixiOpenDocument(filename, &tixiHandle);
    ASSERT_EQ (SUCCESS, tixiRet);
    tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle);
    ASSERT_EQ(TIGL_SUCCESS, tiglRet);

    double xsi = 0;
    TiglBoolean hasWarning;
    tiglRet = tiglWingComponentSegmentGetSegmentIntersection(tiglHandle, "wing_Cseg", "wing_Seg2", 0.0589568, 1., 0.35, 1., 1., &xsi, &hasWarning);
    ASSERT_EQ(TIGL_SUCCESS, tiglRet);
    ASSERT_EQ(TIGL_TRUE, hasWarning);
    ASSERT_NEAR(1.0, xsi, 1e-2);

    ASSERT_EQ(TIGL_SUCCESS, tiglCloseCPACSConfiguration(tiglHandle));
    ASSERT_EQ(SUCCESS, tixiCloseDocument(tixiHandle));
}
示例#10
0
TEST(WingComponentSegment4, tiglWingComponentSegmentPointGetSegmentEtaXsi_BUG2)
{
    TiglCPACSConfigurationHandle tiglHandle = -1;
    TixiDocumentHandle tixiHandle = -1;
    
    const char* filename = "TestData/simple_rectangle_compseg.xml";
    
    ReturnCode tixiRet = tixiOpenDocument(filename, &tixiHandle);
    ASSERT_TRUE (tixiRet == SUCCESS);
    TiglReturnCode tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "D150modelID", &tiglHandle);
    ASSERT_TRUE(tiglRet == TIGL_SUCCESS);
    
    double sEta = 0., sXsi = 0.;
    char *wingUID = NULL, *segmentUID = NULL;
    double errorDistance = 0;
    tiglRet = tiglWingComponentSegmentPointGetSegmentEtaXsi(tiglHandle, "D150_wing_CS", 0.5, 0.10142, &wingUID, &segmentUID, &sEta, &sXsi, &errorDistance);
    ASSERT_EQ(TIGL_SUCCESS, tiglRet);
    ASSERT_LT(errorDistance, 1e-2);
    ASSERT_STREQ("D150_wing_1Segment3ID", segmentUID);
    ASSERT_NEAR(0.5, sEta, 0.0001);

    tiglCloseCPACSConfiguration(tiglHandle);
    tixiCloseDocument(tixiHandle);
}