コード例 #1
0
PetscParallelConfiguration::PetscParallelConfiguration(Parameters & parameters):
    _parameters(parameters) {

    // Obtain the rank of the current processor
    int rank, nproc;
    MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
    MPI_Comm_size(PETSC_COMM_WORLD, &nproc);

    parameters.parallel.rank = rank;

    // Obtain the position of this subdomain, and locate its neighbors.
    createIndices();
    locateNeighbors();
    computeSizes();

    int nprocFromFile = _parameters.parallel.numProcessors[0] *
                        _parameters.parallel.numProcessors[1];

    if (parameters.geometry.dim == 3) {
        nprocFromFile *= _parameters.parallel.numProcessors[2];
    }

    if (nproc != nprocFromFile){
        handleError(1, "The number of processors specified in the configuration file doesn't match the communicator");
    }
}
コード例 #2
0
ファイル: vconsole.cpp プロジェクト: jeske/hz
ConsoleView::ConsoleView(int x,int y,int w,int h) : BufferedView(x,y,w,h) {
	// this should take into account the size of the screen
	// and stuff like that, but for now we'll just make it big...
	int width_chars = 80;
	int height_chars = 80;
	int buf_size = (width_chars * (height_chars * 2)) * sizeof(char);

	conTest = new ConsoleData(30);
	myData  = new ConsoleData(20000);

        isRunningLua = 0;
	needFullPaint = 0;
	inputRowHeight = 0;
	consoleViewDisabled = 0;
	wantsInputFocus = 1;
	scrollback_lines = 0;
	curPrompt = "> ";  // set the default prompt string
	consoleHandler = NULL; // nullify the callback..


#if 0
	hndlMgr->addHandle(linepen =  CreatePen(PS_SOLID,0,RGB(255,255,0)));
	hndlMgr->addHandle(blackpen = CreatePen(PS_SOLID,0,RGB(0,0,0)));
	hndlMgr->addHandle(blackbrush = CreateSolidBrush(RGB(0,0,0)));
	
	if (!linepen || !blackpen || !blackbrush) {
		CleanupAndExit("Couldn't CreatePen() in ConsoleView::ConsoleView()");
	}
#endif

	


	// allocate the bufferspace..
	inputMaxLen = 512;
	if ((inputString = (char *)malloc(inputMaxLen)) == NULL) {
		CleanupAndExit("Couldn't allocate input buffer!");
	}
	curInputPos = 0;
	strcpy(inputString,curPrompt);
	oldPromptLen = curInputPos = strlen(inputString);

	if ((myBuffer.start = (char *)malloc(buf_size)) == NULL)  {
		CleanupAndExit("Couldn't allocate text buffer!");
	}
	myBuffer.end = myBuffer.start + buf_size;
	myBuffer.head = myBuffer.tail = myBuffer.start;

	
	computeSizes();
	clear();
	repaint();
}