本文整理汇总了C++中TextParser::read方法的典型用法代码示例。如果您正苦于以下问题:C++ TextParser::read方法的具体用法?C++ TextParser::read怎么用?C++ TextParser::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextParser
的用法示例。
在下文中一共展示了TextParser::read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TextParser_read
static PyObject* TextParser_read(PyObject* self, PyObject* args)
{
// 引数の解析
const char* filename;
PyObject* handle;
if(!PyArg_ParseTuple(args, "Os", &handle, &filename))
{
return NULL;
}
TextParser* tp = static_cast<TextParser*>(PyCObject_AsVoidPtr(handle));
int ret = tp->read(filename);
if(ret != 0)
{
std::cerr<<"MetaData read failed!! ("<<filename<<")"<<std::endl;
}
//戻り値を設定
return Py_BuildValue("i", ret);
}
示例2: ReadInit
// #################################################################
//
void COMB::ReadInit(string input_file)
{
// ------------------------------------
FILE* fp = NULL;
// TPインスタンス生成
TextParser tpCntl;
// 入力ファイルをセット
int ierror = tpCntl.read(input_file);
// 入力ファイルの読み込み--->パラメータのセット
ReadInputFile(&tpCntl);
// TextParserの破棄
tpCntl.remove();
return;
}
示例3: ReadInit
// #################################################################
//
void LAYOUT::ReadInit()
{
// ------------------------------------
FILE* fp = NULL;
// TPインスタンス生成
TextParser tpCntl;
//入力ファイルをセット
int ierror = tpCntl.read(fname);
//入力ファイルの読み込み--->パラメータのセット
ReadInputFile(&tpCntl);
//TextParserの破棄
tpCntl.remove();
return;
}
示例4: ReadDfiFile
// #################################################################
//
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 )) )
{
//.........这里部分代码省略.........
示例5: ReadDfiProc
// #################################################################
//
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";
//.........这里部分代码省略.........