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


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

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


在下文中一共展示了DataPoint::SetPhaseSpaceBoundary方法的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 );
			double returnVal = functionToWrap->Evaluate( thisDataPoint );
			delete thisDataPoint;
			return returnVal;
		}
		else
		{
			DiscreteIntegrals = NewBoundary->GetDiscreteCombinations();
			double returnVal=0.;
			for( unsigned int i=0; i< DiscreteIntegrals.size(); ++i )
			{
				returnVal+=functionToWrap->Evaluate( DiscreteIntegrals[i] );
			}
			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
	{
		DiscreteIntegrals = NewBoundary->GetDiscreteCombinations();
	}

	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;
				return -9999.;
			}
		}
	}
	else
	{
		for( vector<DataPoint*>::iterator dataPoint_i = DiscreteIntegrals.begin(); dataPoint_i != DiscreteIntegrals.end(); ++dataPoint_i )
		{
			double numericalIntegral = 0.;
			//Chose the one dimensional or multi-dimensional method
			if( doIntegrate.size() == 1 )
			{
				if( debug != NULL )
				{
					if( debug->DebugThisClass( "RapidFitIntegrator" ) )
					{
						cout << "RapidFitIntegrator: One Dimensional Integral" << endl;
					}
				}
//.........这里部分代码省略.........
开发者ID:gcowan,项目名称:mphys-parallel,代码行数:101,代码来源:RapidFitIntegrator.cpp


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