Exemplo n.º 1
0
// #################################################################
// DFIファイル:MPI要素の読込み
CIO::E_CIO_ERRORCODE
cio_MPI::Read(cio_TextParser tpCntl, 
              const cio_Domain domain) 
{

  std::string str;
  std::string label;
  int ct;

  //NumberOfRank
  label = "/MPI/NumberOfRank";
  if ( !(tpCntl.GetValue(label, &ct )) ) {
    ct = domain.GlobalDivision[0]*domain.GlobalDivision[1]*domain.GlobalDivision[2];
  }
  else {
    NumberOfRank = ct;
  }

  //NumberOfGroup
  label = "/MPI/NumberOfGroup";
  if ( !(tpCntl.GetValue(label, &ct )) ) {
    ct = 1;
  }
  else {
    NumberOfGroup = ct;
  }

  return CIO::E_CIO_SUCCESS;

}
Exemplo n.º 2
0
// #################################################################
// Unitの読込み
CIO::E_CIO_ERRORCODE 
cio_Unit::Read(cio_TextParser tpCntl) 
{

  std::string str;
  std::string label_base,label_leaf;
  int nnode=0;
  CIO::E_CIO_ERRORCODE iret = CIO::E_CIO_SUCCESS;

  //UnitList
  label_base = "/UnitList";
  if ( tpCntl.chkNode(label_base) )  //nodeがあれば
  {
    nnode = tpCntl.countLabels(label_base);
  }

  for(int i=0; i<nnode; i++) {
    /** UnitElemの読込み */
    if(!tpCntl.GetNodeStr(label_base,i+1,&str))
    {
      //printf("\tCIO Parsing error : No Elem name\n");
      return iret;
    }
    label_leaf=label_base+"/"+str;
    cio_UnitElem unit;
    unit.Name = str;
    if( unit.Read(tpCntl,label_leaf) == CIO::E_CIO_SUCCESS ) {
      UnitList.insert(map<std::string,cio_UnitElem>::value_type(str,unit));
    }
  }

  return iret; 

}
Exemplo n.º 3
0
// #################################################################
// Unit要素の読込み
CIO::E_CIO_ERRORCODE 
cio_UnitElem::Read(cio_TextParser tpCntl,
                   const std::string label_leaf)
{

  std::string str,label;
  double dt;

  //単位系のの読込み
  label = label_leaf + "/Unit";
  if ( !(tpCntl.GetValue(label, &str )) )
  {
    return CIO::E_CIO_WARN_GETUNIT;
  }
  Unit=str;

  //値の読込み
  label = label_leaf + "/Reference";
  if ( !(tpCntl.GetValue(label, &dt )) )
  {
    dt=0.0;
  }
  reference=dt;

  //diffの読込み
  label = label_leaf + "/Difference";
  if ( !(tpCntl.GetValue(label, &dt )) )
  {
    difference=0.0;
    BsetDiff=false;
  } else {
    difference=dt;
    BsetDiff=true;
  }

  return CIO::E_CIO_SUCCESS;

}
Exemplo n.º 4
0
// #################################################################
// Domain の読込み関数
CIO::E_CIO_ERRORCODE
cio_Domain::Read(cio_TextParser tpCntl) 
{

  std::string str;
  std::string label;
  double v[3];
  int iv[3];

  //GlobalOrign
  label = "/Domain/GlobalOrigin";
  for (int n=0; n<3; n++) v[n]=0.0;
  if ( !(tpCntl.GetVector(label, v, 3 )) ) 
  {
    printf("\tCIO Parsing error : fail to get '%s'\n",label.c_str());
    return CIO::E_CIO_ERROR_READ_DFI_GLOBALORIGIN;
  }
  GlobalOrigin[0]=v[0];
  GlobalOrigin[1]=v[1];
  GlobalOrigin[2]=v[2];

  //GlobalRegion
  label = "/Domain/GlobalRegion";
  for (int n=0; n<3; n++) v[n]=0.0;
  if ( !(tpCntl.GetVector(label, v, 3 )) ) 
  {
    printf("\tCIO Parsing error : fail to get '%s'\n",label.c_str());
    return CIO::E_CIO_ERROR_READ_DFI_GLOBALREGION;
  }
  GlobalRegion[0]=v[0];
  GlobalRegion[1]=v[1];
  GlobalRegion[2]=v[2];

  //Global_Voxel
  label = "/Domain/GlobalVoxel";
  for (int n=0; n<3; n++) iv[n]=0;
  if ( !(tpCntl.GetVector(label, iv, 3 )) ) 
  {
    printf("\tCIO Parsing error : fail to get '%s'\n",label.c_str());
    return CIO::E_CIO_ERROR_READ_DFI_GLOBALVOXEL;
  }
  GlobalVoxel[0]=iv[0];
  GlobalVoxel[1]=iv[1];
  GlobalVoxel[2]=iv[2];

  //Global_Division
  label = "/Domain/GlobalDivision";
  for (int n=0; n<3; n++) iv[n]=0;
  if ( !(tpCntl.GetVector(label, iv, 3 )) ) 
  {
    printf("\tCIO Parsing error : fail to get '%s'\n",label.c_str());
    return CIO::E_CIO_ERROR_READ_DFI_GLOBALDIVISION;
  }
  GlobalDivision[0]=iv[0];
  GlobalDivision[1]=iv[1];
  GlobalDivision[2]=iv[2];

  //ActiveSubdomain
  label = "/Domain/ActiveSubdomainFile";
  if ( !(tpCntl.GetValue(label, &str )) )
  {
    str="";
  }
  ActiveSubdomainFile=str;

  return CIO::E_CIO_SUCCESS;

}