Пример #1
0
// #################################################################
//f パラメータをロード
bool IP_PMT::getTP(Control* R, TextParser* tpCntl)
{
  std::string str;
  std::string label;

  
  // 媒質指定
  label="/IntrinsicExample/FluidMedium";
  
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_fluid = str;
  
  label="/IntrinsicExample/SolidMedium";
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_solid = str;
  
  return true;
}
Пример #2
0
// #################################################################
// ファイルフォーマットのオプションを指定する
void IO_BASE::getFormatOption(const string form)
{
  string str;
  string label;
  string dir;
  int ct;
  
  
  // ディレクトリのチェック
  dir = "/Output/FormatOption/" + form;
  
  if ( !(tpCntl->chkNode(dir)) )
  {
    Hostonly_ stamped_printf("\tParsing error : Missing '%s'\n", dir.c_str());
    Exit(0);
  }
  
  
  // 出力ガイドセルモード
  label = dir + "/GuideOut";
  
  if ( !(tpCntl->getInspectedValue(label, ct)) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    Exit(0);
    Exit(0);
  }
  if ( ct < 0 || ct > guide )
  {
    Hostonly_ stamped_printf("\tInvalid range of guide out /Output/FormatOption/*/GuideOut : 0 <= guideout <= %d\n", guide);
    Exit(0);
  }
  C->GuideOut = GuideOut = ct;
  
}
Пример #3
0
// #################################################################
// 例題名称の表示
void Intrinsic::printExample(FILE* fp, const int m_id)
{
  if ( !fp )
  {
    stamped_printf("\tFail to write into file\n");
    Exit(0);
  }
  
  string str;
  
  if      ( m_id == id_Polygon ) str = "Polygon";
  else if ( m_id == id_Duct )    str = "Duct";
  else if ( m_id == id_PMT )     str = "Performance Test";
  else if ( m_id == id_Rect )    str = "Rectangular";
  else if ( m_id == id_Cylinder) str = "Cylinder";
  else if ( m_id == id_Step )    str = "Back Step";
  else if ( m_id == id_PPLT2D)   str = "Parallel Plate 2D";
  else if ( m_id == id_Sphere )  str = "Sphere";
  else if ( m_id == id_Jet )     str = "Jet";
  else
  {
    stamped_printf("\tInvalid keyword is described for Exmple definition\n");
    Exit(0);
  }
  
  fprintf(fp,"\n\tChallenge : %s\n\n", str.c_str()); fflush(fp);
  printf    ("\n\tChallenge : %s\n\n", str.c_str());
  
}
Пример #4
0
// #################################################################
// ステージングオプション
void IO_BASE::getStagingOption()
{
  string str;
  string label;
  
  
  // Staging option
  label="/StartCondition/Restart/Staging";
  
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    ;
  }
  else
  {
    if     ( !strcasecmp(str.c_str(), "on") )  C->Restart_staging = ON;
    else if( !strcasecmp(str.c_str(), "off") ) C->Restart_staging = OFF;
    else
    {
      Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
      Exit(0);
    }
  }
  
}
Пример #5
0
// #################################################################
// polylibファイルをテンポラリに出力
bool IO_BASE::writePolylibFile(CompoList* cmp)
{
  FILE* fp;
  
  if ( !(fp=fopen("polylib.tp", "w")) )
  {
    stamped_printf("\tSorry, can't open 'polylib.tp' file. Write failed.\n");
    return false;
  }
  
  fprintf(fp,"Polylib {\n");
  
  for (int k=1; k<=C->NoBC; k++)
  {
    int m = C->NoMedium + k;
    
    if (cmp[m].kind_inout==CompoList::kind_inner  &&  cmp[m].getType() != SOLIDREV)
    {
      const string str = cmp[m].getBCstr2Polylib();
      writePolylibGrp(fp, cmp[m].alias, cmp[m].filepath, cmp[m].medium, str);
    }
  }
  
  fprintf(fp,"}\n");
  fclose(fp);
  
  return true;
}
Пример #6
0
// #################################################################
// 例題クラス固有のパラメータの表示
void Intrinsic::printPara(FILE* fp, const Control* R)
{
  if ( !fp ) {
    stamped_printf("\tFail to write into file\n");
    Exit(0);
  }
  // describe method
}
Пример #7
0
// #################################################################
// 初期値
// @todo セルフェイスの粗格子リスタート  >> 近似なのでサボる?
// @ see getTimeControl()
void IO_BASE::getStartCondition()
{
  string str;
  string label, leaf;
  
  
  // 初期条件 温度はParseBC::getInitTempOfMedium()
  if ( C->Start == initial_start )
  {
    /* Density
     label="/StartCondition/InitialState/MassDensity";
     
     if ( !(tpCntl->getInspectedValue(label, iv.Density )) )
     {
     Hostonly_ stamped_printf("\tParsing error : Invalid float value for '%s'\n", label.c_str());
     Exit(0);
     }
     */
    
    // Pressure
    label="/StartCondition/InitialState/Pressure";
    
    if ( !(tpCntl->getInspectedValue(label, C->iv.Pressure )) )
    {
      Hostonly_ stamped_printf("\tParsing error : Invalid float value for '%s'\n", label.c_str());
      Exit(0);
    }
    
    // Velocity
    REAL_TYPE v[3];
    for (int n=0; n<3; n++) v[n]=0.0;
    label="/StartCondition/InitialState/Velocity";
    
    if( !(tpCntl->getInspectedVector(label, v, 3)) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get velocity in '%s'\n", label.c_str());
      Exit(0);
    }
    C->iv.VecU = v[0];
    C->iv.VecV = v[1];
    C->iv.VecW = v[2];
  }
  
}
Пример #8
0
// #################################################################
// AVSファイル入出力に関するパラメータ
void COMB::get_AVSoptions(TextParser* tpCntl)
{
    string str;
    string label;

    //FormatType
    label = "/AVSoptions/FormatType";
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
        output_format_type = OUTPUT_FORMAT_TYPE_BINARY;
    }
    else
    {
        if     ( !strcasecmp(str.c_str(), "binary") ) output_format_type = OUTPUT_FORMAT_TYPE_BINARY;
        else if( !strcasecmp(str.c_str(), "ascii") )  output_format_type = OUTPUT_FORMAT_TYPE_ASCII;
        else
        {
            Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
            Exit(0);
        }
    }

    //DivideFunc
    label = "/AVSoptions/DivideFunc";
    if(  !(tpCntl->getInspectedValue(label, str )) )
    {
        output_divfunc = OUTPUT_DIV_FUNC_OFF;
    }
    else
    {
        if     ( !strcasecmp(str.c_str(), "on") )  output_divfunc = OUTPUT_DIV_FUNC_ON;
        else if( !strcasecmp(str.c_str(), "uff") ) output_divfunc = OUTPUT_DIV_FUNC_OFF;
        else
        {
            Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
            Exit(0);
        }
    }

}
Пример #9
0
// #################################################################
// パラメータの表示
void IP_Step::printPara(FILE* fp, const Control* R)
{
  if ( !fp )
  {
    stamped_printf("\tFail to write into file\n");
    Exit(0);
  }
  
  fprintf(fp,"\n----------\n\n");
  fprintf(fp,"\n\t>> Intrinsic Backstep Class Parameters\n\n");
  
  fprintf(fp,"\tDimension Mode                     :  %s\n", (mode==dim_2d)?"2 Dimensional":"3 Dimensional");
  fprintf(fp,"\tStep Width (x-dir.)    [m] / [-]   : %12.5e / %12.5e\n", width, width/RefL);
  fprintf(fp,"\tStep Height(z-dir.)    [m] / [-]   : %12.5e / %12.5e\n", height, height/RefL);
  
}
Пример #10
0
// #################################################################
//  パラメータの表示
void IP_Duct::printPara(FILE* fp, const Control* R)
{
  if ( !fp ) {
    stamped_printf("\tFail to write into file\n");
    Exit(0);
  }
  
  std::string dir;
  switch (driver.direction) {
    case X_minus:
    case X_plus:
      dir = "X dir.";
      break;
      
    case Y_minus:
    case Y_plus:
      dir = "Y dir.";
      break;
      
    case Z_minus:
    case Z_plus:
      dir = "Z dir.";
      break;
  }
  
  fprintf(fp,"\n---------------------------------------------------------------------------\n\n");
  fprintf(fp,"\n\t>> Intrinsic Duct Class Parameters\n\n");
  
  fprintf(fp,"\tShape of cross-section                :  %s\n", (driver.shape==id_circular)?"Circular":"Rectangular");
  fprintf(fp,"\tDiameter                  [m] / [-]   : %12.5e / %12.5e\n", driver.diameter, driver.diameter/RefL);
  fprintf(fp,"\tDirection of periodic BC              :  %s\n", dir.c_str());
  if ( driver.length > 0.0 ) {
    fprintf(fp,"\twith Driver                           :  %s\n", FBUtility::getDirection(driver.direction).c_str());
    fprintf(fp,"\t     Driver Length        [m] / [-]   : %12.5e / %12.5e\n", driver.length, driver.length/RefL);
  }
  
}
Пример #11
0
// #################################################################
// BCflagをbvxで出力する
int IO_BASE::writeBCflag(const int out_gc)
{
  if (IO_BCflag != ON) return 0;
  
  unsigned bitWidth = 5;
  int rank = paraMngr->GetMyRankID(procGrp);
  
  int ix = size[0];
  int jx = size[1];
  int kx = size[2];
  int gc = out_gc;
  int gd = guide;
  
  size_t nx = (ix+2*gc) * (jx+2*gc) * (kx+2*gc);
  
  // unsignd int
  unsigned* buf = new unsigned[nx];
  
  // start index Active, State bitはマスクする >> 30bitのみ
  unsigned val = (unsigned)(d_cdf[ _F_IDX_S3D(1-gc, 1-gc, 1-gc, ix, jx, kx, gd) ] & 0x3fffffff);
  int c=0;
  
#pragma omp parallel for firstprivate(ix, jx, kx, gc, gd, val) schedule(static) reduction(+:c)
  for (int k=1-gc; k<=kx+gc; k++) {
    for (int j=1-gc; j<=jx+gc; j++) {
      for (int i=1-gc; i<=ix+gc; i++) {
        size_t m0 = _F_IDX_S3D(i, j, k, ix, jx, kx, gd);
        size_t m1 = _F_IDX_S3D(i, j, k, ix, jx, kx, gc);
        unsigned tmp = (unsigned)(d_cdf[m0] & 0x3fffffff);
        buf[m1] = tmp;
        if ( tmp == val ) c++;
      }
    }
  }
  
  bool ret = false;
  int ret_val=0;
  
  // サブドメイン内が同じ値の時(c==nx)には、BCflag配列を書き出さない
  if ( c != nx )
  {
    ret = BVX_IO::Save_Block_BCflag(size, gc, bitWidth, rank, OutDirPath, buf, BVXcomp);
    if ( !ret )
    {
      stamped_printf("\tError : when saving BCflag\n");
      Exit(0);
    }
    ret_val = -1;
  }
  else
  {
    ret_val = (int)val;
  }
  
  
  if (buf)
  {
    delete [] buf;
    buf = NULL;
  }
  
  return ret_val;
}
Пример #12
0
// #################################################################
// ファイル入出力に関するパラメータを取得し,出力の並列モードを指定, PLOT3Dバッファサイズ
// @pre Control::getTimeControl()
void IO_BASE::getFIOparams()
{
  
  REAL_TYPE f_val=0.0;
  string str;
  string label, leaf;
  
  
  // Default setting
  IOmode = IO_DISTRIBUTE;
  
  // 逐次実行の場合には、強制的に IO_GATHER
  if ( (C->Parallelism == Control::Serial) || (C->Parallelism == Control::OpenMP) )
  {
    IOmode = IO_GATHER;
  }
  
  
  // Output Directory_Path
  label = "/Output/Data/DirectoryPath";
  
  if ( !(tpCntl->getInspectedValue(label, str)) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    Exit(0);
  }
  // 指定が無ければ,空のまま
  if ( !str.empty() )
  {
    OutDirPath = str;
  }
  
  // TimeSlice option
  label = "/Output/Data/TimeSlice";
  
  if ( !(tpCntl->getInspectedValue(label, str)) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    Exit(0);
  }
  
  if ( !strcasecmp(str.c_str(), "on") )
  {
    Slice = ON;
  }
  else
  {
    Slice = OFF;
  }
  
  // 1プロセスの場合にはランク番号がないので、タイムスライス毎のディレクトリは作らない
  if ( (C->Parallelism == Control::Serial) || (C->Parallelism == Control::OpenMP) )
  {
    Slice = OFF;
  }
  
  
  
  // 基本変数の瞬時値データ
  
  // インターバル
  label = "/Output/Data/BasicVariables/TemporalType";
  
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    Exit(0);
  }
  else
  {
    if     ( !strcasecmp(str.c_str(), "step") )
    {
      C->Interval[Control::tg_basic].setMode(IntervalManager::By_step);
      C->Interval[Control::tg_derived].setMode(IntervalManager::By_step);
    }
    else if( !strcasecmp(str.c_str(), "time") )
    {
      C->Interval[Control::tg_basic].setMode(IntervalManager::By_time);
      C->Interval[Control::tg_derived].setMode(IntervalManager::By_time);
    }
    else
    {
      Hostonly_ stamped_printf("\tParsing error : Invalid keyword for '%s'\n", label.c_str());
      Exit(0);
    }
    
    label="/Output/Data/BasicVariables/Interval";
    
    if ( !(tpCntl->getInspectedValue(label, f_val )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    else
    {
      C->Interval[Control::tg_basic].setInterval((double)f_val);
      C->Interval[Control::tg_derived].setInterval((double)f_val);
    }
  }
  
  // DryRunBCが指定されているとき,ファイル出力間隔を無限大に設定
  if ( C->Hide.DryRun == ON )
  {
    double ppp = 1.0e6;
    C->Interval[Control::tg_basic].setInterval(ppp);
    C->Interval[Control::tg_derived].setInterval(ppp);
  }
  
  
  switch ( Format )
  {
    case sph_fmt:
      getFormatOption("sph");
      break;
      
    case bov_fmt:
      getFormatOption("bov");
      break;
      
    case plt3d_fun_fmt:
      getFormatOption("plot3d");
      break;
  }
  
  
  // 固有のオプション
  getInherentOption();
  
  
  
  // 全圧
  label="/Output/Data/BasicVariables/TotalPressure";
  if ( tpCntl->chkLabel(label) )
  {
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    
    if     ( !strcasecmp(str.c_str(), "on") )
    {
      C->varState[var_TotalP] = ON;
      C->NvarsIns_plt3d += 1;
    }
    else if( !strcasecmp(str.c_str(), "off") ) C->varState[var_TotalP] = OFF;
    else
    {
      Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
      Exit(0);
    }
  }

  
  // 渦度ベクトル
  label="/Output/Data/BasicVariables/Vorticity";
  if ( tpCntl->chkLabel(label) )
  {
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    
    if     ( !strcasecmp(str.c_str(), "on") )
    {
      C->varState[var_Vorticity] = ON;
      C->NvarsIns_plt3d += 3;
    }
    else if( !strcasecmp(str.c_str(), "off") ) C->varState[var_Vorticity] = OFF;
    else
    {
      Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
      Exit(0);
    }
  }

  
  // 速度勾配テンソルの第2不変量
  label="/Output/Data/BasicVariables/Qcriterion";
  if ( tpCntl->chkLabel(label) )
  {
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    
    if     ( !strcasecmp(str.c_str(), "on") )
    {
      C->varState[var_Qcr] = ON;
      C->NvarsIns_plt3d += 1;
    }
    else if( !strcasecmp(str.c_str(), "off") ) C->varState[var_Qcr] = OFF;
    else
    {
      Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
      Exit(0);
    }
  }

  
  // ヘリシティ
  label="/Output/Data/BasicVariables/Helicity";
  if ( tpCntl->chkLabel(label) )
  {
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    
    if     ( !strcasecmp(str.c_str(), "on") )
    {
      C->varState[var_Helicity] = ON;
      C->NvarsIns_plt3d += 1;
    }
    else if( !strcasecmp(str.c_str(), "off") ) C->varState[var_Helicity] = OFF;
    else
    {
      Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
      Exit(0);
    }
  }

  
  // 発散値
  label="/Output/Data/BasicVariables/Divergence";
  if ( tpCntl->chkLabel(label) )
  {
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    
    if     ( !strcasecmp(str.c_str(), "on") )
    {
      C->varState[var_Div] = ON;
      C->NvarsIns_plt3d += 1;
    }
    else if( !strcasecmp(str.c_str(), "off") ) C->varState[var_Div] = OFF;
    else
    {
      Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
      Exit(0);
    }
  }
  
  

  
  
  // 統計値操作に関するパラメータを取得
  if ( C->Mode.Statistic == ON )
  {
    label = "/Output/Data/StatisticalVariables/TemporalType";
    
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    else
    {
      if     ( !strcasecmp(str.c_str(), "step") )
      {
        if ( C->Interval[Control::tg_statistic].getMode() == IntervalManager::By_time )
        {
          Hostonly_ stamped_printf("\tError : Specified temporal mode is not consistent with '/TimeControl/Statistic/TemporalType'\n");
          Exit(0);
        }
      }
      else if( !strcasecmp(str.c_str(), "time") )
      {
        if ( C->Interval[Control::tg_statistic].getMode() == IntervalManager::By_step )
        {
          Hostonly_ stamped_printf("\tError : Specified temporal mode is not consistent with '/TimeControl/Statistic/TemporalType'\n");
          Exit(0);
        }
      }
      else
      {
        Hostonly_ stamped_printf("\tParsing error : Invalid keyword for '%s'\n", label.c_str());
        Exit(0);
      }
    }
    
    double val;
    label="/Output/Data/StatisticalVariables/Interval";
    
    if ( !(tpCntl->getInspectedValue(label, val )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    else
    {
      C->Interval[Control::tg_statistic].setInterval(val);
    }
    
    // Statistic for velocity
    label="/Output/Data/StatisticalVariables/VelocityStat";
    if ( tpCntl->chkLabel(label) )
    {
      if ( !(tpCntl->getInspectedValue(label, str )) )
      {
        Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
        Exit(0);
      }
      
      if ( !strcasecmp(str.c_str(), "on") )
      {
        C->Mode.StatVelocity = ON;
        
        C->varState[var_RmsV] = ON;
        C->NvarsAvr_plt3d += 3;
        
        C->varState[var_RmsMeanV] = ON;
        C->NvarsAvr_plt3d += 3;
      }
      else if( !strcasecmp(str.c_str(), "off") )
      {
        C->Mode.StatVelocity = OFF;
        C->varState[var_RmsV] = OFF;
        C->varState[var_RmsMeanV] = OFF;
      }
      else
      {
        Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
        Exit(0);
      }
    }
    
    
    // Statistic for pressure
    label="/Output/Data/StatisticalVariables/PressureStat";
    if ( tpCntl->chkLabel(label) )
    {
      if ( !(tpCntl->getInspectedValue(label, str )) )
      {
        Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
        Exit(0);
      }
      
      if ( !strcasecmp(str.c_str(), "on") )
      {
        C->Mode.StatPressure = ON;
        
        C->varState[var_RmsP] = ON;
        C->NvarsAvr_plt3d += 1;
        
        C->varState[var_RmsMeanP] = ON;
        C->NvarsAvr_plt3d += 1;
      }
      else if( !strcasecmp(str.c_str(), "off") )
      {
        C->Mode.StatPressure = OFF;
        C->varState[var_RmsP] = OFF;
        C->varState[var_RmsMeanP] = OFF;
      }
      else
      {
        Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
        Exit(0);
      }
    }
    
    
    
    // Statistic for Reynolds Stress
    label="/Output/Data/StatisticalVariables/ReynoldsStress";
    if ( tpCntl->chkLabel(label) )
    {
      if ( !(tpCntl->getInspectedValue(label, str )) )
      {
        Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
        Exit(0);
      }
      
      if ( !strcasecmp(str.c_str(), "on") )
      {
        C->Mode.ReynoldsStress = ON;
      }
      else if( !strcasecmp(str.c_str(), "off") )
      {
        C->Mode.ReynoldsStress = OFF;
      }
      else
      {
        Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
        Exit(0);
      }
    }
    
    
    
    // チャネル乱流統計量
    label="/Output/Data/StatisticalVariables/ChannelOutputMean";
    if ( tpCntl->chkLabel(label) )
    {
      if ( !(tpCntl->getInspectedValue(label, str )) )
      {
        Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
        Exit(0);
      }
      
      if ( !strcasecmp(str.c_str(), "on") )
      {
        C->Mode.ChannelOutputMean = ON;
        
        int iter;
        label="/Output/Data/StatisticalVariables/ChannelOutputInterval";
        if ( !(tpCntl->getInspectedValue(label, iter )) )
        {
          Hostonly_ stamped_printf("\tParsing error : Invalid integer value for '%s'\n", label.c_str());
          Exit(0);
        }
        C->Mode.ChannelOutputIter = iter;
      }
    }
    
    
    
    // Statistic for temperature
    if ( C->isHeatProblem() )
    {
      label="/Output/Data/StatisticalVariables/TemperatureStat";
      if ( tpCntl->chkLabel(label) )
      {
        if ( !(tpCntl->getInspectedValue(label, str )) )
        {
          Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
          Exit(0);
        }
        
        if ( !strcasecmp(str.c_str(), "on") )
        {
          C->Mode.StatTemperature = ON;
          
          C->varState[var_RmsT] = ON;
          C->NvarsAvr_plt3d += 1;
          
          C->varState[var_RmsMeanT] = ON;
          C->NvarsAvr_plt3d += 1;
        }
        else if( !strcasecmp(str.c_str(), "off") )
        {
          C->Mode.StatTemperature = OFF;
          C->varState[var_RmsT] = OFF;
          C->varState[var_RmsMeanT] = OFF;
        }
        else
        {
          Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
          Exit(0);
        }
      }
    }
    
  } // Mode.Statistic



  
  
  // ボクセルファイル出力 (Hidden)
  IO_Voxel = OFF;
  label = "/GeometryModel/VoxelOutput";
  
  if ( tpCntl->chkLabel(label) )
  {
    if ( tpCntl->getInspectedValue(label, str) )
    {
      if     ( !strcasecmp(str.c_str(), "svx") )  IO_Voxel = voxel_SVX;
      else if( !strcasecmp(str.c_str(), "bvx") )  IO_Voxel = voxel_BVX;
      else if( !strcasecmp(str.c_str(), "off") )  IO_Voxel = OFF;
      else
      {
        Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
        Exit(0);
      }
    }
    else
    {
      Exit(0);
    }
  }
  
  
  // BCflag出力 (Hidden)
  IO_BCflag = OFF;
  
  if ( IO_Voxel == voxel_BVX )
  {
     IO_BCflag = ON;
  }
  
  
  
  // デバッグ用出力 (Hidden)

  label="/Output/Data/VTKoption";
  
  if ( tpCntl->chkLabel(label) )
  {
    if ( tpCntl->getInspectedValue(label, str) )
    {
      if     ( !strcasecmp(str.c_str(), "on") )  output_vtk = ON;
      else if( !strcasecmp(str.c_str(), "off") ) output_vtk = OFF;
      else
      {
        Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
        Exit(0);
      }
    }
    else
    {
      Exit(0);
    }
  }
  
  
  label="/Output/Data/OutputDebug";
  
  if ( tpCntl->chkLabel(label) )
  {
    if ( tpCntl->getInspectedValue(label, str) )
    {
      if     ( !strcasecmp(str.c_str(), "on") )  output_debug = ON;
      else if( !strcasecmp(str.c_str(), "off") ) output_debug = OFF;
      else
      {
        Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
        Exit(0);
      }
    }
    else
    {
      Exit(0);
    }
  }
  
}
Пример #13
0
// #################################################################
//
void DfiInfo::ReadDfiProc(string fname)
{
  TextParser tpCntl;
  string str;
  string label,label_base,label_leaf;
  int ct;
  int nnode=0;
  int iv[3];
  REAL_TYPE v[3];
  
  
  //入力ファイルをセット
  int ierror = tpCntl.read(fname);
  if ( ierror )
  {
    Hostonly_ stamped_printf("\tinput file not found '%s'\n",fname.c_str());
    Exit(0);
  }
  
  
  //Domain
  
  //Global_Origin
  label = "/Domain/GlobalOrigin";
  for (int n=0; n<3; n++) v[n]=0.0;
  if ( !(tpCntl.getInspectedVector(label, v, 3 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Global_Origin[0]=v[0];
  Global_Origin[1]=v[1];
  Global_Origin[2]=v[2];
  
  //Global_Region
  label = "/Domain/GlobalRegion";
  for (int n=0; n<3; n++) v[n]=0.0;
  if ( !(tpCntl.getInspectedVector(label, v, 3 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Global_Region[0]=v[0];
  Global_Region[1]=v[1];
  Global_Region[2]=v[2];
  
  //Global_Voxel
  label = "/Domain/GlobalVoxel";
  for (int n=0; n<3; n++) iv[n]=0;
  if ( !(tpCntl.getInspectedVector(label, iv, 3 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Global_Voxel[0]=iv[0];
  Global_Voxel[1]=iv[1];
  Global_Voxel[2]=iv[2];
  
  //Global_Division
  label = "/Domain/GlobalDivision";
  for (int n=0; n<3; n++) iv[n]=0.0;
  if ( !(tpCntl.getInspectedVector(label, iv, 3 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Global_Division[0]=iv[0];
  Global_Division[1]=iv[1];
  Global_Division[2]=iv[2];
  
  
  //MPI
  
  //NumberOfRank
  label = "/MPI/NumberOfRank";
  if ( !(tpCntl.getInspectedValue(label, ct )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    NumberOfRank = ct;
  }
  
  //NumberOfGroup
  label = "/MPI/NumberOfGroup";
  if ( !(tpCntl.getInspectedValue(label, ct )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    NumberOfGroup = ct;
  }
  
  
  ////RankID_in_MPIworld
  //label = "/DistributedFileInfo/RankIDinMPIworld";
  //if ( !(tpCntl.getInspectedValue(label, &ct )) ) {
  //  Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
  //  Exit(0);
  //}
  //else {
  //  RankID_in_MPIworld = ct;
  //}
  
  ////GroupID_in_MPIworld
  //label = "/DistributedFileInfo/GroupIDinMPIworld";
  //if ( !(tpCntl.getInspectedValue(label, &ct )) ) {
  //  Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
  //  Exit(0);
  //}
  //else {
  //  GroupID_in_MPIworld = ct;
  //}
  
  
  //Process <--- NodeInfo
  
  nnode=0;
  //label_base = "/DistributedFileInfo/NodeInfo";
  label_base = "/Process";
  if ( tpCntl.chkNode(label_base) )  //nodeがあれば
  {
    nnode = tpCntl.countLabels(label_base);
  }
  NodeInfoSize=nnode;
  Node = new DfiInfo::NodeInfo[nnode];
  
  for (int i=0; i<NodeInfoSize; i++)
  {
    if ( !(tpCntl.getNodeStr(label_base, i+1, str)) )
    {
      printf("\tParsing error : No Elem name\n");
      Exit(0);
    }
    if( strcasecmp(str.substr(0,4).c_str(), "Rank") ) continue;
    label_leaf=label_base+"/"+str;
    
    //RankID
    label = label_leaf + "/ID";
    if ( !(tpCntl.getInspectedValue(label, ct )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
      Exit(0);
    }
    else {
      Node[i].RankID= ct;
    }
    
    //HostName
    label = label_leaf + "/HostName";
    if ( !(tpCntl.getInspectedValue(label, str )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    Node[i].HostName= str;
    
    //VoxelSize
    label = label_leaf + "/VoxelSize";
    for (int n=0; n<3; n++) v[n]=0.0;
    if ( !(tpCntl.getInspectedVector(label, v, 3 )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
      Exit(0);
    }
    Node[i].VoxelSize[0]=v[0];
    Node[i].VoxelSize[1]=v[1];
    Node[i].VoxelSize[2]=v[2];
    
    //HeadIndex
    label = label_leaf + "/HeadIndex";
    for (int n=0; n<3; n++) v[n]=0.0;
    if ( !(tpCntl.getInspectedVector(label, v, 3 )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
      Exit(0);
    }
    Node[i].HeadIndex[0]=v[0];
    Node[i].HeadIndex[1]=v[1];
    Node[i].HeadIndex[2]=v[2];
    
    //TailIndex
    label = label_leaf + "/TailIndex";
    for (int n=0; n<3; n++) v[n]=0.0;
    if ( !(tpCntl.getInspectedVector(label, v, 3 )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
      Exit(0);
    }
    Node[i].TailIndex[0]=v[0];
    Node[i].TailIndex[1]=v[1];
    Node[i].TailIndex[2]=v[2];
    
  }
  
  
  //TextParserの破棄
  tpCntl.remove();
  
}
Пример #14
0
// #################################################################
//
void COMB::ReadInputFile(TextParser* tpCntl)
{
    string str;
    string label,label_base,label_leaf;

    // node数の取得
    int nnode=0;
    label_base = "/CombData";
    if ( tpCntl->chkNode(label_base) )  //nodeがあれば
    {
        nnode = tpCntl->countLabels(label_base);
    }

    // dfi_nameの取得
    dfi_name.clear();
    label_base = "/CombData";
    for (int i=0; i<nnode; i++) {

        if ( !(tpCntl->getNodeStr(label_base, i+1, str)) )
        {
            printf("\tParsing error : No Elem name\n");
            Exit(0);
        }
        if( strcasecmp(str.substr(0,4).c_str(), "list") ) continue;
        label=label_base+"/"+str;

        if ( !(tpCntl->getInspectedValue(label, str )) ) {
            printf("\tParsing error : fail to get '%s'\n", label.c_str());
            Exit(0);
        }

        dfi_name.push_back(str.c_str());

    }

#if 0
    cout << "dfi_name.size() = " << dfi_name.size() << endl;
    vector<string>::const_iterator it;
    for (it = dfi_name.begin(); it != dfi_name.end(); it++) {
        cout << "name = " << (*it).c_str() << endl;
    }
#endif


    //出力ディレクトリの指定 ---> 実行オプションよりこちらが優先される
    label = "/CombData/OutputDir";
    if ( (tpCntl->getInspectedValue(label, str )) )
    {
        out_dirname=str;
        LOG_OUT_ fprintf(fplog,"\tReset Output Directory '%s'\n", out_dirname.c_str());
        STD_OUT_ printf("\tReset Output Directory '%s'\n", out_dirname.c_str());
        CheckDir(out_dirname);
        if( out_dirname.size() != 0 ) out_dirname=out_dirname+"/";
    }


    //入力ディレクトリの指定
    label = "/CombData/InputDir";
    if ( (tpCntl->getInspectedValue(label, str )) )
    {
        in_dirname=str;
        LOG_OUT_ fprintf(fplog,"\tReset Input Directory '%s'\n", in_dirname.c_str());
        STD_OUT_ printf("\tReset Input Directory '%s'\n", in_dirname.c_str());
        CheckDir(in_dirname);
        if( in_dirname.size() != 0 ) in_dirname=in_dirname+"/";
    }


    //並列実行時のSTAGINGのON/OFF
    label = "/CombData/Staging";
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
        staging = OFF;
    }
    else
    {
        if     ( !strcasecmp(str.c_str(), "on") )  staging = ON;
        else if( !strcasecmp(str.c_str(), "off") ) staging = OFF;
        else
        {
            Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
            Exit(0);
        }
    }


    //出力の単精度or倍精度指定 ---> PLOT3Dの場合は、optionに記述があればそちらを優先
    label = "/CombData/OutputRealType";
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
        output_real_type = OUTPUT_REAL_UNKNOWN;
    }
    if     ( !strcasecmp(str.c_str(), "float" ) )  output_real_type = OUTPUT_FLOAT;
    else if( !strcasecmp(str.c_str(), "double" ) ) output_real_type = OUTPUT_DOUBLE;
    else
    {
        printf("\tInvalid keyword is described for '%s'\n", label.c_str());
        Exit(0);
    }

    // 連結ファイルの出力フォーマット
    label = "/CombData/OutFormat";
    if ( !(tpCntl->getInspectedValue(label, str )) )
    {
        printf("\tParsing error : fail to get '%s'\n", label.c_str());
        Exit(0);
    }
    if     ( !strcasecmp(str.c_str(), "sph" ) )    out_format = OUTFORMAT_IS_SPH;
    else if( !strcasecmp(str.c_str(), "plot3d" ) ) out_format = OUTFORMAT_IS_PLOT3D;
    else if( !strcasecmp(str.c_str(), "avs" ) ) out_format = OUTFORMAT_IS_AVS;
    else
    {
        printf("\tInvalid keyword is described for  '%s'\n", label.c_str());
        Exit(0);
    }

    // PLOT3Dオプションの読み込み
    // PLOT3Dfunctions_20131005 if( out_format == OUTFORMAT_IS_PLOT3D ) get_PLOT3D(tpCntl);

    // AVSオプションの読み込み
    if( out_format == OUTFORMAT_IS_AVS ) get_AVSoptions(tpCntl);

}
Пример #15
0
// #################################################################
// パラメータをロード
bool IP_Step::getTP(Control* R, TextParser* tpCntl)
{
  std::string str;
  std::string label;
  REAL_TYPE ct;
  
  // 2D or 3D mode
  label = "/IntrinsicExample/Dimension";
  
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  
  if     ( !strcasecmp(str.c_str(), "2d") )
  {
    mode = dim_2d;
  }
  else if( !strcasecmp(str.c_str(), "3d") )
  {
    mode = dim_3d;
  }
  else
  {
    Hostonly_ stamped_printf("\tParsing error : Invalid '%s'\n", label.c_str());
    return false;
  }
  
  
  // 媒質指定
  label = "/IntrinsicExample/FluidMedium";
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_fluid = str;
  
  label = "/IntrinsicExample/SolidMedium";
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_solid = str;
  
  
  
  // x-dir step
  label = "/IntrinsicExample/StepLength";
  if ( !(tpCntl->getInspectedValue(label, ct )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  else
  {
	  width = ( R->Unit.Param == DIMENSIONAL ) ? ct : ct * RefL;
  }
  
  // z-dir step
  label = "/IntrinsicExample/StepHeight";
  if ( !(tpCntl->getInspectedValue(label, ct )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  else
  {
	  height = ( R->Unit.Param == DIMENSIONAL ) ? ct : ct * RefL;
  }
  
  return true;
}
Пример #16
0
// #################################################################
// Cell IDをbvxで出力する
int IO_BASE::writeCellID(const int out_gc)
{
  if (IO_Voxel != voxel_BVX) return 0;
  
  unsigned bitWidth = 5;
  int rank = paraMngr->GetMyRankID(procGrp);
  
  int ix = size[0];
  int jx = size[1];
  int kx = size[2];
  int gc = out_gc;
  int gd = guide;
  
  size_t nx = (ix+2*gc) * (jx+2*gc) * (kx+2*gc);
  
  // unsignd char
  u8 *buf = new u8[nx];
  
  // start indexの値 下位5bitの値のみ
  u8 val = DECODE_CMP(d_bcd[ _F_IDX_S3D(1-gc, 1-gc, 1-gc, ix, jx, kx, gd) ]);
  int c=0;
  
#pragma omp parallel for firstprivate(ix, jx, kx, gc, gd, val) schedule(static) reduction(+:c)
  for (int k=1-gc; k<=kx+gc; k++) {
    for (int j=1-gc; j<=jx+gc; j++) {
      for (int i=1-gc; i<=ix+gc; i++) {
        size_t m0 = _F_IDX_S3D(i, j, k, ix, jx, kx, gd);
        size_t m1 = _F_IDX_S3D(i, j, k, ix, jx, kx, gc);
        u8 tmp = DECODE_CMP(d_bcd[m0]);
        buf[m1] = tmp;
        if ( tmp == val ) c++;
      }
    }
  }
  
  bool ret = false;
  int ret_val=0;
  
  // サブドメイン内が全て同じ値の時(c==nx)には、CellID配列を書き出さずに戻り値はval
  if ( c != nx )
  {
    ret = BVX_IO::Save_Block_CellID(size, gc, bitWidth, rank, OutDirPath, buf, BVXcomp);
    if ( !ret )
    {
      stamped_printf("\tError : when saving CellID\n");
      Exit(0);
    }
    ret_val = -1;
  }
  else
  {
    ret_val = (int)val;
  }
  

  if (buf)
  {
    delete [] buf;
    buf = NULL;
  }

  return ret_val;
}
Пример #17
0
/**
 * @brief VP反復の発散値を計算する
 * @param [in] IC IterationCtlクラス
 * @retval 発散値の最大の場所のインデクス
 */
FB::Vec3i FFV::Norm_Div(IterationCtl* IC)
{
  double nrm;
  double flop_count;
  REAL_TYPE coef = 1.0/deltaX; /// 発散値を計算するための係数

  int index[3];
  index[0] = 0;
  index[1] = 0;
  index[2] = 0;
  
  switch (IC->getNormType())
  {

    case v_div_max:
      TIMING_start(tm_norm_div_max);
      flop_count=0.0;
      norm_v_div_max_(&nrm, size, &guide, d_dv, &coef, d_bcp, &flop_count);
      TIMING_stop(tm_norm_div_max, flop_count);
      
      if ( numProc > 1 )
      {
        TIMING_start(tm_norm_comm);
        double tmp;
        tmp = nrm;
        if ( paraMngr->Allreduce(&tmp, &nrm, 1, MPI_MAX) != CPM_SUCCESS ) Exit(0); // 最大値
        TIMING_stop(tm_norm_comm, 2.0*numProc*sizeof(double) ); // 双方向 x ノード数
      }
      IC->setNormValue(nrm);
      break;
      
      
    case v_div_dbg:
      TIMING_start(tm_poi_itr_sct_5); // >>> Poisson Iteration subsection 5
      
      TIMING_start(tm_norm_div_dbg);
      flop_count=0.0;
      
      norm_v_div_dbg_(&nrm, index, size, &guide, d_dv, &coef, d_bcp, &flop_count);
      TIMING_stop(tm_norm_div_dbg, flop_count);
      
      //@todo ここで,最大値のグローバルなindexの位置を計算する
      
      if ( numProc > 1 )
      {
        TIMING_start(tm_norm_comm);
        double tmp;
        tmp = nrm;
        if ( paraMngr->Allreduce(&tmp, &nrm, 1, MPI_MAX) != CPM_SUCCESS ) Exit(0); // 最大値
      }
      IC->setNormValue(nrm);
      
      
      TIMING_stop(tm_poi_itr_sct_5, 0.0); // <<< Poisson Iteration subsection 5
      break;
      
      
    default:
      stamped_printf("\tInvalid convergence type\n");
      Exit(0);
  }
  
  FB::Vec3i idx ( index[0], index[1], index[2] );
  
  return idx;
}
Пример #18
0
// #################################################################
// 
void DfiInfo::ReadDfiFile(string fname)
{
  TextParser tpCntl;
  
  string str;
  string label,label_base,label_leaf;
  int ct;
  REAL_TYPE ct2;
  int nnode=0;
  
  
  //入力ファイルをセット
  int ierror = tpCntl.read(fname);
  if ( ierror )
  {
    Hostonly_ stamped_printf("\tinput file not found '%s'\n",fname.c_str());
    Exit(0);
  }
  
  
  //FileInfo
  
  //Prefix
  //label = "/DistributedFileInfo/Prefix";
  label = "/FileInfo/Prefix";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Prefix=str;
  
  //FileFormat
  //label = "/DistributedFileInfo/FileFormat";
  label = "/FileInfo/FileFormat";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  FileFormat=str;
  
  //GuideCell
  //label = "/DistributedFileInfo/GuideCell";
  label = "/FileInfo/GuideCell";
  if ( !(tpCntl.getInspectedValue(label, ct )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    GuideCell = ct;
  }
  
  //DataType
  label = "/FileInfo/DataType";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  DataType=str;
  
  //Endian
  label = "/FileInfo/Endian";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Endian=str;
  
  //ArrayShape
  label = "/FileInfo/ArrayShape";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  ArrayShape=str;
  
  //Component
  label = "/FileInfo/Component";
  if ( !(tpCntl.getInspectedValue(label, ct )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    Component = ct;
  }
  
  //Unit
  
  //Length
  label = "/Unit/Length";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Length=str;
  
  //L0
  label = "/Unit/L0";
  if ( !(tpCntl.getInspectedValue(label, ct2 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    L0 = ct2;
  }
  
  //Velocity
  label = "/Unit/Velocity";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Velocity=str;
  
  //V0
  label = "/Unit/V0";
  if ( !(tpCntl.getInspectedValue(label, ct2 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    V0 = ct2;
  }
  
  //Length
  label = "/Unit/Pressure";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  Pressure=str;
  
  //P0
  label = "/Unit/P0";
  if ( !(tpCntl.getInspectedValue(label, ct2 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    P0 = ct2;
  }
  
  //DiffPrs
  label = "/Unit/DiffPrs";
  if ( !(tpCntl.getInspectedValue(label, ct2 )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  else {
    DiffPrs = ct2;
  }
  
  
  //FilePath
  label = "/FilePath/Process";
  if ( !(tpCntl.getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
    Exit(0);
  }
  dfi_proc=str;
  
  //read process
  ReadDfiProc(dfi_proc);
  
  
  //TimeSlice
  nnode=0;
  label_base = "/TimeSlice/Slice";
  if ( tpCntl.chkNode(label_base) )  //nodeがあれば
  {
    nnode = tpCntl.countLabels(label_base);
  }
  
  label_base = "/TimeSlice";
  for (int i=0; i<nnode; i++)
  {
    if ( !(tpCntl.getNodeStr(label_base, i+1, str)) )
    {
      printf("\tParsing error : No Elem name\n");
      Exit(0);
    }
    
    if( strcasecmp(str.substr(0,5).c_str(), "Slice") ) continue;
    
    //step
    label=label_base+"/"+str+"/Step";
    if ( !(tpCntl.getInspectedValue(label, ct )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
      Exit(0);
    }
    
    //time
    label=label_base+"/"+str+"/Time";
    if ( !(tpCntl.getInspectedValue(label, ct2 )) )
    {
      Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n",label.c_str());
      Exit(0);
    }
    
    SetSlice(ct,ct2);
  }
  
  //TextParserの破棄
  tpCntl.remove();
  
  //内部変数の計算
  SetValue();
  
  
#if 0
  cout << endl;
  cout << endl;
  //for(int i=0;i<ndfi;i++){
  cout << "" << endl;
  cout << "Prefix = " << this->Prefix << endl;
  //cout << "RankIDinMPIworld = " << this->RankID_in_MPIworld << endl;
  //cout << "GroupIDinMPIworld = " << this->GroupID_in_MPIworld << endl;
  cout << "NumberOfRankIn = " << this->NumberOfRank << endl;
  cout << "NumberOfGroup  = " << this->NumberOfGroup << endl;
  cout << "GlobalOrigin[0] = " << this->Global_Origin[0] << endl;
  cout << "GlobalOrigin[1] = " << this->Global_Origin[1] << endl;
  cout << "GlobalOrigin[2] = " << this->Global_Origin[2] << endl;
  cout << "GlobalRegion[0] = " << this->Global_Region[0] << endl;
  cout << "GlobalRegion[1] = " << this->Global_Region[1] << endl;
  cout << "GlobalRegion[2] = " << this->Global_Region[2] << endl;
  cout << "GlobalVoxel[0] = " << this->Global_Voxel[0] << endl;
  cout << "GlobalVoxel[1] = " << this->Global_Voxel[1] << endl;
  cout << "GlobalVoxel[2] = " << this->Global_Voxel[2] << endl;
  cout << "GlobalDivision[0] = " << this->Global_Division[0] << endl;
  cout << "GlobalDivision[1] = " << this->Global_Division[1] << endl;
  cout << "GlobalDivision[2] = " << this->Global_Division[2] << endl;
  cout << "FileFormat = " << this->FileFormat << endl;
  cout << "GuideCell = " << this->GuideCell << endl;
  cout << "" << endl;
  cout << "NodeInfoSize = " << this->NodeInfoSize << endl;
  for(int j=0; j< this->NodeInfoSize; j++ ) {
    cout << "" << endl;
    cout << "Node[" << j << "].RankID = " << this->Node[j].RankID << endl;
    cout << "Node[" << j << "].HostName = " << this->Node[j].HostName << endl;
    cout << "Node[" << j << "].VoxelSize[0] = " << this->Node[j].VoxelSize[0] << endl;
    cout << "Node[" << j << "].VoxelSize[1] = " << this->Node[j].VoxelSize[1] << endl;
    cout << "Node[" << j << "].VoxelSize[2] = " << this->Node[j].VoxelSize[2] << endl;
    cout << "Node[" << j << "].HeadIndex[0] = " << this->Node[j].HeadIndex[0] << endl;
    cout << "Node[" << j << "].HeadIndex[1] = " << this->Node[j].HeadIndex[1] << endl;
    cout << "Node[" << j << "].HeadIndex[2] = " << this->Node[j].HeadIndex[2] << endl;
    cout << "Node[" << j << "].TailIndex[0] = " << this->Node[j].TailIndex[0] << endl;
    cout << "Node[" << j << "].TailIndex[1] = " << this->Node[j].TailIndex[1] << endl;
    cout << "Node[" << j << "].TailIndex[2] = " << this->Node[j].TailIndex[2] << endl;
    cout << "Node[" << j << "].IJK = " << this->Node[j].IJK << endl;
    cout << "Node[" << j << "].IJK_JK = " << this->Node[j].IJK_JK << endl;
    cout << "Node[" << j << "].IJK_K = " << this->Node[j].IJK_K << endl;
  }
  cout << "" << endl;
  //cout << "step.size() = " << this->step.size() << endl;
  //for(int j=0; j< this->step.size(); j++ ) {
  //  cout << "step[" << j << "] = " << this->step[j] << endl;
  //}
  cout << "Sc.size() = " << this->Sc.size() << endl;
  for(int j=0; j< this->Sc.size(); j++ ) {
    cout << "step[" << j << "] = " << this->Sc[j]->step << endl;
    cout << "time[" << j << "] = " << this->Sc[j]->time << endl;
  }
  cout << "" << endl;
  cout << "index_y.size() = " << this->index_y.size() << endl;
  for(int j=0; j< this->index_y.size(); j++ ) {
    cout << "index_y[" << j << "] = " << this->index_y[j] << endl;
  }
  cout << "" << endl;
  cout << "index_z.size() = " << this->index_z.size() << endl;
  for(int j=0; j< this->index_z.size(); j++ ) {
    cout << "index_z[" << j << "] = " << this->index_z[j] << endl;
  }
  //}
  cout << endl;
  cout << endl;
  
  //Exit(0);
  
#endif
  
}
Пример #19
0
// #################################################################
// パラメータをロード
bool IP_Duct::getTP(Control* R, TextParser* tpCntl)
{
  std::string str;
  std::string label;
  REAL_TYPE ct;
  
  
  // Shape
  label="/IntrinsicExample/Shape";
  if ( !(tpCntl->getInspectedValue(label, str )) ) {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  
  if ( !strcasecmp(str.c_str(), "circular") ) {
    driver.shape = id_circular;
  }
  else if ( !strcasecmp(str.c_str(), "rectangualr") ) {
    driver.shape = id_rectangular;
  }
  else {
    Hostonly_ stamped_printf("\tParsing error : Invalid shape in '%s'\n", label.c_str());
    return false;
  }
  
  // Diameter
  label="/IntrinsicExample/Diameter";
  if ( !(tpCntl->getInspectedValue(label, ct )) ) {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  else{
	  driver.diameter = ( R->Unit.Param == DIMENSIONAL ) ? ct : ct * RefL;
  }
  
  // periodic
  label="/IntrinsicExample/Direction";
  if ( !(tpCntl->getInspectedValue(label, str )) ) {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  if ( !strcasecmp(str.c_str(), "Xminus")) {
    driver.direction = X_minus;
  }
  else if ( !strcasecmp(str.c_str(), "Xplus")) {
    driver.direction = X_plus;
  }
  else if ( !strcasecmp(str.c_str(), "Yminus")) {
    driver.direction = Y_minus;
  }
  else if ( !strcasecmp(str.c_str(), "Yplus")) {
    driver.direction = Y_plus;
  }
  else if ( !strcasecmp(str.c_str(), "Zminus")) {
    driver.direction = Z_minus;
  }
  else if ( !strcasecmp(str.c_str(), "Zplus")) {
    driver.direction = Z_plus;
  }
  else {
    Hostonly_ stamped_printf("\tParsing error : Invalid value of '%s'\n", label.c_str());
    return false;
  }     
  
  // ドライバの設定 値が正の値のとき,有効.ゼロの場合はドライバなし
  label="/IntrinsicExample/Driver";
  if ( tpCntl->getInspectedValue(label, ct ) ) {
    driver.length = ( R->Unit.Param == DIMENSIONAL ) ? ct : ct * RefL;
  }
  else {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  
  if ( driver.length < 0.0 ) {
    Hostonly_ stamped_printf("\tError : Value of 'Driver' must be positive.\n");
    return false;
  }
  
  // 媒質指定
  label="/IntrinsicExample/FluidMedium";
  if ( !(tpCntl->getInspectedValue(label, str )) ) {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_fluid = str;
  
  label="/IntrinsicExample/SolidMedium";
  if ( !(tpCntl->getInspectedValue(label, str )) ) {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_solid = str;
  
  label="/IntrinsicExample/DriverMedium";
  if ( !(tpCntl->getInspectedValue(label, str )) ) {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_driver = str;
  
  label="/IntrinsicExample/DriverFaceMedium";
  if ( !(tpCntl->getInspectedValue(label, str )) ) {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    return false;
  }
  m_driver_face = str;
  
  return true;
}
Пример #20
0
// #################################################################
//
void LAYOUT::ReadInputFile(TextParser* tpCntl)
{
  string str,buff;
  string label,label_base,label_leaf;
  
  // node数の取得
  int nnode=0;
  label_base = "/LayoutData";
  if ( tpCntl->chkNode(label_base) )  //nodeがあれば
  {
    nnode = tpCntl->countLabels(label_base);
  }
  
  // dfi_nameの取得
  dfi_name.clear();
  for (int i=0; i<nnode; i++) {
    
    if ( !(tpCntl->getNodeStr(label_base, i+1, str)) )
    {
      printf("\tParsing error : No Elem name\n");
      Exit(0);
    }
    if( strcasecmp(str.substr(0,4).c_str(), "list") ) continue;
    label=label_base+"/"+str;
    
    if ( !(tpCntl->getInspectedValue(label, buff )) ) {
      printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    //FList[ilist].name = str;
    dfi_name.push_back(buff.c_str());
    
  }
  
#if 0
  cout << "dfi_name.size() = " << dfi_name.size() << endl;
  vector<string>::const_iterator it;
  for (it = dfi_name.begin(); it != dfi_name.end(); it++) {
    cout << "name = " << (*it).c_str() << endl;
  }
#endif
  
  // dfi_nameの取得
  mname.clear();
  dname.clear();
  rankis.clear();
  rankie.clear();
  label_base = "/LayoutData";
  for (int i=0; i<nnode; i++) {
    
    if ( !(tpCntl->getNodeStr(label_base, i+1, str)) )
    {
      printf("\tParsing error : No Elem name\n");
      Exit(0);
    }
    if( strcasecmp(str.substr(0,6).c_str(), "divide") ) continue;
    
    label=label_base+"/"+str+"/machine";
    if ( !(tpCntl->getInspectedValue(label, buff )) ) {
      printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    mname.push_back(buff.c_str());
    
    label=label_base+"/"+str+"/rank";
    int v[2];
    for (int n=0; n<2; n++) v[n]=0;
    if ( !(tpCntl->getInspectedVector(label, v, 2)) ) {
      printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    rankis.push_back(v[0]);
    rankie.push_back(v[1]);
    
    label=label_base+"/"+str+"/dir";
    if ( !(tpCntl->getInspectedValue(label, buff )) ) {
      printf("\tParsing error : fail to get '%s'\n", label.c_str());
      Exit(0);
    }
    dname.push_back(buff.c_str());
  }
  
  
  //出力ディレクトリの指定 ---> 実行オプションよりこちらが優先される
  label = "/LayoutData/OutputDir";
  if ( (tpCntl->getInspectedValue(label, str )) )
  {
    dirname=str;
    CheckDir(dirname);
    if( dirname.size() != 0 ) dirname=dirname+"/";
  }
  
  // DivideFunc ---> 出力を項目別にファイル分割するオプション
  label = "/LayoutData/FFVDivideFunc";
  
  if ( !(tpCntl->getInspectedValue(label, str )) )
  {
    Hostonly_ stamped_printf("\tParsing error : fail to get '%s'\n", label.c_str());
    Exit(0);
  }
  else
  {
    if     ( !strcasecmp(str.c_str(), "on") )  IS_DivideFunc = ON;
    else if( !strcasecmp(str.c_str(), "off") ) IS_DivideFunc = OFF;
    else
    {
      Hostonly_ stamped_printf("\tInvalid keyword is described for '%s'\n", label.c_str());
      Exit(0);
    }
  }
  
  
  // FileNameGrid --- option
  label = "/LayoutData/Plot3dOptions/FileNameGrid";
  
  if ( !(tpCntl->getInspectedValue(label, str)) )
  {
    basename_g = "PLOT3DoutputGrid";
  }
  else
  {
    basename_g = str;
  }
  if ( basename_g.empty() )
  {
    basename_g = "PLOT3DoutputGrid";
  }
  
  // FileNameFunc --- option
  label = "/LayoutData/Plot3dOptions/FileNameFunc";
  
  if ( !(tpCntl->getInspectedValue(label, str)) )
  {
    basename_f = "PLOT3Doutput";
  }
  else
  {
    basename_f = str;
  }
  if ( basename_f.empty() )
  {
    basename_f = "PLOT3Doutput";
  }
  
}