ParaThread.cpp
Go to the documentation of this file.
00001 /***
00002  Implementation of multithreading class for speeding tensor field computing and updating
00003  ***/
00004 #include "tensor_field_nav_core/ParaThread.h"
00005 #include "tensor_field_nav_core/TfCore.h"
00006 #include <iostream>
00007 #include <time.h>
00008 ParaThread::ParaThread()
00009 {
00010     stopped = false;
00011     UpdateTensorFieldMission = false;
00012     messageStr = " processing";
00013     m_ID = 0;
00014 
00015 }
00016 
00017 void ParaThread::setMessage(const QString &message)
00018 {
00019     messageStr = " processing";
00020 }
00021 
00022 void ParaThread::setID(int _ID)
00023 {
00024     m_ID = _ID;
00025 }
00026 
00027 int ParaThread::getID()
00028 {
00029     return m_ID;
00030 }
00031 
00032 void ParaThread::run()
00033 {
00034     while (UpdateTensorFieldMission)
00035     {
00036         m_tfCore->parallel_cal_tensorvals_quad(m_split_field_x1, m_split_field_x2);
00037         UpdateTensorFieldMission = false;
00038     }
00039 }
00040 
00041 void ParaThread::stop()
00042 {
00043     stopped = true;
00044 }
00045 
00046 
00047 void ParaThread::connectTensorField(TfCore *tfCore)
00048 {
00049     m_tfCore = tfCore;
00050 }
00051 
00052 void ParaThread::setUpdateTensorFieldMission(int x1, int x2)
00053 {
00054     stop();
00055     UpdateTensorFieldMission = true;
00056     m_split_field_x1 = x1;
00057     m_split_field_x2 = x2;
00058 }


tensor_field_nav_core
Author(s): Lintao Zheng, Kai Xu
autogenerated on Thu Jun 6 2019 19:50:56