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


C++ TransformationMatrix::MasterToLocalVec方法代码示例

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


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

示例1: main

int main()
{
	Vectors3DSOA points, dirs, intermediatepoints, intermediatedirs;
	StructOfCoord rpoints, rintermediatepoints, rdirs, rintermediatedirs;


	int np=1024;

	points.alloc(np);
	dirs.alloc(np);
	intermediatepoints.alloc(np);
	intermediatedirs.alloc(np);

	rpoints.alloc(np);
	rdirs.alloc(np);
	rintermediatepoints.alloc(np);
	rintermediatedirs.alloc(np);

	double *distances = (double *) _mm_malloc(np*sizeof(double), ALIGNMENT_BOUNDARY);
	double *distances2 = (double *) _mm_malloc(np*sizeof(double), ALIGNMENT_BOUNDARY);
	double *steps = (double *) _mm_malloc(np*sizeof(double), ALIGNMENT_BOUNDARY);
	for(auto i=0;i<np;++i) steps[i]=1E30;

	std::vector<Vector3D> conventionalpoints(np);
	std::vector<Vector3D> conventionaldirs(np);
	Vector3D * conventionalpoints2 = (Vector3D *) new Vector3D[np];
	Vector3D * conventionaldirs2 = (Vector3D *) new Vector3D[np];

	StopWatch timer;

    // generate benchmark cases
    for( int r=0; r< EulerAngles.size(); ++r ) // rotation cases
    		for( int t=0; t<TransCases.size(); ++t ) // translation cases
    		  {
    				TransformationMatrix const * identity = new TransformationMatrix(0,0,0,0,0,0);
    				PhysicalVolume * world = GeoManager::MakePlacedBox( new BoxParameters(100,100,100), identity );

    				TransformationMatrix * tm = new TransformationMatrix(TransCases[t][0], TransCases[t][1], TransCases[t][2],
    						EulerAngles[r][0], EulerAngles[r][1], EulerAngles[r][2]);

    				// these dispatch to specialized matrices
    				TransformationMatrix const * sm = TransformationMatrix::createSpecializedMatrix( TransCases[t][0], TransCases[t][1], TransCases[t][2],
    											EulerAngles[r][0], EulerAngles[r][1], EulerAngles[r][2] );


    				PhysicalVolume * daughter = GeoManager::MakePlacedBox( new BoxParameters(10,15,20), tm );

    				world->AddDaughter(daughter);

    				world->fillWithRandomPoints(points,np);
    				world->fillWithBiasedDirections(points, dirs, np, 1./10);

    				points.toStructureOfVector3D( conventionalpoints );
    				dirs.toStructureOfVector3D( conventionaldirs );
    				points.toStructureOfVector3D( conventionalpoints2 );
    				dirs.toStructureOfVector3D( conventionaldirs2 );


    				// time performance for this placement ( we should probably include some random physical steps )
    				timer.Start();
    				for(int reps=0;reps<1000;reps++)
    				{
    					daughter->DistanceToIn(points,dirs,steps,distances);
    				}
    				timer.Stop();
    				double t0 = timer.getDeltaSecs();

    			// std::cerr << tm->GetTranslationIdType() << " " << tm->getNumberOfZeroEntries() << " " << timer.getDeltaSecs() << std::endl;

    				timer.Start();
    				for(int reps=0;reps<1000;reps++)
    				{
    					daughter->DistanceToInIL(points,dirs,steps,distances);
    				}
    				timer.Stop();
    				double til = timer.getDeltaSecs();

    				timer.Start();
    				for(int reps=0;reps<1000;reps++)
    				{
    					daughter->DistanceToInIL( conventionalpoints2, conventionaldirs2, steps, distances, np );
    				}
    				timer.Stop();
    				double til2 = timer.getDeltaSecs();


    				// compare with case that uses external unspecialized transformation
    				PhysicalVolume * unplaceddaughter = GeoManager::MakePlacedBox(new BoxParameters(10,15,20), identity);
    				timer.Start();
    				for(int reps=0;reps<1000;reps++)
    				{
    					if(! tm->isIdentity() )
    					{
    						tm->MasterToLocal(points, intermediatepoints );
    						tm->MasterToLocalVec( dirs, intermediatedirs );
    						unplaceddaughter->DistanceToIn( intermediatepoints, intermediatedirs, steps, distances2);
    					}
    					else
    					{
    						unplaceddaughter->DistanceToIn( points, dirs, steps, distances2);
//.........这里部分代码省略.........
开发者ID:larryxiao,项目名称:VecGeom,代码行数:101,代码来源:TestVectorizedPlacedBox.cpp


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