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


C++ DataPoint::Print方法代码示例

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


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

示例1: DoNumericalIntegral

//Actually perform the numerical integration
double RapidFitIntegrator::DoNumericalIntegral( const DataPoint * NewDataPoint, PhaseSpaceBoundary * NewBoundary, const vector<string> DontIntegrateThese, ComponentRef* componentIndex, const bool IntegrateDataPoint )
{
	//Make lists of observables to integrate and not to integrate
	vector<string> doIntegrate, dontIntegrate;
	StatisticsFunctions::DoDontIntegrateLists( functionToWrap, NewBoundary, &DontIntegrateThese, doIntegrate, dontIntegrate );

	dontIntegrate = StringProcessing::CombineUniques( dontIntegrate, DontIntegrateThese );
	dontIntegrate = this->DontNumericallyIntegrateList( NewDataPoint, dontIntegrate );

	vector<string> CANNOT_INTEGRATE_LIST = NewBoundary->GetDiscreteNames();
	dontIntegrate = StringProcessing::CombineUniques( dontIntegrate, CANNOT_INTEGRATE_LIST );

	vector<string> safeDoIntegrate;
	for( unsigned int i=0; i< doIntegrate.size(); ++i )
	{
		if( StringProcessing::VectorContains( &dontIntegrate, &(doIntegrate[i]) ) == -1 )
		{
			safeDoIntegrate.push_back( doIntegrate[i] );
		}
	}
	doIntegrate = safeDoIntegrate;

	vector<DataPoint*> DiscreteIntegrals;

	vector<string> required = functionToWrap->GetPrototypeDataPoint();
	bool isFixed=true;
	for( unsigned int i=0; i< required.size(); ++i )
	{
		isFixed = isFixed && NewBoundary->GetConstraint( required[i] )->IsDiscrete();
	}
	if( isFixed )
	{
		if( NewDataPoint != NULL )
		{
			DataPoint* thisDataPoint = new DataPoint( *NewDataPoint );
			thisDataPoint->SetPhaseSpaceBoundary( NewBoundary );
			ratioOfIntegrals = 1.;
			double returnVal=0.;
			try{
				returnVal = functionToWrap->Evaluate( thisDataPoint );
				thisDataPoint->Print();
			}
			catch(...)
			{
				cerr << "Function fails to Evaluate!" << endl;
			}
			delete thisDataPoint;
			return returnVal;
		}
		else
		{
			vector<DataPoint*> theseCombs = NewBoundary->GetDiscreteCombinations();
			for( unsigned int i=0; i< theseCombs.size(); ++i ) DiscreteIntegrals.push_back( new DataPoint( *(theseCombs[i]) ) );
			ratioOfIntegrals = 1.;
			double returnVal=0.;
			for( unsigned int i=0; i< DiscreteIntegrals.size(); ++i )
			{
				try{
					returnVal+=functionToWrap->Evaluate( DiscreteIntegrals[i] );
				}
				catch(...)
				{
					cerr << "Function fails to Evaluate!" << endl;
					DiscreteIntegrals[i]->Print();
				}
			}
			while( !DiscreteIntegrals.empty() )
			{
				if( DiscreteIntegrals.back() != NULL ) delete DiscreteIntegrals.back();
				DiscreteIntegrals.pop_back();
			}
			return returnVal;
		}
	}

	if( IntegrateDataPoint )
	{
		DiscreteIntegrals.push_back( new DataPoint(*NewDataPoint) );
		DiscreteIntegrals.back()->SetPhaseSpaceBoundary( NewBoundary );
	}
	else
	{
		vector<DataPoint*> theseCombs = NewBoundary->GetDiscreteCombinations();
		for( unsigned int i=0; i< theseCombs.size(); ++i ) DiscreteIntegrals.push_back( new DataPoint( *(theseCombs[i]) ) );
	}

	double output_val = 0.;

	//If there are no observables left to integrate over, just evaluate the function
	if( doIntegrate.empty() || doIntegrate.size() == 0 )
	{
		for( vector<DataPoint*>::iterator dataPoint_i = DiscreteIntegrals.begin(); dataPoint_i != DiscreteIntegrals.end(); ++dataPoint_i )
		{
			try{
				output_val += functionToWrap->Integral( *dataPoint_i, NewBoundary );
			}
			catch(...)
			{
				cerr << "Analytical Integral Fell over!" << endl;
//.........这里部分代码省略.........
开发者ID:abmorris,项目名称:RapidFit,代码行数:101,代码来源:RapidFitIntegrator.cpp


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