当前位置: 首页>>代码示例>>C++>>正文


C++ DataPoint类代码示例

本文整理汇总了C++中DataPoint的典型用法代码示例。如果您正苦于以下问题:C++ DataPoint类的具体用法?C++ DataPoint怎么用?C++ DataPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DataPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BOOST_FOREACH

 // create data points and add to analysis
 BOOST_FOREACH(const std::vector<QVariant>& value,variableValues) {
   DataPoint dataPoint = analysis.problem().createDataPoint(value).get();
   dataPoint.addTag("DOE");
   bool added = analysis.addDataPoint(dataPoint);
   if (added) {
     ++result;
     ++totPoints;
     if (mxSim && (totPoints == mxSim.get())) {
       break;
     }
   }
 }
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:13,代码来源:DesignOfExperiments.cpp

示例2:

vector< DataPoint > DataPoint::get_datapoints(const Matrix& o) {
	vector< DataPoint > ans;
	DataPoint tmp;
	for (int i = 0; i < o.row(); i++) {
		tmp.clear();
		for (int j = 0; j < o.column(); j++) {
			tmp.push_back(o[i][j]);
		}
		ans.push_back(tmp);
	}
	return ans;
}
开发者ID:Shangke7788,项目名称:KmeansPCA,代码行数:12,代码来源:datapoint.cpp

示例3: DataPoint

//Use accept/reject method to create data
int Foam::GenerateData( int DataAmount )
{
	//if( newDataSet->GetDataNumber() < DataAmount ) newDataSet->ReserveDataSpace( DataAmount );
	for( int dataIndex = 0; dataIndex < DataAmount; ++dataIndex )
	{
		//Generate the discrete observables, and select the correct Foam generator to use
		int combinationIndex = 0;
		int incrementValue = 1;
		DataPoint * temporaryDataPoint = new DataPoint(allNames);
		for( int discreteIndex = int(discreteNames.size() - 1); discreteIndex >= 0; --discreteIndex )
		{
			//Create the discrete observable
			Observable * temporaryObservable = generationBoundary->GetConstraint( *discreteNames_ref[unsigned(discreteIndex)] )->CreateObservable(rootRandom);
			double currentValue = temporaryObservable->GetValue();
			temporaryDataPoint->SetObservable( *discreteNames_ref2[unsigned(discreteIndex)], temporaryObservable );
			delete temporaryObservable;

			//Calculate the index
			for (unsigned int valueIndex = 0; valueIndex < discreteValues[unsigned(discreteIndex)].size(); ++valueIndex )
			{
				if ( fabs( discreteValues[unsigned(discreteIndex)][valueIndex] - currentValue ) < DOUBLE_TOLERANCE )
				{
					combinationIndex += ( incrementValue * int(valueIndex) );
					incrementValue *= int(discreteValues[unsigned(discreteIndex)].size());
					break;
				}
			}
		}

		//Use the index calculated to select a Foam generator and generate an event with it
		Double_t* generatedEvent = new Double_t[ continuousNames.size() ];
		foamGenerators[unsigned(combinationIndex)]->MakeEvent();
		foamGenerators[unsigned(combinationIndex)]->GetMCvect(generatedEvent);

		//Store the continuous observables
		for (unsigned int continuousIndex = 0; continuousIndex < continuousNames.size(); ++continuousIndex )
		{
			string unit = generationBoundary->GetConstraint( *continuousNames_ref[continuousIndex] )->GetUnit();
			double newValue = minima[continuousIndex] + ( ranges[continuousIndex] * generatedEvent[continuousIndex] );
			temporaryDataPoint->SetObservable( *continuousNames_ref2[continuousIndex], newValue, unit );
			//cout << continuousNames[continuousIndex] << "\t" << newValue << "\t" << 0.0 << "\t" << unit << endl;
		}

		delete[] generatedEvent;
		//	Store the event
		temporaryDataPoint->SetDiscreteIndex(dataIndex);
		newDataSet->AddDataPoint(temporaryDataPoint);
	}

	//cout << "Destroying Generator(s)" << endl;
	//this->RemoveGenerator();
	return DataAmount;
}
开发者ID:kgizdov,项目名称:RapidFit,代码行数:54,代码来源:Foam.cpp

示例4: printf

void MosqConnect::on_connect(int rc)
{
    printf("Connected with code %d.\n", rc);
    if(rc == 0){
        // Only attempt to subscribe on a successful connect.

        for(int i=0; i<list->size(); i++)
        {
            DataPoint dp = list->at(i);
            qDebug() << "subscribe" << dp.getMosqTopic();
            subscribe(NULL, dp.getMosqTopic().toAscii());
        }
    }
}
开发者ID:flybird119,项目名称:FunTechHouse_MQTT2WebServer_Sensor,代码行数:14,代码来源:MosqConnect.cpp

示例5: TEST_F

TEST_F(AnalysisFixture, DataPoint_JSONSerialization_PostRun_Roundtrip) {
  // Create analysis
  Analysis analysis = analysis1(PostRun);

  // Retrieve "simulated" data point
  ASSERT_FALSE(analysis.dataPoints().empty());
  DataPoint dataPoint = analysis.dataPoints()[0];

  // Serialize data point
  std::string json = dataPoint.toJSON();
  EXPECT_FALSE(json.empty());

  // Deserialize and check results
  AnalysisJSONLoadResult loadResult = loadJSON(json);
  ASSERT_TRUE(loadResult.analysisObject);
  ASSERT_TRUE(loadResult.analysisObject->optionalCast<DataPoint>());
  DataPoint copy = loadResult.analysisObject->cast<DataPoint>();
  EXPECT_EQ(json,copy.toJSON());

  // Save data point
  openstudio::path p = toPath("AnalysisFixtureData/data_point_post_run.json");
  EXPECT_TRUE(dataPoint.saveJSON(p,true));

  // Load and check results
  loadResult = loadJSON(json);
  ASSERT_TRUE(loadResult.analysisObject);
  ASSERT_TRUE(loadResult.analysisObject->optionalCast<DataPoint>());
  copy = loadResult.analysisObject->cast<DataPoint>();
  EXPECT_EQ(json,copy.toJSON());
  if (copy.toJSON() != json) {
    p = toPath("AnalysisFixtureData/data_point_post_run_roundtripped.json");
    copy.saveJSON(p,true);
  }

}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:35,代码来源:DataPoint_GTest.cpp

示例6: getTemp

float Profile::getTemp(float time) {

  DataPoint previous;
  DataPoint next;
  float temp = 0.0;

  for(int i = 0; i < dataPoints.size() - 1; i++) {

    if(time == dataPoints[i].getTime()) {
      temp = dataPoints[i].getTemp();
      break;
    }

    if(time > dataPoints[i].getTime() && time < dataPoints[i+1].getTime()) {

      previous = dataPoints[i];
      next     = dataPoints[i+1];

      float dt    = time - previous.getTime();
      float slope = (next.getTemp() - previous.getTemp()) / (next.getTime() - previous.getTime());

      temp = previous.getTemp() + (dt * slope);

      break;
    }
  }

  return temp;
}
开发者ID:MuesliReep,项目名称:BitJaeger-Reflow,代码行数:29,代码来源:profile.cpp

示例7: update

void update(bbtag, const DataPoint& p) {
    time_t t = p.unwrap<time_t > ();
    int next = 0;
    if (t % 20 < 10) {
        next = 1;
    }
    if (next != last) {
        dp.wrap(next);
        myKS1.update(dp);
        dp.wrap(1 - next);
        myKS2.update(dp);
    }
    last = next;
}
开发者ID:SamThomas,项目名称:SpaceConcordia,代码行数:14,代码来源:timePR.cpp

示例8: pthread_mutex_lock

vector<DataPoint*> RapidFitIntegrator::getGSLIntegrationPoints( unsigned int number, vector<double> maxima, vector<double> minima, DataPoint* templateDataPoint, vector<string> doIntegrate, PhaseSpaceBoundary* thisBound )
{
	pthread_mutex_lock( &GSL_DATAPOINT_GET_THREADLOCK );

	bool pointsGood = true;
	if( !_global_doEval_points.empty() )
	{
		if( _global_doEval_points[0] != NULL )
		{
			vector<string> allConsts = thisBound->GetDiscreteNames();
			for( unsigned int i=0; i< allConsts.size(); ++i )
			{
				double haveVal = _global_doEval_points[0]->GetObservable( allConsts[i] )->GetValue();
				double wantVal = templateDataPoint->GetObservable( allConsts[i] )->GetValue();

				if( haveVal != wantVal )
				{
					pointsGood = false;
					break;
				}
			}
		}
	}

	if( ( number != _global_doEval_points.size() ) || (( ( _global_range_minima != minima ) || ( _global_range_maxima != maxima ) ) || !pointsGood ) )
	{
		clearGSLIntegrationPoints();
		_global_doEval_points = initGSLDataPoints( number, maxima, minima, templateDataPoint, doIntegrate );
		_global_range_minima = minima;
		_global_range_maxima = maxima;
		_global_observable_names = doIntegrate;
	}

	vector<string> allObs = _global_doEval_points[0]->GetAllNames();
	for( unsigned int i=0; i< _global_doEval_points.size(); ++i )
	{
		DataPoint* thisPoint = _global_doEval_points[i];
		for( unsigned int j=0; j< allObs.size(); ++j )
		{
			Observable* thisObs = thisPoint->GetObservable( j );
			thisObs->SetBinNumber( -1 );
			thisObs->SetBkgBinNumber( -1 );
		}
		thisPoint->ClearPerEventData();
	}

	pthread_mutex_unlock( &GSL_DATAPOINT_GET_THREADLOCK );
	return _global_doEval_points;
}
开发者ID:abmorris,项目名称:RapidFit,代码行数:49,代码来源:RapidFitIntegrator.cpp

示例9: SetArrivalPoints

/*
函数:设置数据点的领域点列表
说明:设置数据点的领域点列表
参数:
返回值: true;    */
void ClusterAnalysis::SetArrivalPoints(DataPoint& dp)
{
    for(unsigned long i=0; i<dataNum; i++)                //对每个数据点执行
    {
        double distance =GetDistance(dadaSets[i], dp);    //获取与特定点之间的距离
        if(distance <= radius && i!=dp.GetDpId())        //若距离小于半径,并且特定点的id与dp的id不同执行
            dp.GetArrivalPoints().push_back(i);            //将特定点id压力dp的领域列表中
    }
    if(dp.GetArrivalPoints().size() >= minPTs)            //若dp领域内数据点数据量> minPTs执行
    {
        dp.SetKey(true);    //将dp核心对象标志位设为true
        return;                //返回
    }
    dp.SetKey(false);    //若非核心对象,则将dp核心对象标志位设为false
}
开发者ID:HelenJane,项目名称:Extract_Line,代码行数:20,代码来源:ClusterAnalysis.cpp

示例10: optics

    /** Performs the classic OPTICS algorithm.
     * @param db All data points that are to be considered by the algorithm. Changes their values.
     * @param eps The epsilon representing the radius of the epsilon-neighborhood.
     * @param min_pts The minimum number of points to be found within an epsilon-neigborhood.
     * @return Return the OPTICS ordered list of Data points with reachability-distances set.
     */
    DataVector optics( DataVector& db, const real eps, const unsigned int min_pts) {
        assert( eps >= 0 && "eps must not be negative");
        assert( min_pts > 0 && "min_pts must be greater than 0");
        DataVector ret;

        for( auto p_it = db.begin(); p_it != db.end(); ++p_it) {
            DataPoint* p = *p_it;
            
            if( p->is_processed())
                continue;
            
            expand_cluster_order( db, p, eps, min_pts, ret);
        }
        return ret;
    }
开发者ID:langenhagen,项目名称:Master-Thesis,代码行数:21,代码来源:optics.hpp

示例11:

Blackboard::Blackboard() {
    // default contructors init everything needed to empty

	//create the internal knowledge items
	kiSet[BB_SETTINGS];
	kiSet[BB_ALL_TAGS];

	//populate the tags knowlege item
	DataPoint dp;
	dp.wrap(BB_SETTINGS);
	kiSet[BB_ALL_TAGS].update(dp);
	dp.wrap(BB_ALL_TAGS);
	kiSet[BB_ALL_TAGS].update(dp);
	
}
开发者ID:SamThomas,项目名称:SpaceConcordia,代码行数:15,代码来源:Blackboard.cpp

示例12: recordGridPoint

void DataTable::recordGridPoint(const DataPoint &sample)
{
    for (unsigned int i = 0; i < getNumVariables(); i++)
    {
        grid.at(i).insert(sample.getX().at(i));
    }
}
开发者ID:bgrimstad,项目名称:splinter,代码行数:7,代码来源:datatable.cpp

示例13: sampleExpect

//
//随机选取第k个输入样本及对应的期望输出
//
void AnnNetwork::sampleExpect(std::vector<DataPoint*> inputs,int k)
{
	double _mExpect;
	DataPoint* dpPoint = inputs[k];
	if (inputs[k] != NULL)
	{
		double _mSum = 0;		
		for (int i = 0; i < dpPoint->size(); i++)
			_mSum += dpPoint->GetDimension()[i];
		_mExpect = (double)_mSum / dpPoint->size();
	}

	delete dpPoint;

	this->expect_[inputs[k]] = _mExpect;
}
开发者ID:campper,项目名称:CMS.Experiments.Console,代码行数:19,代码来源:AnnNetwork.cpp

示例14: hdf4object

/**
 * Reads and normalizes CALIPSO Level 1 data from the HDFs.
 * 
 * @warning Care should be taken to ensure that this is run only on CALIPSO 
 * Level 1 data as the pointer arithmetic and memcpy() usage could present 
 * the risk of segmentation fault on other data sources.
 */
bool CalipsoL1DataSource::read() {
	hdf4object* data = new hdf4object(new string(filename().toAscii().data()));

	
	string* tab = new string("Total_Attenuated_Backscatter_532");
	float** tab_array = data->setToArray<float>(new string("Total_Attenuated_Backscatter_532")     );
	string* lon = new string("Longitude");
	float** tmplons = data->setToArray<float>(lon);
	float* lons = tmplons[0];
	string* lat = new string("Latitude");
	float** tmplats = data->setToArray<float>(lat);
	float* lats = tmplats[0];
	int* dims = data->getSetDimensions(tab);
	delete tab;
	delete lon;
	delete lat;
	
	//fucking data is upside down
	for(int i = 0; i < dims[0]; i++) {
		float* dp_ary = new float[dataProperties().height];
		float* column = tab_array[i];
		column += 80;
		//crop array bounds to [298] - [698]
		for(int j = 0; j < 200; j++)  {
			dp_ary[(2*j)+1] = dp_ary[2*j] = column[j];
		}
		
		float* dp_ary2 = dp_ary + 400;
		column += 200;
		//crop array bounds to [8] - [298]
		memcpy(dp_ary2, column, 290*sizeof(float));
			
		
		DataPoint* dp = new DataPoint;
		dp->setLon(lons[i]); dp->setLat(lats[i]);
		dp->setData(dp_ary);
		data_ary << dp;
	}
	data->freeArray<float>(tab_array);
	data->freeArray<float>(tmplons);
	data->freeArray<float>(tmplats);

	return true;
}
开发者ID:schleyfox,项目名称:lidarconverter,代码行数:51,代码来源:calipsol1datasource.cpp

示例15: memcpy

void MosqConnect::on_message(const struct mosquitto_message *message)
{
    /*
       struct mosquitto_message{
       int mid;
       char *topic;
       void *payload;
       int payloadlen;
       int qos;
       bool retain;
       };
       */

    //Move from "void* with payloadlen" to a QString.
    char* messData = (char*)malloc(sizeof(char)*(message->payloadlen+1));
    memcpy(messData, message->payload, message->payloadlen);
    messData[message->payloadlen] = '\0';

    //printf("Message %s - %s.\n", message->topic, messData);

    QString mess = QString(messData);
    free(messData);

    QString topic = QString(message->topic);

    //qDebug() << "\nNew message:" << (QDateTime::currentDateTime()).toString("hh:mm:ss") << topic << mess;

    /// @todo create topic2url function

    for(int i=0; i<list->size(); i++)
    {
        DataPoint dp = list->at(i);
        if(topic == dp.getMosqTopic())
        {
            qDebug() << "Mess from" << dp.getName() << mess << topic;
            if(!Mosq2QuickSurf::send(&dp, mess))
            {
                qDebug() << "Error, FAILED to send mess to webserver:" 
                    << dp.getName() << mess << topic;

            }
        }
    }
}
开发者ID:flybird119,项目名称:FunTechHouse_MQTT2WebServer_Sensor,代码行数:44,代码来源:MosqConnect.cpp


注:本文中的DataPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。