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


C++ Options::PrintXY方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........

  // do a topo check
  rc = SUB->TopologyCheck();

  if (rc < 0 ) {
    SUB->TopoPrintErrMsg(stdout, "== tchk ==", NODE_NAMES->Store() );
    goto out;
  }

  // quit if docheck == 1
  if ( OPT.CheckOnly() == 1 || docheck==1 ) {
    printf("The connectivity of the given netlist appears to be correct\n");
    goto out;
  }

  // make solver
  SUB->MakeSolver( SUB->GetNumNodes() );

  //  SUB->InitSolutions();
  FS = fopen( statefname, "r");
  rc = ERROR; 

  if ( FS ) { 
    const int perf_check=0;  // force to ignore the check. Could be dangerous!
    rc = SUB->LoadSteadyStateFromFile(FS, perf_check);
    SUB->CopyXpToXtm1();
    SUB->CopyXpToX();

    if ( rc == OK ) printf("[II]: Loaded states from \"%s\"\n", statefname );
    fclose(FS);
  } 

  // steady solve, two phases
  if ( rc!=OK) { // either no state file, or state file is not good
    rc = SUB->SteadySolve(600, 600, 2*OPT.Tol());
    if (rc<0) {
      fprintf(stdout,"[EE]: first phase of steady-state solve failed\n");
      goto out;
    }

    rc = SUB->SteadySolve(25.0, 45, 45, OPT.Tol() );
    if (rc<0) {
      fprintf(stdout,"[EE]: second phase of steady-state solve failed\n");
      goto out;
    }
  }

  // store back if needed
  if ( rc > 0 && STAT.SSFile() ) {
    FS=fopen(STAT.SSFile(),"w");
    SUB->SaveSteadyStateToFile(FS);
    fclose(FS);
    fprintf(stdout, "[II]: Saved steady state to file \"%s\"\n", STAT.SSFile());
  }

  // run unsteady
  print_flag = 0;
  if (OPT.PrintQ()==1) print_flag |= PRT_Q;
  if (OPT.PrintA()==1) print_flag |= PRT_A;
  if (OPT.PrintZ()==1) print_flag |= PRT_Z;
  if (OPT.PrintD()==1) print_flag |= PRT_D;
  sprintf(outname,"%s.output.dat", fname);
  if ( print_flag ) {
    FS = fopen(outname,"w");
    if ( FS == NULL ) {
      fprintf(stdout,"[II]: Unable to open output file %s. Request ignored\n", outname);
    } else {
      fprintf(stdout,"[II]: Unsteady results will be stored in \"%s\"\n", outname);
    }
    if (OPT.PrintXY()==1) print_flag |= PRT_XY;   // XY printing is only turned on when
						  // others are enabled
  } else {
    fprintf(stdout,"[II]: No printing request made. Nothing will be stored\n");
    FS = NULL;
  }

  TM.start();
  rc = SUB->UnsteadySolve(OPT.StopTime(), 1, 25, OPT.Tol(), NULL, FS, print_flag, OPT.PrintStart(), NODE_NAMES->Store() ); 
  TM.stop();
  if ( FS ) fclose(FS);

  fprintf(stdout, "[II]: Simulation of the %d-min event took %.3f seconds.\n", (int)(OPT.StopTime()/60.0), TM.read() );

  // store the states
  FS=fopen(statefname, "w");
  if (!FS) {
    printf("Bummer: unable to open file \"%s\" to write state. Check permissions!\n", statefname);
  } else {
    SUB->SaveSteadyStateToFile(FS);
    fprintf(stdout,"[II]: Saved final states to file \"%s\"\n", statefname);
  }
  if (FS) fclose(FS);

 out:
  if (F) fclose(F);
  if ( SUB ) delete SUB;
  if ( NODE_NAMES) delete NODE_NAMES;

  return 0;
}
开发者ID:Kevin-M-Smith,项目名称:SPRNT,代码行数:101,代码来源:spt_rolling.cpp


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