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


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

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


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

示例1: column_length

int FixAveTime::column_length(int dynamic)
{
  int m,length,lengthone;

  // determine nrows for static values

  if (!dynamic) {
    length = 0;
    for (int i = 0; i < nvalues; i++) {
      if (varlen[i]) continue;
      if (which[i] == COMPUTE) {
        int icompute = modify->find_compute(ids[i]);
        if (argindex[i] == 0)
          lengthone = modify->compute[icompute]->size_vector;
        else lengthone = modify->compute[icompute]->size_array_rows;
      } else if (which[i] == FIX) {
        int ifix = modify->find_fix(ids[i]);
        if (argindex[i] == 0) lengthone = modify->fix[ifix]->size_vector;
        else lengthone = modify->fix[ifix]->size_array_rows;
      } else if (which[i] == VARIABLE) {
        // variables are always varlen = 1, so dynamic
      } 
      if (length == 0) length = lengthone;
      else if (lengthone != length)
        error->all(FLERR,"Fix ave/time columns are inconsistent lengths");
    }
  }

  // determine new nrows for dynamic values
  // either all must be the same
  // or must match other static values
  // don't need to check if not MODE = VECTOR, just invoke lock_length()

  if (dynamic) {
    length = 0;
    for (int i = 0; i < nvalues; i++) {
      if (varlen[i] == 0) continue;
      m = value2index[i];
      if (which[i] == COMPUTE) {
        Compute *compute = modify->compute[m];
        lengthone = compute->lock_length();
      } else if (which[i] == VARIABLE) {
        double *varvec;
        lengthone = input->variable->compute_vector(m,&varvec);
      }
      if (mode == SCALAR) continue;
      if (all_variable_length) {
        if (length == 0) length = lengthone;
        else if (lengthone != length)
          error->all(FLERR,"Fix ave/time columns are inconsistent lengths");
      } else {
        if (lengthone != nrows)
          error->all(FLERR,"Fix ave/time columns are inconsistent lengths");
      }
    }
  }

  return length;
}
开发者ID:akohlmey,项目名称:lammps,代码行数:59,代码来源:fix_ave_time.cpp


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