Esempio n. 1
0
//Diese Funktion erstellt 3 Fenster und 8 Trackbars
void ObjectTracking::setWindowSettings(){

	namedWindow("Kalibrierung",1);
	namedWindow("Farbe1",1);
	//namedWindow("Trackfenster",1);
	namedWindow("Farbe2",1);

	moveWindow("Farbe1",800,50);
	moveWindow("Farbe2",800,50);
	moveWindow("Kalibrierung",50,50);

	cvCreateTrackbar("LowerH", "Farbe1", &lowerH, 180, NULL);
	cvCreateTrackbar("UpperH", "Farbe1", &upperH, 180, NULL);

	cvCreateTrackbar("LowerS", "Farbe1", &lowerS, 256, NULL);
	cvCreateTrackbar("UpperS", "Farbe1", &upperS, 256, NULL);

	cvCreateTrackbar("LowerV", "Farbe1", &lowerV, 256, NULL);
	cvCreateTrackbar("UpperV", "Farbe1", &upperV, 256, NULL);

	cvCreateTrackbar("LowerH2", "Farbe2", &lowerH2, 180, NULL);
	cvCreateTrackbar("UpperH2", "Farbe2", &upperH2, 180, NULL);

	cvCreateTrackbar("LowerS2", "Farbe2", &lowerS2, 256, NULL);
	cvCreateTrackbar("UpperS2", "Farbe2", &upperS2, 256, NULL);

	cvCreateTrackbar("LowerV2", "Farbe2", &lowerV2, 256, NULL);
	cvCreateTrackbar("UpperV2", "Farbe2", &upperV2, 256, NULL); 

	cvCreateTrackbar("rectangleSizeH", "Kalibrierung", &rHeight, 100, NULL);  
	cvCreateTrackbar("rectangleSizeW", "Kalibrierung", &rWidth, 100, NULL);

	setTrackbarPos("rectangleSizeH", "Kalibrierung", 50);
	setTrackbarPos("rectangleSizeW", "Kalibrierung", 50);
}
Esempio n. 2
0
Cor Visao::gravaCor(){        
    Cor cor = Cor();

    while (true){ 
        clock_t start=tempo();  

        cam >> imagem;

        cvtColor(imagem, imagemHSV, COLOR_BGR2HSV); 

        imshow("Imagem Normal", imagem); 
        moveWindow("Imagem Normal", 0, 0);  

        inRange(imagemHSV, Scalar(pontos[0]-variacaoH, pontos[1]*(1-variacao), pontos[2]*(1-variacao)),
         Scalar(pontos[0]+variacaoH, pontos[1]*(1+variacao), pontos[2]*(1+variacao)), imagemTratada); 
        
        //medianBlur(imagemTratada, imagemTratada, 3);     

        imshow("Calibragem", imagemTratada); 
        moveWindow("Calibragem", 640, 0);

        setMouseCallback("Imagem Normal", corPixel, 0);

        char key =  waitKey(1);    
        if (key == 27){
            for (int i=0; i<10; i++){
                destroyAllWindows();
                waitKey(1);  
            }
            break; 
        }
        if (clique == true){
            cor.corH = pontos[0];
            cor.corS = pontos[1];
            cor.corV = pontos[2];

            if (key == 32){ 
                for (int i=0; i<10; i++){
                    destroyAllWindows();
                    waitKey(1);  
                }
                cout << "Cor Calibrada" << endl;
                clique = false;
                pontos[0] = 0; pontos[1] = 0; pontos[2] = 0;  
                break; 
            }            
        }        
    }
    return cor;
}
Esempio n. 3
0
void handleMouseDrag()
{
  if (drag_state == 0)
  {
    pwque = getDraggedWindowQueue();
    if (pwque)
    {
      drag_state = 1;
      if (pwque != lastWindow && pwque != &windowLine[0])
        reorderQueue(pwque);
    }
    else
      drag_state = 2;
  }
  else
  if (drag_state == 1)
  {
    switchuvm(pwque->proc);
    counter = (counter + 1) % 20;
    if (counter == 0)
      isdraw = 1;
    else
      isdraw = 0;
    moveWindow(pwque->window, mouse_info.x_position, mouse_info.y_position, down_pos_x, down_pos_y, isdraw);
  }
  if (proc == 0)
    switchkvm();
  else
    switchuvm(proc);
}
Esempio n. 4
0
/*
 * Wrapper functions to avoid infinite notify loops
 */
static void snapMoveWindow(CompWindow * w, int dx, int dy)
{
	SNAP_WINDOW(w);
	sw->skipNotify = TRUE;
	moveWindow(w, dx, dy, TRUE, TRUE);
	warpPointer(w->screen, dx, dy);
	sw->skipNotify = FALSE;
}
Esempio n. 5
0
int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        cout << "Usage: ./Optical-Flow <Input Video file>" << endl;
        return -1;
    }

    VideoCapture inputVideo(argv[1]);
    if (!inputVideo.isOpened())
    {
        cout << "Error opening Input Video " << argv[1] << endl;
        return -1;
    }
    double fps = inputVideo.get(CV_CAP_PROP_FPS);
    int delay = 1000/fps;    // time in ms between successive frames = 1000/fps
    cout << "FPS = " << fps << endl;
    cout << "Number of frames = " << static_cast<int>(inputVideo.get(CV_CAP_PROP_FRAME_COUNT)) << endl;

    // Create instance of Motion Estimator
    MotionEstimator m;

    Mat frame;
    bool stop(false);
    int frameNum = 0;

    namedWindow("Input Video");
    moveWindow("Input Video", 600, 300);

    while(!stop)
    {
        inputVideo >> frame;            // read current frame
        if( frame.empty()) break;       // check if at end
        frameNum++;
        imshow("Input Video", frame);

        // Perform Optical Flow and track the features
        m.performFeatureDetection(frame);

        if (inputVideo.get(CV_CAP_PROP_POS_FRAMES) == NUM_FRAMES_TO_PROCESS)
        {
            cout << "\nDone" << endl;
            break;
        }
        // introduce delay or press key to stop
        if (waitKey(delay) >= 0)
            stop = true;
    }

    waitKey(0);
    return 0;
}
MultipleImageWindow::MultipleImageWindow(string window_title, int cols, int rows, int flags)
{
    this->window_title= window_title;
    this->cols= cols;
    this->rows= rows;
    namedWindow(window_title, flags);
    moveWindow(window_title, 0, 0);
    // ToDo: detect resolution of desktop and show fullresolution canvas
    this->canvas_width= 1200;
    this->canvas_height= 700;
    this->canvas= Mat(this->canvas_height, this->canvas_width, CV_8UC3);     
    imshow(this->window_title, this->canvas);
}
Esempio n. 7
0
Mat threshold_and_convert(Mat image)
{
	Mat new_image ;
	threshold(image , new_image , 0 , 1 , 0);
	image.convertTo(new_image, CV_8U ,255) ;
	
	if(DEBUG)
	{
		imshow("thresholded_image" , new_image );
		moveWindow("thresholded_image", 100 , 100);
	}	

	return new_image;
}
/*  Handle the velocity */
static void
throwPreparePaintScreen (CompScreen *s,
			int        ms)
{
    CompWindow *w;
    THROW_SCREEN (s);

    for (w = s->windows; w; w = w->next)
    {
	THROW_WINDOW (w);

	if (tw->moving)
	    tw->time += ms;

        tw->xVelocity /= (1.0 + (throwGetFrictionConstant (s) / 100));
	tw->yVelocity /= (1.0 + (throwGetFrictionConstant (s) / 100));

	if (!tw->moving && (
	    (tw->xVelocity < 0.0f || tw->xVelocity > 0.0f) ||
	    (tw->yVelocity < 0.0f || tw->yVelocity > 0.0)))
	{
	    int dx = roundf(tw->xVelocity * (ms / 10) * (throwGetVelocityX (s) / 10));
	    int dy = roundf (tw->yVelocity * (ms / 10) * (throwGetVelocityY (s) / 10));

	    if (throwGetConstrainX (s))
	    {
		if ((WIN_REAL_X (w) + dx) < 0)
		    dx = 0;
		else if ((WIN_REAL_X (w) + WIN_REAL_W (w) + dx) > w->screen->width)
		    dx = 0;
	    }
	    if (throwGetConstrainY (s))
	    {
		if ((WIN_REAL_Y (w) + dy) < 0)
		    dy = 0;
		else if ((WIN_REAL_Y (w) + WIN_REAL_H (w) + dy) > w->screen->height)
		    dy = 0;
	    }

	    moveWindow (w, dx, dy, TRUE, FALSE);
	    syncWindowPosition (w);
	}

    }

    UNWRAP (ts, s, preparePaintScreen);
    (*s->preparePaintScreen) (s, ms);
    WRAP (ts, s, preparePaintScreen, throwPreparePaintScreen);
}
Esempio n. 9
0
void TrackFace::on_recognition_clicked()
{
    TrackFace::capture.open(0);
    string windowName="Track Face";
    cv::namedWindow(windowName.c_str(), cv::WINDOW_AUTOSIZE);
    moveWindow(windowName.c_str(), window_x, window_y);
    setMouseCallback(windowName.c_str(), trackFaceCallBack, NULL);

    while (true)
    {
        cv::Mat frame, buffer;
        if (!capture.isOpened()) break;

        capture >> buffer;
        cv::resize(buffer, frame,Size(buffer.cols/2,buffer.rows/2),0,0,INTER_LINEAR);

        vector<Rect_<int> > faces=haar_faces(frame);

        for (size_t i=0;i<faces.size();i++)
        {
            cv::Mat face_resized=resizeRecognitionFace(frame, faces[i]);

            int prediction=model->predict(face_resized);

            double confidence=0.0;
            model->predict(face_resized, prediction, confidence);

            cout << confidence << endl;

            string box_text="";
            if (confidence<=2400)
                box_text="Prediction is family";
            else box_text="Prediction is stranger";

            //string box_text=format("Prediction is %s", names[prediction].c_str());

            drawFace(frame, faces[i], box_text);
        }

        putText(frame, "Recognizing Face", Point(frame.cols/2-100, 30), FONT_HERSHEY_PLAIN, 1.5, CV_RGB(0,0,255),2.0);

        cv::imshow(windowName.c_str(), frame);
        while (cv::waitKey(5)==27)
        {
            capture.release();
            cv::destroyWindow(windowName.c_str());
        }
    }
}
Esempio n. 10
0
MainWindow::MainWindow(QWidget *parent, HEHUI::WindowPosition positon) :
    MainWindowBase(parent) {
    ui.setupUi(this);

    setWindowTitle(QString(APP_NAME) + " Build " + QString(APP_VERSION));
    //setWindowFlags(Qt::SplashScreen | Qt::WindowStaysOnTopHint);
    //setWindowFlags(Qt::WindowStaysOnTopHint);

    //使窗口居中
    //Center the window
    //moveWindow(positon);

    //resize(QSize(0,0));
    //showMinimized();
    //showMaximized();

    //应用样式
    //Apply the app style
    //	originalPalette = QApplication::palette();
    //	changeStyle(Settings::instance()->getStyle());


    //初始化UI
    //Init the UI
    initUI();

    //创建托盘图标
    //Create the system tray
    setupSystemTray();

    if(Settings::instance()->getRestoreWindowStateOnStartup()){
        Settings::instance()->restoreState(this);
    }else{
        //使窗口居中
        //Center the window
        moveWindow(positon);
        showMaximized();
    }


    //        qmLocale = Settings::instance()->getLanguage();
    //        qmPath = QApplication::applicationDirPath() + QDir::separator () + QString(LANGUAGE_FILE_DIR);
    //更新菜单
    //Update the menus
    //setupMenus();



}
Esempio n. 11
0
pair< pair<int, int>, pair<int, int> > GUIUtils::addHighGUITrackBarWindow(string windowName, int numberTrackBars, int cumulativeTrackBarPosition, int trackBarWindowNumber,
	int screenWidth,
	int xOffset, int yOffset) {
	namedWindow(windowName, CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO | CV_GUI_EXPANDED);

	int width = WINDOW_OPTIONS_WIDTH - WINDOW_FRAME_THICKNESS * 2;
	int height = numberTrackBars * WINDOW_OPTIONS_TRACKBAR_HEIGHT;
	resizeWindow(windowName, width, height);

	int x = (screenWidth - WINDOW_OPTIONS_WIDTH) + xOffset;
	int y = ((WINDOW_HEADER_HEIGHT + WINDOW_FRAME_THICKNESS) * trackBarWindowNumber + WINDOW_OPTIONS_TRACKBAR_HEIGHT * cumulativeTrackBarPosition) + yOffset;

	moveWindow(windowName, x, y);

	return pair< pair<int, int>, pair<int, int> >(pair<int, int>(x, y), pair<int, int>(width, height));
}
Esempio n. 12
0
void CManager::CreateGUI()
{
    namedWindow("Control", CV_WINDOW_AUTOSIZE); //create a window called "Control"
    moveWindow("Control", 700, 0);

    cvCreateTrackbar("LowH", "Control", &m_nLowH, 255); //Hue (0 - 179)//Create trackbars in "Control" window
    cvCreateTrackbar("HighH", "Control", &m_nHighH, 255);

    cvCreateTrackbar("LowS", "Control", &m_nLowS, 255); //Saturation (0 - 255)
    cvCreateTrackbar("HighS", "Control", &m_nHighS, 255);

    cvCreateTrackbar("LowV", "Control", &m_nLowV, 255); //Value (0 - 255)
    cvCreateTrackbar("HighV", "Control", &m_nHighV, 255);

    cvCreateTrackbar("Analytics", "Control", (int*) &m_bAnalytics, 1);
}
Esempio n. 13
0
static void
FWHandleIPWMoveMotionEvent (CompWindow *w, unsigned int x, unsigned int y)
{
    FREEWINS_SCREEN (w->screen);

    int dx = x - lastPointerX;
    int dy = y - lastPointerY;

    if (!fws->grabIndex)
        return;

    moveWindow(w, dx,
                  dy, TRUE, freewinsGetImmediateMoves (w->screen));
    syncWindowPosition (w);

}
Esempio n. 14
0
pair< pair<int, int>, pair<int, int> > GUIUtils::addHighGUIWindow(int column, int row, string windowName,
	int imageWidth, int imageHeight, int screenWidth, int screenHeight,
	int xOffset, int yOffset,
	int numberColumns, int numberRows) {

	if (numberColumns < 1 || numberRows < 1)
		return pair< pair<int, int>, pair<int, int> >(pair<int, int>(0, 0), pair<int, int>(0, 0));

	int imageWidthFinal = imageWidth;
	if (imageWidthFinal < 10)
		imageWidthFinal = (screenWidth - WINDOW_OPTIONS_WIDTH) / 2;

	int imageHeightFinal = imageHeight;
	if (imageHeightFinal < 10)
		imageHeightFinal = (screenHeight - WINDOW_DIGITS_HEIGHT) / 2;


	int windowHeightFinal = ((screenHeight - WINDOW_DIGITS_HEIGHT) / numberRows);
	int windowWidthFinal = (imageWidthFinal * windowHeightFinal / imageHeightFinal);

	if ((windowWidthFinal * numberColumns + WINDOW_OPTIONS_WIDTH) > screenWidth) {
		windowWidthFinal = ((screenWidth - WINDOW_OPTIONS_WIDTH) / numberColumns);
		windowHeightFinal = imageHeightFinal * windowWidthFinal / imageWidthFinal;
	}

	namedWindow(windowName, CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO | CV_GUI_EXPANDED);
	resizeWindow(windowName, windowWidthFinal - 2 * WINDOW_FRAME_THICKNESS, windowHeightFinal - WINDOW_FRAME_THICKNESS - WINDOW_HEADER_HEIGHT);

	int x = 0;
	if (column != 0) {
		x = windowWidthFinal * column;
	}

	int y = 0;
	if (row != 0) {
		y = windowHeightFinal * row;
	}

	x += xOffset;
	y += yOffset;

	moveWindow(windowName, x, y);

	return pair< pair<int, int>, pair<int, int> >(pair<int, int>(x, y), pair<int, int>(windowWidthFinal, windowHeightFinal));
}
Esempio n. 15
0
int Plotter::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: isRubberBandDragged((*reinterpret_cast< stWaveData*(*)>(_a[1]))); break;
        case 1: moveWindow((*reinterpret_cast< QRect(*)>(_a[1])),(*reinterpret_cast< PlotSettings(*)>(_a[2]))); break;
        case 2: zoomIn(); break;
        case 3: zommOut(); break;
        case 4: updateZoom((*reinterpret_cast< QRect(*)>(_a[1])),(*reinterpret_cast< PlotSettings(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Esempio n. 16
0
Mat TargetExtractor::extract(const Mat& frame, map<int, Target>& targets, bool track)
{
    mFrame = frame;

    /* for 2.avi:
     *     movement:   0.008;
     *     color:      120, 0.2;
     *     regionGrow: enable;
     * for 6.avi:
     *     movement:   0.012;
     *     color:      150, 0.4;
     *     regionGrow: disable;
     */

    movementDetect(0.012);
    colorDetect(150, 0.4);

    denoise(7, 5);
    fill(7, 5);
    medianBlur(mMask, mMask, 3);

    // TODO: make use of accumulate result

    //regionGrow();
    //fill(7, 6);
    //medianBlur(mMask, mMask, 3);

    //Mat element = getStructuringElement(MORPH_CROSS, Size(3, 3));
    //erode(mMask, mMask, element);
    //dilate(mMask, mMask, element);

    smallAreaFilter(12, 8);
#ifdef DEBUG_OUTPUT
    namedWindow("mask");
    moveWindow("mask", 350, 120);
    imshow("mask", mMask);
#endif
    if (track) {
        blobTrack(targets);
    }
    return mMask;
}
bool FlameDecider::judge(map<int, Target>& targets)
{
    bool flameDetected = false;
    
    Mat temp;
    mFrame.copyTo(temp);
    
    for (map<int, Target>::iterator it = targets.begin(); it != targets.end(); it++) {
        bool isFlame = svmPredict(it->second.feature);
        it->second.isFlame = isFlame;
        if (isFlame) {
            flameDetected = true;
            rectangle(temp, it->second.region.rect, Scalar(0, 255, 0));
        }
    }
    
    namedWindow("result");
    moveWindow("result", 350, 400);
    imshow("result", temp);
    return flameDetected;
}
Esempio n. 18
0
int loop()
{
	startInf();
	HWND hwnd = ::FindWindowA(NULL,"easyNote");
	SetTransparent(hwnd,215);
	while(1)
	{
		view();
		setcolor(RED);
		moveWindow(hwnd);
		doubleThing(inf.page-1);
		putTitle(th[0].title,BLUE);
		putThing(inf.screen_x,inf.screen_y,inf.box_y,th[0].thing,RED);
		putTime();
		drawMouse(mouse(X),mouse(Y),WHITE);
		if(keystate(VK_ESCAPE)&&keystate(VK_LBUTTON))
			break;
		delay_fps(100);
		cleardevice();
	}
	return 0;
}
Esempio n. 19
0
std::vector<KeyPoint> extract_sift_keypoints(Mat image)
{
	cout << "Extracting features..." << endl ;

	image = threshold_and_convert(image);

	SiftFeatureDetector detector;
    vector<KeyPoint> keypoints;
    detector.detect(image, keypoints);

    cout<<"keys:" << keypoints.size()<< endl ;

    if(DEBUG)
    {
    	// Add results to image and save.
    	cv::Mat output;
    	cv::drawKeypoints(image, keypoints, output);
    	imshow("sift_keys", output);
    	moveWindow("sift_keys" , 500 , 100);
	}
    return keypoints;
}
Esempio n. 20
0
void CUIEditorView::processMoveAndSizing(CPoint point)
{
	switch(m_nResponseType)
	{
	case BRP_SELECT_WINDOW_LEFT_TOP_QUAD:
		moveAndSizingWindow(point,0);
		break;
	case BRP_SELECT_WINDOW_MIDDLE_TOP_QUAD:
		moveAndSizingWindow(point,1);
		break;
	case BRP_SELECT_WINDOW_RIGHT_TOP_QUAD:
		moveAndSizingWindow(point,3);
		break;
	case BRP_SELECT_WINDOW_LEFT_MIDDLE_QUAD:
		moveAndSizingWindow(point,2);
		break;
	case BRP_SELECT_WINDOW_RIGHT_MIDDLE_QUAD:
		sizingWindow(point, 1);
		break;
	case BRP_SELECT_WINDOW_LEFT_BOTTOM_QUAD:
		break;
	case BRP_SELECT_WINDOW_MIDDLE_BOTTOM_QUAD:
		sizingWindow(point,0);
		break;
	case BRP_SELECT_WINDOW_RIGHT_BOTTOM_QUAD:
		sizingWindow(point,2);
		break;
	//中间区块,移动
	case BRP_SELECT_WINDOW_MIDDLE_MIDDLE_QUAD:
		moveWindow(point);
		break;
	case BRP_CREATE_NEW_WINDOW_QUAD:
		sizingWindow(point,2,m_pCreatedWindow);
		setCreateWindowQuad();
		break;
	default:
		return;
	}
}
Esempio n. 21
0
void CUIEditorView::processArrowMove(UINT nChar, UINT cnt)
{
	CPoint point = CPoint(0,0);
	switch(nChar)
	{
	case VK_LEFT:
		point.x = -2;
		break;
	case VK_RIGHT:
		point.x = 2;
		break;
	case VK_UP:
		point.y = -2;
		break;
	case VK_DOWN:
		point.y = 2;
		break;
	default:
		return;
	}
	moveWindow(point,point);
}
void
groupDequeueMoveNotifies (CompScreen *s)
{
    GroupPendingMoves *move;
    GroupPendingSyncs *syncs = NULL, *sync;

    GROUP_SCREEN (s);

    gs->queued = TRUE;

    while (gs->pendingMoves)
    {
	move = gs->pendingMoves;
	gs->pendingMoves = move->next;

	moveWindow (move->w, move->dx, move->dy, TRUE, move->immediate);
	if (move->sync)
	{
	    sync = malloc (sizeof (GroupPendingSyncs));
	    if (sync)
	    {
		GROUP_WINDOW (move->w);

		gw->needsPosSync = TRUE;
		sync->w          = move->w;
		sync->next       = syncs;
		syncs            = sync;
	    }
	}
	free (move);
    }

    if (syncs)
	groupDequeueSyncs (syncs);

    gs->queued = FALSE;
}
Esempio n. 23
0
static void
compiz_damage(void)
{
   CompDisplay *d;
   CompScreen *s;
   CompWindow *w;
   Eina_Bool thaw = EINA_FALSE;

   for (d = core.displays; d; d = d->next)
     for (s = d->screens; s; s = s->next)
       {
          if (!s->damageMask)
            for (w = s->windows; w; w = w->next)
              {
                 E_Client *ec;

                 ec = compiz_win_to_client(w);
                 if (w->grabbed && ((!ec->moving) && (!e_client_util_resizing_get(ec))))
                   w->screen->windowUngrabNotify(w);
                 if ((w->attrib.x == ec->client.x) && (w->attrib.y == ec->client.y))
                   continue;
                 moveWindow(w, ec->client.x - w->attrib.x, ec->client.y - w->attrib.y, TRUE, TRUE);
                 syncWindowPosition(w);
                 compiz_texture_clear(w->texture);
              }
          if (s->damageMask)
            {
               evas_damage_rectangle_add(e_comp->evas, 0, 0, 1, 1);
               thaw = EINA_TRUE;
            }
       }
   if (eina_array_count(events) || thaw)
     ecore_animator_thaw(compiz_anim);
   else
     ecore_animator_freeze(compiz_anim);
}
Esempio n. 24
0
bool Widget::event(QEvent * e)
{

    if( e->type() == QEvent::WindowStateChange )
    {
        if(windowState().testFlag(Qt::WindowMinimized) == true)
        {
            isWindowMinimized = 1;
        }
    }
    else if (e->type() == QEvent::WindowActivate)
    {
        if (!Settings::getInstance().getUseNativeDecoration())
        {
            this->setObjectName("activeWindow");
            this->style()->polish(this);
        }
        isWindowMinimized = 0;
        if (activeChatroomWidget != nullptr)
        {
            activeChatroomWidget->resetEventFlags();
            activeChatroomWidget->updateStatusLight();
        }
    }
    else if (e->type() == QEvent::WindowDeactivate && !Settings::getInstance().getUseNativeDecoration())
    {
        this->setObjectName("inactiveWindow");
        this->style()->polish(this);
    }
    else if (e->type() == QEvent::MouseMove && !Settings::getInstance().getUseNativeDecoration())
    {
        QMouseEvent *k = (QMouseEvent *)e;
        int xMouse = k->pos().x();
        int yMouse = k->pos().y();
        int wWidth = this->geometry().width();
        int wHeight = this->geometry().height();

        if (moveWidget)
        {
            inResizeZone = false;
            moveWindow(k);
        }
        else if (allowToResize)
            resizeWindow(k);
        else if (xMouse >= wWidth - PIXELS_TO_ACT or allowToResize)
        {
            inResizeZone = true;

            if (yMouse >= wHeight - PIXELS_TO_ACT)
            {
                setCursor(Qt::SizeFDiagCursor);
                resizeWindow(k);
            }
            else if (yMouse <= PIXELS_TO_ACT)
            {
                setCursor(Qt::SizeBDiagCursor);
                resizeWindow(k);
            }

        }
        else
        {
            inResizeZone = false;
            setCursor(Qt::ArrowCursor);
        }

        e->accept();
    }

    return QWidget::event(e);
}
/*
 * Setup for paint screen
 */
static void
smartputPreparePaintScreen (CompScreen *s,
			    int        msSinceLastPaint)
{
    SMARTPUT_SCREEN (s);

    if (sps->animation && sps->grabIndex)
    {
	CompWindow *w;
	int        stesps;
	float      amount, chunk;

	amount = msSinceLastPaint * 0.025f * 2.5;
	stesps = amount / (0.5f * 0.5);
	if (!stesps)
	    stesps = 1;
	chunk = amount / (float)stesps;

	while (stesps--)
	{
	    Window endAnimationWindow = None;

	    sps->animation = 0;
	    for (w = s->windows; w; w = w->next)
	    {
		SMARTPUT_WINDOW (w);

		if (spw->animation)
		{
		    spw->animation = adjustSmartputVelocity (w);
		    sps->animation |= spw->animation;

		    spw->tx += spw->xVelocity * chunk;
		    spw->ty += spw->yVelocity * chunk;

		    if (!spw->animation)
		    {
			/* animation done */
			moveWindow (w, spw->targetX - w->attrib.x,
				    spw->targetY - w->attrib.y, TRUE, TRUE);
			syncWindowPosition (w);
			updateWindowAttributes (w, CompStackingUpdateModeNone);
			endAnimationWindow = w->id;
			spw->tx = spw->ty = 0;
		    }
		}
	    }
	    if (!sps->animation)
	    {
		/* unfocus moved window if enabled */
		if (endAnimationWindow)
		    sendWindowActivationRequest (s, endAnimationWindow);
		break;
	    }
	}
    }

    UNWRAP (sps, s, preparePaintScreen);
    (*s->preparePaintScreen) (s, msSinceLastPaint);
    WRAP (sps, s, preparePaintScreen, smartputPreparePaintScreen);
}
Esempio n. 26
0
bool Window::onProcessMessage(Message* msg)
{
  switch (msg->type()) {

    case kOpenMessage:
      m_killer = NULL;
      break;

    case kCloseMessage:
      saveLayout();
      break;

    case kMouseDownMessage: {
      if (!m_isMoveable)
        break;

      clickedMousePos = static_cast<MouseMessage*>(msg)->position();
      m_hitTest = hitTest(clickedMousePos);

      if (m_hitTest != HitTestNowhere &&
          m_hitTest != HitTestClient) {
        if (clickedWindowPos == NULL)
          clickedWindowPos = new gfx::Rect(getBounds());
        else
          *clickedWindowPos = getBounds();

        captureMouse();
        return true;
      }
      else
        break;
    }

    case kMouseUpMessage:
      if (hasCapture()) {
        releaseMouse();
        jmouse_set_cursor(kArrowCursor);

        if (clickedWindowPos != NULL) {
          delete clickedWindowPos;
          clickedWindowPos = NULL;
        }

        m_hitTest = HitTestNowhere;
        return true;
      }
      break;

    case kMouseMoveMessage:
      if (!m_isMoveable)
        break;

      // Does it have the mouse captured?
      if (hasCapture()) {
        gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();

        // Reposition/resize
        if (m_hitTest == HitTestCaption) {
          int x = clickedWindowPos->x + (mousePos.x - clickedMousePos.x);
          int y = clickedWindowPos->y + (mousePos.y - clickedMousePos.y);
          moveWindow(gfx::Rect(x, y,
                               getBounds().w,
                               getBounds().h), true);
        }
        else {
          int x, y, w, h;

          w = clickedWindowPos->w;
          h = clickedWindowPos->h;

          bool hitLeft = (m_hitTest == HitTestBorderNW ||
                          m_hitTest == HitTestBorderW ||
                          m_hitTest == HitTestBorderSW);
          bool hitTop = (m_hitTest == HitTestBorderNW ||
                         m_hitTest == HitTestBorderN ||
                         m_hitTest == HitTestBorderNE);
          bool hitRight = (m_hitTest == HitTestBorderNE ||
                           m_hitTest == HitTestBorderE ||
                           m_hitTest == HitTestBorderSE);
          bool hitBottom = (m_hitTest == HitTestBorderSW ||
                            m_hitTest == HitTestBorderS ||
                            m_hitTest == HitTestBorderSE);

          if (hitLeft) {
            w += clickedMousePos.x - mousePos.x;
          }
          else if (hitRight) {
            w += mousePos.x - clickedMousePos.x;
          }

          if (hitTop) {
            h += (clickedMousePos.y - mousePos.y);
          }
          else if (hitBottom) {
            h += (mousePos.y - clickedMousePos.y);
          }

          limitSize(&w, &h);

          if ((getBounds().w != w) ||
              (getBounds().h != h)) {
            if (hitLeft)
              x = clickedWindowPos->x - (w - clickedWindowPos->w);
            else
              x = getBounds().x;

            if (hitTop)
              y = clickedWindowPos->y - (h - clickedWindowPos->h);
            else
              y = getBounds().y;

            moveWindow(gfx::Rect(x, y, w, h), false);
            invalidate();
          }
        }
      }
      break;

    case kSetCursorMessage:
      if (m_isMoveable) {
        gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();
        HitTest ht = hitTest(mousePos);
        CursorType cursor = kArrowCursor;

        switch (ht) {

          case HitTestCaption:
            cursor = kArrowCursor;
            break;

          case HitTestBorderNW:
            cursor = kSizeTLCursor;
            break;

          case HitTestBorderW:
            cursor = kSizeLCursor;
            break;

          case HitTestBorderSW:
            cursor = kSizeBLCursor;
            break;

          case HitTestBorderNE:
            cursor = kSizeTRCursor;
            break;

          case HitTestBorderE:
            cursor = kSizeRCursor;
            break;

          case HitTestBorderSE:
            cursor = kSizeBRCursor;
            break;

          case HitTestBorderN:
            cursor = kSizeTCursor;
            break;

          case HitTestBorderS:
            cursor = kSizeBCursor;
            break;

        }

        jmouse_set_cursor(cursor);
        return true;
      }
      break;

  }

  return Widget::onProcessMessage(msg);
}
Esempio n. 27
0
void Window::moveWindow(const gfx::Rect& rect)
{
  moveWindow(rect, true);
}
int main(int narg, char **args)
{
  GRID grid(DIMENSIONALITY);
  EM_FIELD myfield;
  CURRENT current;
  std::vector<SPECIE*> species;
  std::vector<SPECIE*>::const_iterator spec_iterator;
  my_rng_generator rng;

  //*******************************************BEGIN GRID DEFINITION*******************************************************

  grid.setXrange(-50.0, 0.0);
  grid.setYrange(-15.0, 15.0);
  grid.setZrange(-15, +15);

  grid.setNCells(1536, 512, 512);
  grid.setNProcsAlongY(NPROC_ALONG_Y);
  grid.setNProcsAlongZ(NPROC_ALONG_Z);

  //grid.enableStretchedGrid();
  //grid.setXandNxLeftStretchedGrid(-20.0,1000);
  //grid.setYandNyLeftStretchedGrid(-8.0,21);
  //grid.setXandNxRightStretchedGrid(20.0,1000);
  //grid.setYandNyRightStretchedGrid(8.0,21);

  grid.setBoundaries(xOpen | yPBC | zPBC);
  grid.mpi_grid_initialize(&narg, args);
  grid.setCourantFactor(0.98);

  grid.setSimulationTime(100.0);

  grid.withParticles = YES;//NO;
  grid.withCurrent = YES;//YES;

  grid.setStartMovingWindow(0);
  //grid.setBetaMovingWindow(1.0);
  //grid.setFrequencyMovingWindow(20);

  grid.setMasterProc(0);

  srand(time(NULL));
  grid.initRNG(rng, RANDOM_NUMBER_GENERATOR_SEED);

  grid.finalize();

  grid.visualDiag();

  //********************************************END GRID DEFINITION********************************************************

  //*******************************************BEGIN FIELD DEFINITION*********************************************************
  myfield.allocate(&grid);
  myfield.setAllValuesToZero();

  laserPulse pulse1;
  pulse1.setGaussianPulse();
  pulse1.setWaist(4.0);
  pulse1.setDurationFWHM(10.0);
  pulse1.setNormalizedAmplitude(0.5);
  pulse1.setCircularPolarization();
  pulse1.setPulseInitialPosition(-10.1);
  pulse1.setFocusPosition(0.0);
  pulse1.setLambda(1.0);
  pulse1.setFocusPosition(0.0);
  //    pulse1.setRotationAngleAndCenter(2.0*M_PI*(-30.0 / 360.0), 0.0);
  myfield.addPulse(&pulse1);

  myfield.boundary_conditions();

  current.allocate(&grid);
  current.setAllValuesToZero();
  //*******************************************END FIELD DEFINITION***********************************************************

  //*******************************************BEGIN SPECIES DEFINITION*********************************************************
  PLASMA plasma1;
  plasma1.density_function = box;
  plasma1.setXRangeBox(0.0, 100.0);
  plasma1.setYRangeBox(grid.rmin[1], grid.rmax[1]);
  plasma1.setZRangeBox(grid.rmin[2], grid.rmax[2]);
  plasma1.setDensityCoefficient(0.0025);

  SPECIE  electrons1(&grid);
  electrons1.plasma = plasma1;
  electrons1.setParticlesPerCellXYZ(1, 2, 2);
  electrons1.setName("ELE1");
  electrons1.type = ELECTRON;
  electrons1.creation();
  species.push_back(&electrons1);


  SPECIE ions1(&grid);
  ions1.plasma = plasma1;
  ions1.setParticlesPerCellXYZ(1, 2, 2);
  ions1.setName("ION1");
  ions1.type = ION;
  ions1.Z = 6.0;
  ions1.A = 12.0;
  //ions1.creation();
  //species.push_back(&ions1);


  //tempDistrib distribution;
  //distribution.setWaterbag(1.0e-8);
  //electrons1.add_momenta(rng,0.0,0.0,0.0,distribution);
  //ions1.add_momenta(rng,0.0, 0.0, 0.0, distribution);

  for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
    (*spec_iterator)->printParticleNumber();
  }

  //*******************************************END SPECIED DEFINITION***********************************************************

  //*******************************************BEGIN DIAGNOSTICS DEFINITION**************************************************
  OUTPUT_MANAGER manager(&grid, &myfield, &current, species);

  //manager.addEBFieldFrom(0.0,20.0);
  //manager.addSpeciesDensityFrom(electrons1.name, 0.0, 20.0);
  //manager.addSpeciesPhaseSpaceFrom(electrons1.name, 0.0, 10.0);
  //manager.addSpeciesDensityFrom(ions1.name, 0.0, 1.0);
  //manager.addDiagFrom(0.0, 1.0);

  manager.initialize(DIRECTORY_OUTPUT);
  //*******************************************END DIAGNOSTICS DEFINITION**************************************************
  grid.setDumpPath(DIRECTORY_DUMP);
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MAIN CYCLE (DO NOT MODIFY!!) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  if (grid.myid == grid.master_proc) {
    printf("----- START temporal cicle -----\n");
    fflush(stdout);
  }

  int Nstep = grid.getTotalNumberOfTimesteps();
  int dumpID = 1, dumpEvery;
  if (DO_DUMP) {
    dumpEvery = (int)(TIME_BTW_DUMP / grid.dt);
  }
  grid.istep = 0;
  if (_DO_RESTART) {
    dumpID = _RESTART_FROM_DUMP;
    restartFromDump(&dumpID, &grid, &myfield, species);
  }
  while (grid.istep <= Nstep)
  {

    grid.printTStepEvery(FREQUENCY_STDOUT_STATUS);

    manager.callDiags(grid.istep);

    myfield.openBoundariesE_1();
    myfield.new_halfadvance_B();
    myfield.boundary_conditions();

    current.setAllValuesToZero();
    for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
      (*spec_iterator)->current_deposition_standard(&current);
    }
    current.pbc();

    for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
      (*spec_iterator)->position_parallel_pbc();
    }

    myfield.openBoundariesB();
    myfield.new_advance_E(&current);

    myfield.boundary_conditions();
    myfield.openBoundariesE_2();
    myfield.new_halfadvance_B();
    myfield.boundary_conditions();

    for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
      (*spec_iterator)->momenta_advance(&myfield);
    }

    grid.time += grid.dt;

    moveWindow(&grid, &myfield, species);

    grid.istep++;
    if (DO_DUMP) {
      if (grid.istep != 0 && !(grid.istep % (dumpEvery))) {
        dumpFilesForRestart(&dumpID, &grid, &myfield, species);
      }
    }
  }

  manager.close();
  MPI_Finalize();
  exit(1);

}
void* GlassesVideo::runThread(void*) 
{

	VideoCapture gl_capture(3); 

	gl_capture.set(CV_CAP_PROP_FRAME_WIDTH , 640);
	gl_capture.set(CV_CAP_PROP_FRAME_HEIGHT, 480);

	if(!gl_capture.isOpened())
	{
		cout << "Cannot open glasses video !" << endl;
	}

	Mat gl_img, gl_img_OR;

	Mat curMat, preMat;

	//glassesOR glOR(&gl_img_OR);
	//glOR.stopRunning();
	ObjectRecognition gl_or("g20111105_4.yml.gz");
	Mat gl_img_bk;
	Mat glres_image;				//display result image

	int gl_result=255;



	RobotSearch robotsearch;
	//robotsearch.create();
	robotsearch.stopRunning();

	
	//namedWindow("Glasses Video");
	//moveWindow("Glasses Video", 645, 0);
	namedWindow("Video Live");
	moveWindow("Video Live", 645, 0);
	namedWindow("Glasses_result",CV_WINDOW_NORMAL);
	moveWindow("Glasses_result",1000,600);
	//G_glassesMode = glassesOR;
	while(1)
	{

		gl_capture >> gl_img;
		cvtColor(gl_img,gl_img_bk,CV_RGB2GRAY);
		imshow("Video Live",gl_img_bk);
		waitKey(1);

		//----------------------------glasses Motion ------------------------
		preMat = gl_img.clone();
		//imshow("preMat", preMat);
		gl_capture >> curMat;
		//imshow ("cur", curMat);
		modeSwitch(preMat, curMat);
		//-------------------------------------------------------------------

		if(G_glassesMode == glassesOR) //OR MODE
		{

			//Open Glasses Objct Recognition
			//glOR.runAsync();

			gl_result=255;
			gl_result = gl_or.find(gl_img_bk, 'G');

			//if(gl_result !=255)
			//{
			//	gl_capture >> gl_img;
			//	cvtColor(gl_img,gl_img_bk,CV_RGB2GRAY);
			//	imshow("Video Live",gl_img);
			//	waitKey(1);
			//	gl_result=255;
			//	gl_result = gl_or.find(gl_img_bk, 'G');
			//	/*if(gl_result !=255)
			//	{
			//		gl_capture >> gl_img;
			//		cvtColor(gl_img,gl_img_bk,CV_RGB2GRAY);
			//		imshow("Video Live",gl_img);
			//		waitKey(1);
			//		gl_result=255;
			//		gl_result = gl_or.find(gl_img_bk, 'G');
			//	}
			//	else gl_result=255;*/

			//}
			//gl_result=4;

			if(gl_result !=255)
			{

				//-------------------------Display the result ------------------------
				robotSpeak(gl_result, "name");
				stringstream ret_src1;  //result src
				ObjectRecognition::loadImage(ret_src1, gl_result, 'G', 1);
				glres_image = imread(ret_src1.str());
				imshow("Glasses_result", glres_image);
				waitKey(1);
				
				//--------------------glasses goes to roobt search mode------------------
				GlassesModeMutex.lock();
				CB.clear();
				G_glassesMode = robotSearch;
				G_Search_Step = 0;
				isDoneRobot = true;
				G_Target= gl_result/5;
				gl_result = 255;
				HelpStartTime = time(NULL);
				//RobotCommand(CameraMotion); //cameraMotion
				GlassesModeMutex.unlock();

				////-------------------------Open robot search thread ------------------------

				if(!robotsearch.getRunning())
					robotsearch.runAsync();
				
			}

		}



	}
	//return 0;

}
int main(int narg, char **args)
{
  GRID grid(DIMENSIONALITY);
  EM_FIELD myfield;
  CURRENT current;
  std::vector<SPECIE*> species;
  std::vector<SPECIE*>::const_iterator spec_iterator;
  int istep;
  my_rng_generator rng;

  //*******************************************BEGIN GRID DEFINITION*******************************************************

  grid.setXrange(-4.0*Xfactor, 4.0*Xfactor);
  grid.setYrange(-4.0*Yfactor, 4.0*Yfactor);
  grid.setZrange(-0.5, +0.5);

  int Nxcell = (int)(Xfactor * 1024);
  int Nycell = (int)(Yfactor * 1024);
  grid.setNCells(Nxcell, Nycell, 100);
  grid.setNProcsAlongY(NPROC_ALONG_Y);

  //grid.enableStretchedGrid();
  grid.setXandNxLeftStretchedGrid(-20.0, 250);
  grid.setXandNxRightStretchedGrid(20.0, 250);
  grid.setYandNyLeftStretchedGrid(-20.0, 250);
  grid.setYandNyRightStretchedGrid(20.0, 250);

  grid.setBoundaries(xPBC | yPBC | zPBC);
  grid.mpi_grid_initialize(&narg, args);
  grid.setCourantFactor(0.98);

  grid.setSimulationTime(5.5);

  grid.withParticles = YES;//NO;
  grid.withCurrent = YES;//YES;
  //double start, beta_mw;	int frequency_of_shifts;
  //grid.setMovingWindow(start=0, beta_mw=0.0, frequency_of_shifts=10);

  grid.setMasterProc(0);

  grid.finalize();

  srand(time(NULL));
  grid.initRNG(rng, RANDOM_NUMBER_GENERATOR_SEED);

  grid.visualDiag();

  //********************************************END GRID DEFINITION********************************************************

  //*******************************************BEGIN FIELD DEFINITION*********************************************************
  myfield.allocate(&grid);
  myfield.setAllValuesToZero();

  myfield.boundary_conditions();
  //myfield.smooth_filter(10);

  current.allocate(&grid);
  current.setAllValuesToZero();

  //*******************************************END FIELD DEFINITION***********************************************************

  //*******************************************BEGIN SPECIES DEFINITION*********************************************************
  PLASMA plasma1;
  plasma1.density_function = box;
  plasma1.setMinBox(-10.0, -10.0, grid.rmin[2]);
  plasma1.setMaxBox(10.0, 10.0, grid.rmax[2]);
  plasma1.setRampLength(0.2);
  plasma1.setDensityCoefficient(1.0);

  SPECIE  electrons1(&grid);
  electrons1.plasma = plasma1;
  electrons1.setParticlesPerCellXYZ(10, 10, 1);
  electrons1.setName("ELE1");
  electrons1.type = ELECTRON;
  electrons1.creation();
  species.push_back(&electrons1);

  SPECIE electrons2(&grid);
  electrons2.plasma = plasma1;
  electrons2.setParticlesPerCellXYZ(10, 10, 1);
  electrons2.setName("ELE2");
  electrons2.type = ELECTRON;
  electrons2.creation();
  species.push_back(&electrons2);

  tempDistrib distribution;
  distribution.setMaxwell(1.0e-5);

  electrons1.add_momenta(rng, 0.0, 0.0, -1.0, distribution);
  electrons2.add_momenta(rng, 0.0, 0.0, 1.0, distribution);

  for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
    (*spec_iterator)->printParticleNumber();
  }
  //*******************************************END SPECIES DEFINITION***********************************************************

  //*******************************************BEGIN DIAG DEFINITION**************************************************
  OUTPUT_MANAGER manager(&grid, &myfield, &current, species);

  double startOutputA = 0.0, freqOutputA = 5.0;
  double startOutputB = 0.0, freqOutputB = 1.0;

  manager.addDiagFrom(startOutputB, freqOutputB);

  manager.addEFieldFrom(startOutputA, freqOutputA);
  manager.addBFieldFrom(startOutputA, freqOutputA);

  manager.addSpeciesDensityFrom("ELE1", startOutputA, freqOutputA);
  manager.addSpeciesDensityFrom("ELE2", startOutputA, freqOutputA);

  manager.addCurrentFrom(startOutputA, freqOutputA);

  manager.addSpeciesPhaseSpaceFrom("ELE1", startOutputA, freqOutputA);
  manager.addSpeciesPhaseSpaceFrom("ELE2", startOutputA, freqOutputA);


  manager.initialize(DIRECTORY_OUTPUT);
  //*******************************************END DIAG DEFINITION**************************************************

  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MAIN CYCLE (DO NOT MODIFY) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  if (grid.myid == grid.master_proc) {
    printf("----- START temporal cicle -----\n");
    fflush(stdout);
  }

  int Nstep = grid.getTotalNumberOfTimesteps();
  int dumpID = 1, dumpEvery;
  if (DO_DUMP) {
    dumpEvery = (int)(TIME_BTW_DUMP / grid.dt);
  }
  grid.istep = 0;
  if (_DO_RESTART) {
    dumpID = _RESTART_FROM_DUMP;
    restartFromDump(&dumpID, &grid, &myfield, species);
  }
  while (grid.istep <= Nstep)
  {
    grid.printTStepEvery(FREQUENCY_STDOUT_STATUS);
    // manager.callDiags(grid.istep);

    myfield.openBoundariesE_1();
    myfield.new_halfadvance_B();
    myfield.boundary_conditions();

    current.setAllValuesToZero();
    for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
#ifdef ESIRKEPOV
      (*spec_iterator)->current_deposition(&current);
#else
      (*spec_iterator)->current_deposition_standard(&current);
#endif

    }
    current.pbc();

    for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
      (*spec_iterator)->position_parallel_pbc();
    }

    myfield.openBoundariesB();
    myfield.new_advance_E(&current);

    myfield.boundary_conditions();
    myfield.openBoundariesE_2();
    myfield.new_halfadvance_B();
    myfield.boundary_conditions();

    for (spec_iterator = species.begin(); spec_iterator != species.end(); spec_iterator++) {
#ifdef RADIATION_FRICTION
      (*spec_iterator)->momenta_advance_with_friction(&myfield, lambda);
#else
      (*spec_iterator)->momenta_advance(&myfield);
#endif
    }

    //        if(grid.istep%FIELD_FILTER_FREQ==0){
    //            myfield.applyFilter(fltr_Ex, dir_x);
    //            myfield.boundary_conditions();
    //        }

    grid.time += grid.dt;

    moveWindow(&grid, &myfield, species);

    grid.istep++;
    if (DO_DUMP) {
      if (grid.istep != 0 && !(grid.istep % (dumpEvery))) {
        dumpFilesForRestart(&dumpID, &grid, &myfield, species);
      }
    }
  }

  manager.close();
  MPI_Finalize();
  exit(0);

}