Beispiel #1
0
void flowrout_init(int routingModel)
//
//  Input:   routingModel = routing model code
//  Output:  none
//  Purpose: initializes flow routing system.
//
{
    // --- initialize for dynamic wave routing 
    if ( routingModel == DW )
    {
        // --- check for valid conveyance network layout
        validateGeneralLayout();
        dynwave_init();

        // --- initialize node & link depths if not using a hotstart file
        if ( Fhotstart1.mode == NO_FILE )
        {
            initNodeDepths();
            initLinkDepths();
        }
    }

    // --- validate network layout for kinematic wave routing
    else validateTreeLayout();

    // --- initialize node & link volumes
    initNodes();
    initLinks();
}
Beispiel #2
0
CityMng::CityMng()
{


	//Init glew
	int err=glewInit();
	if(err!=GLEW_OK)
	{
		//exit();
	}

	//m_sceneGraph = new Node(Vector3<float>(0, 0, 0));
	
	m_gui = new GUI();
	m_translation = Vector3<float>(0,0,0);
	m_size = 0;

	m_parentNode = new Node();


	//Light
	initLight();

	//Nodes
	initNodes();
}
int main(int argc,char *argv[])
{
	int N=atoi(argv[1]),i;
	link_t head,x,temp;

	initNodes(N+1);
	head=newNode(0);
	head->next=NULL;

	srand((unsigned)time(NULL));

	for(x=head,i=1;i<=N;i++){
		temp=newNode(rand()%100);
		insertNext(x,temp);
		x=temp;
	}

	print_list(head);

	move_largest_item(head);
	
	print_list(head);

	return(0);
}
Beispiel #4
0
int main(int argc, char **argv)
{
    /** VARIÁVEIS *****************************************************/
        int i, N, M;
        Node t, x; link teste;
        
        if(argc != 3)
        {
            printf("USAGE: josephus <n_people> <m>\n");
            return EXIT_FAILURE;
        }
        
        N = atoi(argv[1]); M = atoi(argv[2]);
        printf("Último membro restante: %d\n", N);
        printf("Último membro restante: %d\n", M);
    
    /** INICIA LISTA **************************************************/ 
        initNodes(N); /* Não há mais que N argumentos */
        
        /* 
         * Estamos assumindo que cada nódulo, ao ser criado, 
         * aponta para si mesmo.
         */
        
        /* Inicializamos x com newNode(1) para termos onde 
         * adicionar os próximos elementos */
        for(i = 2, x = newNode(1); i <= N; i++)
        {
            t = newNode(i); insertNode(x,t); x = t;
        }
        
        for(teste = x; Next(teste) != x; teste = Next(teste))
        {
            printf("%d ", Item(teste));
        }
        
        while(x != Next(x))
        {
            for(i = 1; i < M; i++)
            {
                printf("%d ", Item(x));
                x = Next(x);
            }
            freeNode(deleteNext(x));
            /* Cada vez que caminhamos pela lista, vamos 
             * fazendo a remoção dos elementos. Logo, po-
             * demos apenas ir seguindo os argumentos con-
             * forme a necessidade. */
        }
        
        printf("Último membro restante: %d\n", Item(x));
    
    return 0;
}
Beispiel #5
0
result_t calculateByBisectionStrategy(int sing, int lvl) {
    
    auto cs = CellNodeSpace<DIMS>();
    cs.initWithOneCell(lvl);
    buildSingularity(cs,sing);
    enforceExtendedTauRule(cs,1);
    cs.initNodes();
    
    NestedDivisionStrategy<DIMS> strat(cs);
    auto ret = strat.AbstractStrategy<DIMS>::calculateStrategy();
    
    return ret->getCost();
}
Beispiel #6
0
BOOL CAddLinksDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化

	initNodes();
	m_ComboLinkType.SetCurSel(0);
	m_ComboNode1.SetCurSel(0);
	m_ComboNode2.SetCurSel(0);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Beispiel #7
0
void Compiler::initialize(RScope* remote_scope) {
  //assert(VMProcess::vm_operation() != NULL, "must be in vmProcess to compile");
  if (VMProcess::vm_operation() == NULL)
    warning("should be in vmProcess to compile"); //softened to a warning to support testing
  nofCompilations++;
#ifdef DEBUG
  messages = new stringStream(250 * K);
#endif

  if (remote_scope) {
    _uses_inlining_database = true;
    recompileeRScope = remote_scope;
  } else {
    _uses_inlining_database = false;
  }

  recompileeRScope = remote_scope;
  assert(theCompiler == NULL, "shouldn't have but one compiler at a time");
  assert(theMacroAssm == NULL, "shouldn't have an assembler yet");
  PReg::initPRegs();	// must come early (before any PReg allocation)
  initNodes();		// same here (before creating nodes)
  initLimits();
  theCompiler	= lastCompiler = this;
  _code         = new CodeBuffer(CompilerInstrsSize, CompilerInstrsSize / 2);
  countID	= -1;
  topScope	= NULL;
  bbIterator 	= new BBIterator;
  /* theAllocator = */ new RegisterAllocator();
  assert(method, "must have method");
  Scope::initialize();
  _totalNofBytes = 0;
  _special_handler_call_offset = -1;
  _entry_point_offset = -1;
  _verified_entry_point_offset = -1;
  _totalNofFloatTemporaries = -1;
  _float_section_size = 0;
  _float_section_start_offset = 0;
  rec = new ScopeDescRecorder(CompilerScopesSize, CompilerPCsSize);
  // Save dependency information in the scopeDesc recorder.
  rec->add_dependant(key);

  nlrTestPoints = new GrowableArray<NLRTestNode*>(50); 
  contextList = NULL;
  scopes = new GrowableArray<InlinedScope*>(50);
  blockClosures = new GrowableArray<BlockPReg*>(50);
  firstNode = NULL;
  reporter = new PerformanceDebugger(this);
  initTopScope();
}
bool UIWidget::init()
{
    m_children = CCArray::create();
    m_children->retain();
    initNodes();
    m_pRender->retain();
    m_pRender->setZOrder(m_nWidgetZOrder);
    CCRGBAProtocol* renderRGBA = DYNAMIC_CAST_CCRGBAPROTOCOL;
    if (renderRGBA)
    {
        renderRGBA->setCascadeColorEnabled(true);
        renderRGBA->setCascadeOpacityEnabled(true);
    }
    return true;
}
Beispiel #9
0
 NodeGen::NodeGen(compilingLookup* l, sendDesc* sd, nmln* d) {
   initPRegs();
   initNodes();
   scopeStack = new SSelfScopeBList(30);
   start = current = NULL;
   L =l; send_desc = sd; diLink = d;
   haveStackFrame = false;
   delPR = new PReg(NULL, PerformDelegateeLoc, true, true);
   selPR = new PReg(NULL, PerformSelectorLoc, true, true);
   nlrHomePR = new PReg(NULL, NLRHomeReg, true, true);
   nlrHomeIDPR = new PReg(NULL, NLRHomeIDReg, true, true);
   nlrResultPR = new PReg(NULL, NLRResultReg, true, true);
   nlrTempPR = new PReg(NULL, NLRTempReg, true, true);
   framePR = new PReg(NULL, FrameReg, true, true);
   noPR = new NoPReg;
   theNodeGen = this;
 }
void
init( void )
{
    colorcube();

    // Initialize tree
    initNodes();
    
    // Create a vertex array object
    GLuint vao;
    glGenVertexArrays( 1, &vao );
    glBindVertexArray( vao );

    // Create and initialize a buffer object
    GLuint buffer;
    glGenBuffers( 1, &buffer );
    glBindBuffer( GL_ARRAY_BUFFER, buffer );
    glBufferData( GL_ARRAY_BUFFER, sizeof(points) + sizeof(colors),
                  NULL, GL_DYNAMIC_DRAW );
    glBufferSubData( GL_ARRAY_BUFFER, 0, sizeof(points), points );
    glBufferSubData( GL_ARRAY_BUFFER, sizeof(points), sizeof(colors),
                     colors );

    // Load shaders and use the resulting shader program
    GLuint program = InitShader( "vshader83.glsl", "fshader83.glsl" );
    glUseProgram( program );

    GLuint vPosition = glGetAttribLocation( program, "vPosition" );
    glEnableVertexAttribArray( vPosition );
    glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0,
			   BUFFER_OFFSET(0) );

    GLuint vColor = glGetAttribLocation( program, "vColor" );
    glEnableVertexAttribArray( vColor );
    glVertexAttribPointer( vColor, 4, GL_FLOAT, GL_FALSE, 0,
			   BUFFER_OFFSET(points) );

    ModelView = glGetUniformLocation( program, "ModelView" );
    Projection = glGetUniformLocation( program, "Projection" );

    glEnable( GL_DEPTH_TEST );
    glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );

    glClearColor( 1.0, 1.0, 1.0, 1.0 );

}
Beispiel #11
0
result_t calculateByOptimizedPlanesStrategy(int sing, int lvl) {
    
    auto cs = CellNodeSpace<DIMS>();
    cs.initWithOneCell(lvl);
    buildSingularity(cs,sing);
    enforceExtendedTauRule(cs,1);
    cs.initNodes();
    
    MemoizingOptimizedDivisionStrategy<DIMS, PlaneDividersGenerator<DIMS> > strat(cs);
    auto ret = strat.AbstractStrategy<DIMS>::calculateStrategy();
//    MemoizingOptimizedDivisionStrategy<DIMS, HalfDividersGenerator<DIMS> > strat2(cs);
//    auto ret2 = strat2.AbstractStrategy<DIMS>::calculateStrategy();
//    std::cout << *ret << "####\n";
//    std::cout << *ret2 << "########\n";
////
//        std::cout << "Cached " << strat.getMemoizedCount() << std::endl;
    return ret->getCost();
}
Beispiel #12
0
void startupNiKom(void) {
  struct MsgPort *port;

  Forbid();
  port = (struct MsgPort *)FindPort("NiKomPort");
  if(port == NULL) {
    NiKPort = (struct MsgPort *)CreatePort("NiKomPort",0);
  }
  Permit();
  if(port != NULL) {
    printf("NiKServer is already running.\n");
    exit(10);
  }
  if(NiKPort == NULL) {
    printf("Can't create message port 'NiKomPort'\n");
    exit(10);
  }
  openLibrariesAndPorts();
  setupServermem();
  initLanguages();
  
  readSysInfo();
  readTextInfo();
  readGroupData();
  ReadCommandConfig();
  ReadSystemConfig();
  readConferenceData();
  readConferenceTexts();
  readUserData();
  ReadFidoConfig();
  ReadNodeTypesConfig();
  readLastLogins();
  ReadFileKeyConfig();
  ReadStatusConfig();
  readFileAreas();
  readFileAreaFiles();
  GetServerversion();
  scanFidoConferences();
  InitLegacyConversionData();
  initNodes();
  openWindow();
}
Beispiel #13
0
void setup()
{
    SDL_Init(SDL_INIT_EVERYTHING);
    IMG_Init(IMG_INIT_PNG);

    win = SDL_CreateWindow("P53 Prototype",
            SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
            SCREEN_WIDTH, SCREEN_HEIGHT,
            SDL_WINDOW_SHOWN);

    ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);

    SDL_ShowCursor(SDL_DISABLE);

    initNodes();

    initMenu();

    loadImages( getImageNames() );
}
Beispiel #14
0
void init()
{	
	glutPro = InitShader( "glutPro.v", "glutPro.f" );
	arrayPro = InitShader( "arrayPro.v", "arrayPro.f" );
	skyPro = InitShader( "skyPro.v", "skyPro.f" );
	carPro = InitShader( "carPro.v", "carPro.f" );
	cubeMapPro = InitShader( "cubeMap.v", "cubeMap.f" );

	Angel::mat4 modelView = Angel::identity_mat();  //tmp
	projmat = Angel::Perspective( 45.0, 1, 1, 500 ); 
	modelViewStack.push( modelView );  //stack

	glClearColor(0.5, 0.8, 0.9, 1.0);
	glClearDepth( 1.0f );
	glShadeModel( GL_FLAT );
	glEnable( GL_DEPTH_TEST );
	glEnable( GL_BLEND );
	glBlendFunc( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA );

	initNodes();
}
int main(int argc,char *argv[])
{
	int i;
	link_t x,t;

	N=atoi(argv[1]),M=atoi(argv[2]);
	initNodes(N);

	for(x=newNode(1),i=2;i<=N;i++){
		t=newNode(i);
		insertNext(x,t);
		x=t;
	}

	printf("quit order:");

	t=quit(x);

	putchar('\n');
	printf("the target:%d\n",Item(t));

	return(0);
}
Beispiel #16
0
CDiceView::CDiceView()
{
	// TODO: add construction code here
	initNodes();
	initPath();

	for(int i = 0; i<8; i++)
	{
		players[i].maxConnection = countMaxConnection(i);
		players[i].excessNum = 0;
		players[i].isMyTurn = false;
	}

	players[0].isMyTurn = true;

	chosenNode = -1;	

	btnClicked = false;

	ftInfo[0].country = -1;
	ftInfo[1].country = -1;

}
Beispiel #17
0
Graph::Graph() {
    size = getNumberOfIntersections();
    isinitialized = false;
    initNodes();
}