示例#1
0
文件: partdiff-par.c 项目: arnef/hlr
/* ************************************************************************ */
int
main (int argc, char** argv)
{
	struct options options;
	struct mpi_options mpi_options;
	struct calculation_arguments arguments;
	struct calculation_results results;
	
	initMpi(&mpi_options, &argc, &argv);
	/* get parameters */
	AskParams(&options, argc, argv, mpi_options.mpi_rank == 0);              /* ************************* */

	initVariables(&arguments, &results, &options, &mpi_options);           /* ******************************************* */
	allocateMatrices(&arguments);        /*  get and initialize variables and matrices  */
	initMatrices(&arguments, &options);            /* ******************************************* */

	gettimeofday(&start_time, NULL);                   /*  start timer         */
	calculate(&arguments, &results, &options, &mpi_options);                                      /*  solve the equation  */
	gettimeofday(&comp_time, NULL);                   /*  stop timer          */

	if(mpi_options.mpi_rank == 0) displayStatistics(&arguments, &results, &options);
	DisplayMatrix(&arguments, &results, &options, mpi_options.mpi_rank, mpi_options.mpi_size, arguments.row_start, arguments.row_end);

	freeMatrices(&arguments);                                       /*  free memory     */

	MPI_Finalize();
	return 0;
}
示例#2
0
Object::Object(Model *_model, QOpenGLShaderProgram *_program, QVector<GLuint> textures){
    model = _model;
    this->textures = QVector<GLuint>(textures);
    this->program = _program;

    initVariables();
}
示例#3
0
文件: partdiff-seq.c 项目: hofu/hlr
/* ************************************************************************ */
int
main (int argc, char** argv)
{
	struct options options;
	struct calculation_arguments arguments;
	struct calculation_results results; 

	/* get parameters */
	AskParams(&options, argc, argv);              /* ************************* */

	initVariables(&arguments, &results, &options);           /* ******************************************* */

	allocateMatrices(&arguments);        /*  get and initialize variables and matrices  */
	initMatrices(&arguments, &options);            /* ******************************************* */

	gettimeofday(&start_time, NULL);                   /*  start timer         */
	calculate(&arguments, &results, &options);                                      /*  solve the equation  */
	gettimeofday(&comp_time, NULL);                   /*  stop timer          */

	displayStatistics(&arguments, &results, &options);                                  /* **************** */
	DisplayMatrix("Matrix:",                              /*  display some    */
			arguments.Matrix[results.m][0], options.interlines);            /*  statistics and  */

	freeMatrices(&arguments);                                       /*  free memory     */

	return 0;
}
示例#4
0
AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd), _fxHidden(false), _interrogation(0) {
	_system = syst;
	_console = new AvalancheConsole(this);

	_rnd = new Common::RandomSource("avalanche");
	TimeDate time;
	_system->getTimeAndDate(time);
	_rnd->setSeed(time.tm_sec + time.tm_min + time.tm_hour);
	_showDebugLines = false;

	_clock = nullptr;
	_graphics = nullptr;
	_parser = nullptr;
	_dialogs = nullptr;
	_background = nullptr;
	_sequence = nullptr;
	_timer = nullptr;
	_animation = nullptr;
	_dropdown = nullptr;
	_closing = nullptr;
	_sound = nullptr;
	_nim = nullptr;
	_ghostroom = nullptr;
	_help = nullptr;
	_highscore = nullptr;

	_platform = gd->desc.platform;
	initVariables();
}
示例#5
0
/***** init a new flap *****/
void initFlap(Main *main, Wind *wind, Extf *extf, int *flap, int *max)
{
    *max += 1;
    *flap = *max - 1;
    extf->newFlap = 0;
    
    loadBackground(&main[*max - 1], &*wind, &*flap);
    
    initVariables(&main[*max - 1]);
    
    loadTimeText(&main[*max - 1], &*wind);
    
    loadSounds(&main[*max - 1], &*flap);
    
    initTextString(&main[*max - 1]);

    initBoxes(&main[*max - 1]);

    initMiniTimer(&main[*max - 1], &*wind, &*flap);

    loadShade(&main[*max - 1], &*wind, &*flap);

    loadChooseSound(&main[*max - 1], &*wind, &*flap);

    loadBoxPics(&main[*max - 1], &*wind, &*flap);

    loadShadePics(&main[*max - 1], &*wind, &*flap);

    initMiniTimerS(&main[*max - 1], &*wind, &*flap);
}
示例#6
0
int main ( int argc, char *argv[] )
{
	char * filename = NULL;
	if ( argc < 2 )
	{
		printf ("Usage: ./disklist {filename}\n");
		printf ("\t\tfilename is the input .img to use \n");
		exit(0);
	}
 
	filename = argv[1];

	diskFile = fopen(filename, "r");
	if (diskFile == NULL)
	    exit(EXIT_FAILURE);

	initVariables();
	grabRootFiles();
	//printf("Number of files: %d\n", files.size);
	//printf("Number of rootblocks: %d\n", rootBlocks);

	rootBlockInfo();

	fclose(diskFile);

	return 0;
}
PSV_CircularIndicatorItem::PSV_CircularIndicatorItem(const QMap<PSV::ATTRIBUTE_ROLE, QVariant> &param
                                                     , QGraphicsItem *parent)
    : PSV_Item(param,parent)
    , m_max(100.0)
    , m_min(0.0)
    , m_value(m_min)
    , m_indicatorWidthRatio(0.05)
    , m_innerRadiusRatio(0.875)
    , m_coverCircleRadiusRatio(0.5)
    , m_colorCircleRadiusRatio(0.625)
    , m_coverBallRadiusRatio(0.125)
    , m_numTicks(100)
    , m_currentValue(0.0)
    , m_textItem(NULL)
    , m_polygonItem(NULL)
    , m_timeLine(NULL)
    , m_animation(NULL)
{    
    if(m_timeLine == NULL)
    {
        m_timeLine = new QTimeLine(50000);
        m_timeLine->setFrameRange(0, 500);
    }
    m_markFont.setPointSize(16);
    m_valueFont.setPointSize(22);
    initVariables();
    updateItem();
    m_isAdvancetable = true;//根据advance自动 刷新
}
示例#8
0
文件: perfmon.cpp 项目: Jinxiaohai/QT
PerfMon::PerfMon(QWidget *parent) :
    QWidget(parent)
{
    initVariables();
    initContextMenu();
    initMessages();
}
示例#9
0
/* ************************************************************************ */
int
main (int argc, char** argv)
{
	struct options options;
	struct calculation_arguments arguments;
	struct calculation_results results;

	/* get parameters */
	AskParams(&options, argc, argv);              /* ************************* */

	initVariables(&arguments, &results, &options);           /* ******************************************* */

	allocateMatrices(&arguments);        /*  get and initialize variables and matrices  */
	initMatrices(&arguments, &options);            /* ******************************************* */
	
	pthread_barrier_init(&loop_barrier, NULL, options.number+1);	/* init der Loop-Barriere */

	gettimeofday(&start_time, NULL);                   /*  start timer         */
	calculate(&arguments, &results, &options);                                      /*  solve the equation  */
	gettimeofday(&comp_time, NULL);                   /*  stop timer          */

	displayStatistics(&arguments, &results, &options);
	DisplayMatrix(&arguments, &results, &options);

	freeMatrices(&arguments);                                       /*  free memory     */

	return 0;
}
示例#10
0
Object::Object(Model *_model, QOpenGLShaderProgram *_program, GLuint _texture){
    model = _model;
    textures.push_back(_texture);
    program = _program;

    initVariables();
}
示例#11
0
void WI_Init(wbstartstruct_t* wbstartstruct)
{
    int i, j, k;
    teaminfo_t* tin;

    initVariables(wbstartstruct);
    loadData();

    // Calculate team stats.
    memset(teamInfo, 0, sizeof(teamInfo));
    for(i = 0, tin = teamInfo; i < NUMTEAMS; ++i, tin++)
    {
        for(j = 0; j < MAXPLAYERS; ++j)
        {
            // Is the player in this team?
            if(!inPlayerInfo[j].inGame || cfg.playerColor[j] != i)
                continue;

            ++tin->playerCount;

            // Check the frags.
            for(k = 0; k < MAXPLAYERS; ++k)
                tin->frags[cfg.playerColor[k]] += inPlayerInfo[j].frags[k];

            // Counters.
            if(inPlayerInfo[j].items > tin->items)
                tin->items = inPlayerInfo[j].items;
            if(inPlayerInfo[j].kills > tin->kills)
                tin->kills = inPlayerInfo[j].kills;
            if(inPlayerInfo[j].secret > tin->secret)
                tin->secret = inPlayerInfo[j].secret;
        }

        // Calculate team's total frags.
        for(j = 0; j < NUMTEAMS; ++j)
        {
            if(j == i) // Suicides are negative frags.
                tin->totalFrags -= tin->frags[j];
            else
                tin->totalFrags += tin->frags[j];
        }
    }

    if(deathmatch)
    {
        initDeathmatchStats();
        beginAnimations();
    }
    else if(IS_NETGAME)
    {
        initNetgameStats();
        beginAnimations();
    }
    else
    {
        initShowStats();
    }
}
示例#12
0
void LSHReservoirSampler::restart(LSH *hashFamIn, unsigned int numHashPerFamily, unsigned int numHashFamilies,
	unsigned int reservoirSize, unsigned int dimension, unsigned int numSecHash, unsigned int maxSamples,
	unsigned int queryProbes, unsigned int hashingProbes, float tableAllocFraction) {
	unInit();
	initVariables(numHashPerFamily, numHashFamilies, reservoirSize, dimension, numSecHash, maxSamples, queryProbes,
		hashingProbes, tableAllocFraction);
	_hashFamily = hashFamIn;
	initHelper(_numTables, _rangePow, _reservoirSize);
}
示例#13
0
OptionMenu::OptionMenu(IGraphicEngine_SharedPtr eng)
  : engine(std::move(eng))
{
	VBox = std::make_shared<Box>(Orientation::vertical, Transformation(350, 350), "commandBox");
	parser = std::make_shared<ParserIni>("conf.ini");
	textField = std::make_shared<TextField>("", Transformation(0, 0), 30, DEFAULT_FONT, Color::None, "NameTextField", engine);
	VBox->setSpacing(40);
	initVariables();
	menu();
}
示例#14
0
void init()
{	
	glDisable(GL_DEPTH_TEST);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	
	rayCaster = RayCaster(width, height);

	initVariables();

	rayCaster.initRayCast();
}
示例#15
0
/* ************************************************************************ */
int
main (int argc, char** argv)
{
	struct options options;
	struct calculation_arguments arguments;
	struct calculation_results results;

	struct comm_options comm;

	MPI_Init(&argc, &argv);
	MPI_Comm_rank(MPI_COMM_WORLD, &comm.rank);
	MPI_Comm_size(MPI_COMM_WORLD, &comm.num_procs);

	/* get parameters */
	AskParams(&options, argc, argv, comm.rank);              /* ************************* */
	initVariables(&arguments, &results, &options);           /* ******************************************* */

	if (options.method == METH_JACOBI && comm.num_procs > 1)
	{
		allocateMatrices_mpi(&arguments, &comm);
		initMatrices_mpi(&arguments, &options, &comm); 

		gettimeofday(&start_time, NULL);                   /*  start timer         */
		calculate_mpi(&arguments, &results, &options, &comm);                                      /*  solve the equation  */
		gettimeofday(&comp_time, NULL);                   /*  stop timer          */

		if (comm.rank == ROOT)
		{
			displayStatistics(&arguments, &results, &options);
		}

		DisplayMatrix_mpi(&arguments, &results, &options, comm.rank, comm.num_procs, comm.absoluteStartRow, comm.absoluteStartRow + comm.matrixRows -3);
		freeMatrices(&arguments);                                       /*  free memory     */
	}
	else
	{
		allocateMatrices(&arguments);        /*  get and initialize variables and matrices  */
		initMatrices(&arguments, &options);            /* ******************************************* */

		gettimeofday(&start_time, NULL);                   /*  start timer         */
		calculate(&arguments, &results, &options);                                      /*  solve the equation  */
		gettimeofday(&comp_time, NULL);                   /*  stop timer          */

		displayStatistics(&arguments, &results, &options);
		DisplayMatrix(&arguments, &results, &options);

		freeMatrices(&arguments);                                       /*  free memory     */
	}

	MPI_Finalize();

	return 0;
}
示例#16
0
文件: IBRZ_main.c 项目: by317/IBR-Z
void main()
{
	initVariables();
	
	DINT;
	ms_delay(1);
	InitAdc();
	SetupAdc();
	InitSysCtrl();
	InitPieCtrl();
	IER = 0x0000;
	IFR = 0x0000;
	MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
	InitPieVectTable();
	easyDSP_SCI_Init();
	InitEPwm3();
	InitEPwm4();
	pwm_setup();
	initialize_mppt_timer();
	EALLOW;
	PieVectTable.TINT2 = &mppt_int;
	PieVectTable.EPWM3_INT = &pwm_int;
	PieCtrlRegs.PIEIER3.bit.INTx3 = 0x1;
	EDIS;
	IER |= M_INT3;
	IER |= M_INT14;
	EINT;
	ms_delay(1);
	InitEPwm3Gpio();
	//InitEPwm4Gpio();
//	EALLOW;
//	GpioCtrlRegs.GPADIR.bit.GPIO4 = 1;
//	GpioCtrlRegs.GPADIR.bit.GPIO5 = 1;
//	GpioCtrlRegs.GPADIR.bit.GPIO6 = 1;
//	GpioCtrlRegs.GPADIR.bit.GPIO7 = 1;
//
//	GpioDataRegs.GPASET.bit.GPIO4 = 1;
//	GpioDataRegs.GPASET.bit.GPIO5 = 1;
//	GpioDataRegs.GPACLEAR.bit.GPIO6 = 1;
//	GpioDataRegs.GPACLEAR.bit.GPIO7 = 1;
//	EDIS;
	ERTM;
	for(;;)
	{
////		Bus_Voltage_Q15 = ((long int) AdcResult.ADCRESULT1*VBUS_SCALE);
		if(delay_flag)
		{
			ms_delay(10000);
			delay_flag = 0;
		}
	}
}
示例#17
0
文件: blink.c 项目: uSasha/LSM_watch
/** \brief the main function of the project
 *  check current state and switch apps respectively
 * \param 
 * \param 
 * \return 
 *
 */     
int main(void)
{
    /* Chip errata */
    CHIP_Init();

    /* If first word of user data page is non-zero, enable eA Profiler trace */
    BSP_TraceProfilerSetup();

    ////////////////////////////////////////////////////////////////////////
    setupSWO();
    /* Initialize LED driver */
    BSP_LedsInit();
    initButtons();
    initClock();
    initActivity();
    initVariables();
    SegmentLCD_Init(false);  /* Enable LCD without voltage boost */

    state = main_screen;

    /* Infinite blink loop */
    while (1)
    {
        //NOTE maybe button A(change state) must be checked here
        if(screen_notification == true)    // don't update screen until user reaction
        {
            EMU_EnterEM2(true);
            button = NO_BUTTON;
        }
        else
        {
            switch (state)
            {
            case main_screen:
                mainScreenApp();
                break;
            case pomodoro_screen:
                pomodoroApp();
                break;
            case activity_screen:
                activityApp();
                break;
            case time_setup_screen:
                setupTimeApp();
                break;
            case alarm_setup_screen:
                setupAlarmApp();
                break;
            }
        }
    }
}
示例#18
0
/* ************************************************************************ */
int
main (int argc, char** argv)
{
    MPI_Init(&argc, &argv);

    struct options options;
    struct calculation_arguments arguments;
    struct calculation_results results;

    /* get parameters */
    AskParams(&options, argc, argv);

    initVariables(&arguments, &results, &options);

    allocateMatrices(&arguments);        /*  get and initialize variables and matrices  */
    initMatrices(&arguments, &options);

    gettimeofday(&start_time, NULL);                  /*  start timer         */
    if (options.method == METH_JACOBI)
        calculate_jacobi(&arguments, &results, &options);        /*  solve the equation using Jaocbi  */
    else
        calculate_gaussseidel(&arguments, &results, &options);   /*  solve the equation using Gauss-Seidel  */

    MPI_Barrier(MPI_COMM_WORLD);
    gettimeofday(&comp_time, NULL);                   /*  stop timer          */

    // only attempt communication if we have more than 1 procss
    if(arguments.nproc > 1)
    {
        // communicate final maxresiduum from last rank to rank 0
        if(arguments.rank == 0)
            MPI_Recv(&results.stat_precision, 1, MPI_DOUBLE, arguments.nproc - 1, 1, MPI_COMM_WORLD, NULL);

        if(arguments.rank == arguments.nproc - 1)
            MPI_Send(&results.stat_precision, 1, MPI_DOUBLE, 0, 1, MPI_COMM_WORLD);
    }

    //printDebug(&arguments, &results); // pretty-print matrix if we are debugging
    if(arguments.rank == 0)
        displayStatistics(&arguments, &results, &options);

    DisplayMatrix("Matrix:", arguments.Matrix[results.m][0], options.interlines,
                  arguments.rank, arguments.nproc, arguments.offset + ((arguments.rank > 0) ? 1 : 0),
                  (arguments.offset + arguments.N - ((arguments.rank != arguments.nproc - 1) ? 1 : 0)));

    freeMatrices(&arguments);                                       /*  free memory     */

    MPI_Finalize();

    return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
	int								nRank, nTotalRank;
	double							fStartTime, fEndTime;

	MPI_Init(NULL, NULL);
	MPI_Comm_size(MPI_COMM_WORLD, &nTotalRank);
	MPI_Comm_rank(MPI_COMM_WORLD, &nRank);

	initVariables();
	LoadBalance(nTotalRank, nRank, atoi(argv[1]));
	
	if( 0 == nRank )
		fStartTime = MPI_Wtime();

	if(LoadMatrixNVectorData(g_nSize, atoi(argv[2])))
	{
		if( 0 == nRank )
		{
			fEndTime = MPI_Wtime();
			printf("File Read Time: %lf\n", fEndTime - fStartTime);
		}

		MVMul();
		
		if( 0 == nRank )
		{
			fStartTime = MPI_Wtime();
			printf("MVMul Time: %lf\n", fStartTime - fEndTime);
		}

		SaveResult(nRank, nTotalRank);

		if( 0 == nRank )
		{
			fEndTime = MPI_Wtime();
			printf("File Writing Time: %lf\n", fEndTime - fStartTime);
		}
	}
	else
	{
		if( 0 == nRank )
			printf("Can't allocate memeory!\n");
	}

	FinalVariables();

	MPI_Finalize();
	return 0;
}
示例#20
0
文件: k3bisoimager.cpp 项目: KDE/k3b
void K3b::IsoImager::start()
{
    jobStarted();

    cleanup();

    d->mkisofsBin = initMkisofs();
    if( !d->mkisofsBin ) {
        jobFinished( false );
        return;
    }

    initVariables();

    delete m_process;
    m_process = new K3b::Process( this );
    m_process->setFlags( K3bQProcess::RawStdout );

    *m_process << d->mkisofsBin;

    // prepare the filenames as written to the image
    m_doc->prepareFilenames();

    if( !prepareMkisofsFiles() ||
        !addMkisofsParameters() ) {
        cleanup();
        jobFinished( false );
        return;
    }

    connect( m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
             this, SLOT(slotProcessExited(int,QProcess::ExitStatus)) );
    connect( m_process, SIGNAL(stderrLine(QString)),
             this, SLOT(slotReceivedStderr(QString)) );

    qDebug() << "***** mkisofs parameters:\n";
    QString s = m_process->joinedArgs();
    qDebug() << s << endl << flush;
    emit debuggingOutput("mkisofs command:", s);

    if( !m_process->start( KProcess::SeparateChannels ) ) {
        // something went wrong when starting the program
        // it "should" be the executable
        qDebug() << "(K3b::IsoImager) could not start mkisofs";
        emit infoMessage( i18n("Could not start %1.", QLatin1String("mkisofs")), K3b::Job::MessageError );
        jobFinished( false );
        cleanup();
    }
}
void
friccion_aislada_esferica_estatica_86e574d6_4_NeDaePrivateData_create (
    NeDaePrivateData * smData ) {
    initBasicAttributes ( smData ) ;
    initStateVector ( smData ) ;
    initVariables ( smData ) ;
    initIoInfo ( smData )
    ;
    initInputDerivs ( smData ) ;
    initDirectFeedthrough ( smData ) ;
    initOutputDerivProc ( smData ) ;
    initAssemblyStructures ( smData ) ;
    initComputationFcnPtrs ( smData ) ;
    initLiveLinkToSm ( smData ) ;
}
示例#22
0
/** @brief The main top level init
 *
 * The main init function to be called from main.c before entering the main
 * loop. This function is simply a delegator to the finer grained special
 * purpose init functions.
 *
 * @author Fred Cooke
 */
void init(){
	ATOMIC_START();			/* Disable ALL interrupts while we configure the board ready for use */
	initPLL();				/* Set up the PLL and use it */
	initIO();				/* TODO make this config dependent. Set up all the pins and modules to be in low power harmless states */
	initAllPagedRAM();			/* Copy table and config blocks of data from flash to the paged ram blocks for fast data lookup */
	initAllPagedAddresses();	/* Save the paged memory addresses to variables such that we can access them from another paged block with no warnings */
	initVariables();		/* Initialise the rest of the running variables etc */
	initFlash();			/* TODO, finalise this */
	initECTTimer();			/* TODO move this to inside config in an organised way. Set up the timer module and its various aspects */
	initPITTimer();			/* TODO ditto... */
	initSCIStuff();			/* Setup the sci module(s) that we will use. */
	initConfiguration();	/* TODO Set user/feature/config up here! */
	initInterrupts();		/* still last, reset timers, enable interrupts here TODO move this to inside config in an organised way. Set up the rest of the individual interrupts */
	ATOMIC_END(); /* Re-enable any configured interrupts */
}
示例#23
0
int main(int argc, char **argv)
{
    /*Initialize and create window.*/
    glutInit(&argc, argv);
    glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    global.windowID = glutCreateWindow("Assignment 2 - s3331571");

    /*Load images to be 'transformed' into textures.*/
    globalTexture.grass = loadImage("./Texture/grass.jpg");
    globalTexture.metal = loadImage("./Texture/metal.jpg");
    
    /*Load textures from the images.*/
    globalTexture.grassT = loadTexture(globalTexture.grass);
    globalTexture.metalT = loadTexture(globalTexture.metal);
    glEnable(GL_TEXTURE_2D);

    /*Initialize any variables.*/
    initVariables();
    initFiringVariables();
    initPlayerBases();
    initScores();
   
    glEnable(GL_DEPTH_TEST);
    
    /*Call helper method to initilize lighting.*/
    initLighting();   

    /*Setup Callbacks.*/
    glutDisplayFunc(display);
    glutMotionFunc(mouseMove);
    //glutMouseFunc(mouse);
    glutKeyboardFunc(keyboard);
    glutSpecialFunc(keyboardSpecial);
    glutIdleFunc(idle);
    
    /*Give random function a seed.*/
    srand(time(NULL));

    /*Calculate initial vertices.*/
    storeStarBackground();
    calcGeometryVertices();
    
    setupAllMusic();

    glutMainLoop();
}
示例#24
0
/* ************************************************************************ */
int
main (int argc, char** argv)
{
	struct options options;
	struct calculation_arguments arguments;
	struct calculation_results results;

    // mpi setup ---------------------------------------------------------------
    MPI_Init(NULL, NULL);

    int rank, nprocs;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);

	/* get parameters */
	AskParams(&options, argc, argv, rank);

	initVariables(&arguments, &results, &options, rank, nprocs);

    // printf("[%d] %" PRIu64 " %" PRIu64 "\n", rank, arguments.offset_start, arguments.offset_end);


    // get and initialize variables and matrices
	allocateMatrices(&arguments);
	initMatrices(&arguments, &options);

	gettimeofday(&start_time, NULL);                   /*  start timer         */
    // solve the equation
    if (options.method == METH_JACOBI)
	{
		calculate_mpi(&arguments, &results, &options);
	} else
	{
		calculate(&arguments, &results, &options);
	}

	// MPI_Barrier(MPI_COMM_WORLD);
	// gettimeofday(&comp_time, NULL);                   /*  stop timer          */

	DisplayMatrix(&arguments, &results, &options);

	freeMatrices(&arguments);

    MPI_Finalize();
	return 0;
}
bool FreeFormatReader::hasNextLine() {
    string line;
    bool isTrue;
    do {
        isTrue = ((bool) getline(in, line));
        line = autalities::removeLeadingSpaces(line);
    } while (isTrue && line.empty());
    initVariables();
    currentLine = line;
    if (isTrue) {
        if (line[0] == '.') {
            isComment = true;
        } else {
            parse(line);
        }
    }
    return isTrue;
}
示例#26
0
void network::initNet(double scale)
{
    //自底向上初始化
    for(int i=1;i<=layer_num;i++)
    {
        //权值初始化
        w[i]=mat(ln[i-1],ln[i]);
        w[i].randu();
        w[i]=1-2*w[i];
        w[i]=scale*w[i];
        //偏置初始化
        o[i]=rowvec(ln[i]);
        o[i].randu();
        o[i]=1-2*o[i];
        o[i]=scale*o[i];
    }
    initVariables();
}
示例#27
0
/** @brief The main top level init
 *
 * The main init function to be called from main.c before entering the main
 * loop. This function is simply a delegator to the finer grained special
 * purpose init functions.
 */
void init(){
	ATOMIC_START();         /* Disable ALL interrupts while we configure the board ready for use */
	initPLL();              /* Set up the PLL and use it */
	initGPIO();
	initPWM();
	initADC();
	initAllPagedRAM();      /* Copy table and config blocks of data from flash to the paged RAM blocks for fast data lookup */
	initVariables();        /* Initialise the rest of the running variables etc */
	initFlash();            /* TODO, finalise this */
	initECTTimer();         /* TODO move this to inside config in an organised way. Set up the timer module and its various aspects */
//	initPITTimer();         /* TODO ditto... */
	initSCIStuff();         /* Setup the sci module(s) that we will use. */
	initConfiguration();    /* TODO Set user/feature/config up here! */
#ifdef XGATE
	initXgate();            /* Fred is a legend, for good reason as of now */
#endif
	initInterrupts();       /* still last, reset timers, enable interrupts here TODO move this to inside config in an organised way. Set up the rest of the individual interrupts */
	ATOMIC_END();           /* Re-enable any configured interrupts */
}
示例#28
0
network::network(string pre) {
    char tmp[10];
    string savePath;
    rowvec netinfo;
    savePath=pre+"netinfo.dat";
    netinfo.load(savePath.c_str(),SAVE_FORM);
    layer_num=netinfo(0);
    in_vec=netinfo(1);
    out_vec=netinfo(2);
    for(int i=1; i<=layer_num; i++)
    {
        //存储权值矩阵和偏置向量
        sprintf(tmp,"%d",i);
        savePath=pre+"w"+tmp+".dat";
        w[i].load(savePath.c_str(),SAVE_FORM);
        savePath=pre+"o"+tmp+".dat";
        o[i].load(savePath.c_str(),SAVE_FORM);
    }
    initVariables();
}
示例#29
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShow)
{

	initVariables();

	MSG msg;

	WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_VREDRAW | CS_HREDRAW | CS_OWNDC,
		WndProc, 0, 0, hInstance, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1),
		NULL, L"RenderToTextureClass", NULL };

	RegisterClassEx(&wc);

	Width = GetSystemMetrics(SM_CXSCREEN);
	Height = GetSystemMetrics(SM_CYSCREEN);

	r = (min(Height, Width)*0.7) / 2; //Radius for animation (UpdatePosition)

	hMainWnd = CreateWindow(L"RenderToTextureClass",
		L"Render to texture",
		WS_POPUP, 0, 0, Width, Height,

		NULL, NULL, hInstance, NULL);

	Init();

	ShowWindow(hMainWnd, nShow);
	UpdateWindow(hMainWnd);

	timer = SetTimer(hMainWnd, 0, updateDataDelay, 0);

	while(GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	CleanUp();

	return(0);
}
void main() {

Start_TP();

//initalize variables on startup
initVariables();

//translate.z = 10.0;

scale.x = 95.0;  //x scale
scale.y = 95.0;  //y scale
scale.z = 95.0;  //z scale


bg_color = TFT_RGBToColor16bit(92, 92, 92);

//Clear the screen
//TFT_Fill_Screen(CL_BLACK);
TFT_Fill_Screen(bg_color);


  ACCEL_Start(&cACCEL_test_status);
  while (1){

  //read the accelerometer
  ACCEL_Test();

  //Check for user input
  GetInput();

  //animate the objects in the frame
  //AnimateFrame();

  //Draw the graphics
  RenderScreen();

  frame_counter++;
  
  }

}