예제 #1
0
void MuscleOutput(MSA &msa)
	{
	MHackEnd(msa);
	if (g_bStable)
		{
		MSA msaStable;
		Stabilize(msa, msaStable);
		msa.Clear();	// save memory
		DoOutput(msaStable);
		}
	else
		DoOutput(msa);
	}
예제 #2
0
// Buffer a single byte
int
LineBuffer::
Buffer( char c )
{
	if (  ( '\n' == c ) || ( '\0' == c ) || ( bufcount >= bufsize ) ) {
		return DoOutput( false );
	} else {
		*bufptr = c;
		bufptr++;
		bufcount++;
		return 0;
	}
}
예제 #3
0
bool TSimpleTextMiner::Run()
{
    if (Input == NULL || Output == NULL)
        return false;

    Wtroka text;
    SDocumentAttribtes docAttr;
    ETypeOfDocument type;

    while (DoInput(text, docAttr, type)) {
        bool res = DoProcess(text, docAttr, type);
        if (res)
            res = DoOutput(docAttr);

        if (!res && Errors != NULL && dynamic_cast<TStringStream*>(ErrorStream) != NULL) {
            TStringStream* str = static_cast<TStringStream*>(ErrorStream);
            Errors->OutputError(str->Str());
            str->clear();
        }
    }

    return true;
}
예제 #4
0
//______________________________________________________________________________
void MainWindow::init()
{   //initialisation of the gui
    //recall objects from .ui file and connect them with user functions


    ui_ConvertButton    = this->findChild<QCommandLinkButton*>("ConvertButton");
    ui_ExitButton       = this->findChild<QCommandLinkButton*>("ExitButton");
    ui_OutputButton     = this->findChild<QCommandLinkButton*>("OutputButton");

    connect(ui_ConvertButton,   SIGNAL(clicked()), this, SLOT(DoConvert()));
    connect(ui_ExitButton,      SIGNAL(clicked()), this, SLOT(DoExit()));
    connect(ui_OutputButton,      SIGNAL(clicked()), this, SLOT(DoOutput()));

    ui_actionExit = this->findChild<QAction*>("actionExit");
    ui_actionLoad = this->findChild<QAction*>("actionLoad");
    ui_actionSave = this->findChild<QAction*>("actionSave");
    connect(ui_actionExit, SIGNAL(triggered()), this, SLOT(DoExit()));
    connect(ui_actionSave, SIGNAL(triggered()), this, SLOT(DoSave()));
    connect(ui_actionLoad, SIGNAL(triggered()), this, SLOT(DoLoad()));


    ui_EmaxSpinBox         = this->findChild<QSpinBox*>("EmaxSpinBox");
    ui_BinSizeSpinBox      = this->findChild<QSpinBox*>("BinSizeSpinBox");
    ui_ASpinBox            = this->findChild<QSpinBox*>("ASpinBox");
    ui_ZSpinBox            = this->findChild<QSpinBox*>("ZSpinBox");

    ui_SpinParitySpinBox   = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox");
    ui_SpinParitySpinBox_2   = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_2");
    ui_SpinParitySpinBox_n1  = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n1");
    ui_SpinParitySpinBox_n2  = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n2");
    ui_TorASpinBox_1       = this->findChild<QDoubleSpinBox*>("TorASpinBox_1");
    ui_TorASpinBox_2       = this->findChild<QDoubleSpinBox*>("TorASpinBox_2");
    ui_PairSpinBox         = this->findChild<QDoubleSpinBox*>("PairSpinBox");
    ui_ParityBox         = this->findChild<QDoubleSpinBox*>("ParityBox");

    ui_E1doubleSpinBox_1   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_1");
    ui_E1doubleSpinBox_2   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_2");
    ui_E1doubleSpinBox_3   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_3");
    ui_E1doubleSpinBox_4   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_4");
    ui_E1doubleSpinBox_5   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_5");
    ui_E1doubleSpinBox_6   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_6");
    ui_M1doubleSpinBox_1   = this->findChild<QDoubleSpinBox*>("M1doubleSpinBox_1");


    ui_OutputLabel    = this->findChild<QLabel*>("OutputLabel");
    ui_TorALabel_1    = this->findChild<QLabel*>("TorALabel_1");
    ui_TorALabel_2    = this->findChild<QLabel*>("TorALabel_2");
    ui_EmaxLabel      = this->findChild<QLabel*>("EmaxLabel");
    ui_E1label_1      = this->findChild<QLabel*>("E1Label_1");
    ui_E1label_2      = this->findChild<QLabel*>("E1Label_2");
    ui_E1label_3      = this->findChild<QLabel*>("E1Label_3");
    ui_E1label_4      = this->findChild<QLabel*>("E1Label_4");
    ui_E1label_5      = this->findChild<QLabel*>("E1Label_5");
    ui_E1label_6      = this->findChild<QLabel*>("E1Label_6");
    ui_M1label_1      = this->findChild<QLabel*>("M1Label_1");
    ui_M1label_2      = this->findChild<QLabel*>("M1Label_2");
    ui_Levellabel     = this->findChild<QLabel*>("Levellabel");
    ui_Spectrumlabel  = this->findChild<QLabel*>("SpectrumLabel");

    ui_progressbar      = this->findChild<QProgressBar*>("progressBar");

    ui_E1pushButton      = this->findChild<QPushButton*>("E1pushButton");
    connect(ui_E1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile1()));

    ui_M1pushButton      = this->findChild<QPushButton*>("M1pushButton");
    connect(ui_M1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile2()));

    ui_LevelpushButton      = this->findChild<QPushButton*>("LevelpushButton");
    connect(ui_LevelpushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile3()));

    ui_LevelpushButton_2      = this->findChild<QPushButton*>("LevelpushButton_2");
    connect(ui_LevelpushButton_2, SIGNAL(clicked()),this,SLOT(Clear()));

    ui_SpectrumButton      = this->findChild<QPushButton*>("SpectrumButton");
    connect(ui_SpectrumButton, SIGNAL(clicked()),this,SLOT(DoSelectfile4()));

    ui_DensityEnergyComboBox = this->findChild<QComboBox*>("DensityEnergyComboBox");
    connect(ui_DensityEnergyComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoModel()));

    ui_ReactionComboBox = this->findChild<QComboBox*>("ReactionComboBox");
    connect(ui_ReactionComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoEmax()));

    ui_E1StrengthComboBox = this->findChild<QComboBox*>("E1StrengthComboBox");
    connect(ui_E1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoE1()));

    ui_M1StrengthComboBox = this->findChild<QComboBox*>("M1StrengthComboBox");
    connect(ui_M1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoM1()));

    ui_E1pushButton->hide();  
    ui_E1label_6->hide();
    ui_E1doubleSpinBox_3->hide();
    ui_E1doubleSpinBox_4->hide();
    ui_E1doubleSpinBox_5->hide();
    ui_E1doubleSpinBox_6->hide();

    ui_M1label_1->hide();
    ui_M1label_2->hide();
    ui_M1doubleSpinBox_1->hide();
    ui_M1pushButton->hide();

    ui_Spectrumlabel->hide();
    ui_SpectrumButton->hide();


}
예제 #5
0
// Flush the input buffer
int
LineBuffer::
Flush( void )
{
	return DoOutput( false );
}
예제 #6
0
int DoSolve(DMMG *dmmg)
/* ------------------------------------------------------------------- */
{
    AppCtx         *user  = (AppCtx*)dmmg[0]->user;
    Parameter      *param;
    PetscReal      t_output = 0.0;
    int            ierr, n_plot = 0, Ncomponents, components[3];
    DA             da = DMMGGetDA(dmmg);
    Vec            Xstar;
    Characteristic c;
    ierr = PetscBagGetData(user->bag,(void**)&param);
    CHKERRQ(ierr);

    ierr = DAGetGlobalVector(da, &Xstar);
    CHKERRQ(ierr);

    /*------------ BEGIN CHARACTERISTIC SETUP ---------------*/
    ierr = CharacteristicCreate(PETSC_COMM_WORLD, &c);
    CHKERRQ(ierr);
    /* set up the velocity interpolation system */
    Ncomponents = 2;
    components[0] = 0;
    components[1] = 1;
    ierr = CharacteristicSetVelocityInterpolationLocal(c, da, DMMGGetx(dmmg), user->Xold, Ncomponents, components, InterpVelocity2D, user);
    CHKERRQ(ierr);
    /* set up the fields interpolation system */
    Ncomponents = 1;
    components[0] = 2;
    ierr = CharacteristicSetFieldInterpolationLocal(c, da, user->Xold, Ncomponents, components, InterpFields2D, user);
    CHKERRQ(ierr);
    /*------------ END CHARACTERISTIC SETUP ----------------*/

    /* output initial data */
    PetscPrintf(PETSC_COMM_WORLD," Initialization, Time: %5.4g\n", param->t);
    if (param->verify) {
        ierr = DoVerification(dmmg,user);
        CHKERRQ(ierr);
    }
    ierr = DoOutput(dmmg,n_plot);
    CHKERRQ(ierr);
    t_output += param->t_output_interval;
    n_plot++;

    /* timestep loop */
    for (param->t=param->dt; param->t<=param->t_max; param->t+=param->dt) {
        if (param->n > param->N_steps) {
            PetscPrintf(PETSC_COMM_WORLD,"EXCEEDED MAX NUMBER OF TIMESTEPS! EXITING SOLVE!\n");
            return 0;
        }

        /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
           Solve at time t & copy solution into solution vector.
           - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
        /* Copy in the velocities to Xstar */
        ierr = VecCopy(DMMGGetx(dmmg), Xstar);
        CHKERRQ(ierr);
        /* Put \phi_* into Xstar */
        ierr = CharacteristicSolve(c, param->dt, Xstar);
        CHKERRQ(ierr);
        /* Copy the advected field into the solution \phi_t = \phi_* */
        ierr = VecCopy(Xstar, DMMGGetx(dmmg));
        CHKERRQ(ierr);

        /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
           Copy new solution to old solution in prep for the next timestep.
           - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
        ierr = VecCopy(DMMGGetx(dmmg), user->Xold);
        CHKERRQ(ierr);


        /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
           Timestep complete, report and update counter.
           - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
        PetscPrintf(PETSC_COMM_WORLD," Step: %d, Time: %5.4g\n", param->n, param->t);
        param->n++;

        /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
           Verify and make output.
           - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
        if (param->verify) {
            ierr = DoVerification(dmmg,user);
            CHKERRQ(ierr);
        }
        if (param->t >= t_output) {
            ierr = DoOutput(dmmg,n_plot);
            CHKERRQ(ierr);
            t_output += param->t_output_interval;
            n_plot++;
        }
    }
    ierr = DARestoreGlobalVector(da, &Xstar);
    CHKERRQ(ierr);
    ierr = CharacteristicDestroy(c);
    CHKERRQ(ierr);
    return 0;
}