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


C++ PView::getIndex方法代码示例

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


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

示例1: if

PView *GMSH_MathEvalPlugin::execute(PView *view)
{
  int timeStep = (int)MathEvalOptions_Number[0].def;
  int iView = (int)MathEvalOptions_Number[1].def;
  int otherTimeStep = (int)MathEvalOptions_Number[2].def;
  int iOtherView = (int)MathEvalOptions_Number[3].def;
  int forceInterpolation = (int)MathEvalOptions_Number[4].def;
  int physicalRegion = (int)MathEvalOptions_Number[5].def;
  std::vector<std::string> expr(9);
  for(int i = 0; i < 9; i++) expr[i] = MathEvalOptions_String[i].def;

  PView *v1 = getView(iView, view);
  if(!v1) return view;
  PViewData *data1 = getPossiblyAdaptiveData(v1);

  if(data1->hasMultipleMeshes()){
    Msg::Error("MathEval plugin cannot be applied to multi-mesh views");
    return view;
  }

  PView *otherView = v1;
  if(iOtherView >= 0){
    otherView = getView(iOtherView, view);
    if(!otherView){
      Msg::Error("MathEval plugin could not find other view %i", iOtherView);
      return view;
    }
  }

  PViewData *otherData = getPossiblyAdaptiveData(otherView);
  if(otherData->hasMultipleMeshes()){
    Msg::Error("MathEval plugin cannot be applied to multi-mesh views");
    return view;
  }

  if(otherTimeStep < 0 && otherData->getNumTimeSteps() != data1->getNumTimeSteps()){
    Msg::Error("Number of time steps don't match: using step 0");
    otherTimeStep = 0;
  }
  else if(otherTimeStep > otherData->getNumTimeSteps() - 1){
    Msg::Error("Invalid time step (%d) in View[%d]: using step 0 instead",
               otherTimeStep, otherView->getIndex());
    otherTimeStep = 0;
  }

  int numComp2;
  if(expr[3].size() || expr[4].size() || expr[5].size() ||
     expr[6].size() || expr[7].size() || expr[8].size()){
    numComp2 = 9;
    for(int i = 0; i < 9; i++)
      if(expr[i].empty()) expr[i] = "0";
  }
  else if(expr[1].size() || expr[2].size()){
    numComp2 = 3;
    for(int i = 0; i < 3; i++)
      if(expr[i].empty()) expr[i] = "0";
  }
  else{
    numComp2 = 1;
  }
  expr.resize(numComp2);

  const char *names[] =
    { "x", "y", "z", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8",
      "w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8" };
  unsigned int numVariables = sizeof(names) / sizeof(names[0]);
  std::vector<std::string> variables(numVariables);
  for(unsigned int i = 0; i < numVariables; i++) variables[i] = names[i];
  mathEvaluator f(expr, variables);
  if(expr.empty()) return view;
  std::vector<double> values(numVariables), res(numComp2);

  OctreePost *octree = 0;
  if(forceInterpolation ||
     (data1->getNumEntities() != otherData->getNumEntities()) ||
     (data1->getNumElements() != otherData->getNumElements())){
    Msg::Info("Other view based on different grid: interpolating...");
    octree = new OctreePost(otherView);
  }

  PView *v2 = new PView();
  PViewDataList *data2 = getDataList(v2);

  if(timeStep < 0){
    timeStep = - data1->getNumTimeSteps();
  }
  else if(timeStep > data1->getNumTimeSteps() - 1){
    Msg::Error("Invalid time step (%d) in View[%d]: using all steps instead",
               timeStep, v1->getIndex());
    timeStep = - data1->getNumTimeSteps();
  }

  int firstNonEmptyStep =  data1->getFirstNonEmptyTimeStep();
  int timeBeg = (timeStep < 0) ? firstNonEmptyStep : timeStep;
  int timeEnd = (timeStep < 0) ? -timeStep : timeStep + 1;
  for(int ent = 0; ent < data1->getNumEntities(timeBeg); ent++){
    bool ok = (physicalRegion <= 0);
    if(physicalRegion > 0){
      GEntity *ge = data1->getEntity(timeBeg, ent);
      if(ge){
//.........这里部分代码省略.........
开发者ID:kevinr2763,项目名称:gmsh,代码行数:101,代码来源:MathEval.cpp


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