Esempio n. 1
0
void main(int argc, char *argv[]) {
    argc--;
    cout << " uil_my - version\n";
    cout << " Coreleft " << Coreleft() << "\n";
    //   char tmp[50];
    if((argc < 2) || (GetCmd("/h", argc, argv) != NULL)) {
        cout
            << "usage:\n"
            << argv[0] << "  in_lmethod  output_file\n"
            << "      /h - display help\n"
            << "      /dN - set dimension N\n"
            << "      /s - Skip vacuum for better show\n"
            << "      /oT - output in T times more frequently when something happens on the bound\n"
            << "      /eN - Skip calculation of sound N times ( 10 by default )\n"
            <<
#ifndef InternalPointsUrs
            "  current version - no internal points \n";
#else
            "  current version - with internal points \n";
#endif
        exit(1);
    }

    my_file = new fstream(argv[2], ios::out);


    int FstIter = 0;
    double TimeStp, EndTime, CurTime = 0, TimeWrite, PresDerivCoef;
    Region *Reg = GetRegion(
        argv[1], *my_file, FstIter, CurTime, TimeStp, TimeWrite, PresDerivCoef, EndTime);
    //	my_file->close();};/*

    double CoefUp = 1, NumSkipS = 10;
    char *tmp;
    if((tmp = GetCmd("/e", argc, argv)) != NULL)
        NumSkipS = atoi(tmp);
    if((tmp = GetCmd("/o", argc, argv)) != NULL)
        CoefUp = min(atof(tmp), 1);
    if((tmp = GetCmd("/s", argc, argv)) != NULL)
        Reg->RegionShow = 1;
    int d = 1;
    if((tmp = GetCmd("/d", argc, argv)) != NULL)
        d = atoi(tmp);
    //cout<<d<<"\n";

    Reg->SetBodySkipS(NumSkipS);

    Reg->SetWorkDim(d);
    Reg->ClcMass();
    int x = 1;

    double CurStp, OldTimeWrite, NewTimeWrite, PresDeriv = 1, OldStp = 1e5;
    int BreakSignal = 0;
    Time_struct Time;
    double CurStpSum = 0;
    int CurStpNum = 1;
    cout << " Before clc Coreleft " << Coreleft() << "\n";
    while((!(CurTime >= EndTime)) && (!BreakSignal)) {
        OldTimeWrite = CurTime;
        NewTimeWrite =
            min(OldTimeWrite + TimeWrite / (1 + PresDeriv * PresDerivCoef), EndTime);
        //cout<<" Before While NewTime "<<NewTimeWrite<<"\n";
        while((!(CurTime >= NewTimeWrite)) && (!BreakSignal)) {
            NewTimeWrite =
                min(OldTimeWrite + TimeWrite / (1 + PresDeriv * PresDerivCoef), EndTime);
            if(x < 100) {
                x++;
                CurStp = 0.5 * log10(x) * TimeStp;
            } else
                CurStp = TimeStp;
            if(CurStp + CurTime > NewTimeWrite)
                CurStp = NewTimeWrite - CurTime;
            if(CurStp < MathZer)
                break;
            if(CurStp > OldStp)
                CurStp = OldStp * (CoefUp * log(CurStp / OldStp) + 1);
            OldStp = CurStp;
            CurStpSum += CurStp;
            CurStpNum++;

            CurTime += CurStp;
            StepRegion(*Reg, CurStp, TimeStp, PresDeriv);
        }
        OutHead(*my_file, *Reg, CurTime, TimeStp, TimeWrite, PresDerivCoef, EndTime);
        cout << " Write !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1\n";
        cout << " CurStp " << CurStpSum / CurStpNum << " CurTime " << CurTime << "\n";
        CurStpNum = 1;
        CurStpSum = 0;
#ifdef WCPP
        if(_kbhit()) {
            BreakSignal = _getch();
            if(BreakSignal == ESC)
                break;
        }
#else
        while((BreakSignal = bioskey(1)) != 0)
            if(BreakSignal == ESC)
                break;
            else {
                cout << " " << BreakSignal;
                bioskey(0);
            }
#endif
    }
    cout << Time << "\n"
         << " Coreleft " << Coreleft() << "\n";
    Reg->DeleteRegion();
    my_file->close();
    cout << " Coreleft " << Coreleft() << "\n";
};