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


C++ dMatrix::SetElement方法代码示例

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


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

示例1: ReadPoints


//.........这里部分代码省略.........
        break;
      default:
        if(strlen(strtrim(line)) > 0)
        {
          // Data line
          countData++;

          // Matrix specifiers
          if(countData==1)
          {
            // column defines constant u-values
            ptrLine = strtok(line, tkn);
            cmax    = str2int(ptrLine);

            // row defines constant v-values
            ptrLine = strtok(NULL, tkn);
            rmax    = str2int(ptrLine);

            // Set matrix dimensions
            pointsX.SetNumberRows(rmax);
            pointsX.SetNumberColumns(cmax);
            pointsY.SetNumberRows(rmax);
            pointsY.SetNumberColumns(cmax);
            pointsZ.SetNumberRows(rmax);
            pointsZ.SetNumberColumns(cmax);
          }

          // Specification of the x-coordinates
          else if(countData>=2 && countData<(2+rmax))
          {
            int row = (countData-1);

            // Set first u-element in current v
            ptrLine = strtok(line, tkn);
            pointsX.SetElement(row, 1, str2double(ptrLine));

            // Set following u-elements in current v
            for(int c=2; c<=cmax; c++)
            {
              ptrLine = strtok(0, tkn);
              pointsX.SetElement(row, c, str2double(ptrLine));
            }
          }

          // Specification of the y-coordinates
          else if(countData>=(2+rmax) && countData<(2+rmax+rmax))
          {
            int row = (countData-1-rmax);

            // Set first u-element in current v
            ptrLine = strtok(line, tkn);
            pointsY.SetElement(row, 1, str2double(ptrLine));

            // Set following u-elements in current v
            for(int c=2; c<=cmax; c++)
            {
              ptrLine = strtok(0, tkn);
              pointsY.SetElement(row, c, str2double(ptrLine));
            }
          }

          // Specification of the z-coordinates
          else if(countData>=(2+rmax+rmax) && countData<(2+rmax+rmax+rmax))
          {
            int row = (countData-1-rmax-rmax);

            // Set first u-element in current v
            ptrLine = strtok(line, tkn);
            pointsZ.SetElement(row, 1, str2double(ptrLine));

            // Set following u-elements in current v
            for(int c=2; c<=cmax; c++)
            {
              ptrLine = strtok(0, tkn);
              pointsZ.SetElement(row, c, str2double(ptrLine));
            }
          }

          // Too much data
          else
          {
            throw clExceptionTree("clGeometryReader", "ReadPoints", "Too much data.");
          }

          if(countData==(1+rmax+rmax+rmax))
          {
            AllRead = 1;
          }
        }

        file.getline(line, LINE_SIZE);
        break;
    }
  }

  if(!EndOfBlock || !AllRead)
  {
    throw clExceptionTree("clGeometryReader", "ReadPoints", "Unexpected end while reading block POINT.");
  }
}
开发者ID:hklaufus,项目名称:GridLab,代码行数:101,代码来源:geometryreader.cpp


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