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


C++ Compute::initialize方法代码示例

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


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

示例1: switch

void
ComputeMgr::createCompute(ComputeID i, ComputeMap *map)
{
    Compute *c;
    PatchID pid2[2];
    PatchIDList pids;
    int trans2[2];
    SimParameters *simParams = Node::Object()->simParameters;

    PatchID pid8[8];
    int trans8[8];

    switch ( map->type(i) )
    {
    case computeNonbondedSelfType:
#ifdef NAMD_CUDA
        register_cuda_compute_self(i,map->computeData[i].pids[0].pid);
#elif defined(NAMD_MIC)
        #if MIC_SPLIT_WITH_HOST != 0
	  if (map->directToDevice(i) == 0) {
            c = new ComputeNonbondedSelf(i,map->computeData[i].pids[0].pid,
                                         computeNonbondedWorkArrays,
                                         map->partition(i),map->partition(i)+1,
                                         map->numPartitions(i)); // unknown delete
            map->registerCompute(i,c);
            c->initialize();
          } else {
        #endif
            register_mic_compute_self(i,map->computeData[i].pids[0].pid,map->partition(i),map->numPartitions(i));
        #if MIC_SPLIT_WITH_HOST != 0
          }
        #endif
#else
        c = new ComputeNonbondedSelf(i,map->computeData[i].pids[0].pid,
                                     computeNonbondedWorkArrays,
                                     map->partition(i),map->partition(i)+1,
                                     map->numPartitions(i)); // unknown delete
        map->registerCompute(i,c);
        c->initialize();
#endif
        break;
    case computeLCPOType:
        for (int j = 0; j < 8; j++) {
          pid8[j] = map->computeData[i].pids[j].pid;
          trans8[j] = map->computeData[i].pids[j].trans;
        }
        c = new ComputeLCPO(i,pid8,trans8,
             computeNonbondedWorkArrays,
             map->partition(i),map->partition(i)+1,
             map->numPartitions(i), 8);
        map->registerCompute(i,c);
        c->initialize();
      
        break;
    case computeNonbondedPairType:
        pid2[0] = map->computeData[i].pids[0].pid;
        trans2[0] = map->computeData[i].pids[0].trans;
        pid2[1] = map->computeData[i].pids[1].pid;
        trans2[1] = map->computeData[i].pids[1].trans;
#ifdef NAMD_CUDA
        register_cuda_compute_pair(i,pid2,trans2);
#elif defined(NAMD_MIC)
        #if MIC_SPLIT_WITH_HOST != 0
	  if (map->directToDevice(i) == 0) {
            c = new ComputeNonbondedPair(i,pid2,trans2,
                                         computeNonbondedWorkArrays,
                                         map->partition(i),map->partition(i)+1,
                                         map->numPartitions(i)); // unknown delete
            map->registerCompute(i,c);
            c->initialize();
          } else {
        #endif
            register_mic_compute_pair(i,pid2,trans2,map->partition(i),map->numPartitions(i));
        #if MIC_SPLIT_WITH_HOST != 0
          }
        #endif
#else
        c = new ComputeNonbondedPair(i,pid2,trans2,
                                     computeNonbondedWorkArrays,
                                     map->partition(i),map->partition(i)+1,
                                     map->numPartitions(i)); // unknown delete
        map->registerCompute(i,c);
        c->initialize();
#endif
        break;
#ifdef NAMD_CUDA
    case computeNonbondedCUDAType:
	c = computeNonbondedCUDAObject = new ComputeNonbondedCUDA(i,this); // unknown delete
	map->registerCompute(i,c);
	c->initialize();
	break;
#endif
#ifdef NAMD_MIC
    case computeNonbondedMICType:
	c = computeNonbondedMICObject = new ComputeNonbondedMIC(i,this); // unknown delete
	map->registerCompute(i,c);
	c->initialize();
	break;
#endif
    case computeExclsType:
//.........这里部分代码省略.........
开发者ID:luyukunphy,项目名称:namd,代码行数:101,代码来源:ComputeMgr.C


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