本文整理汇总了C++中ArgParser::AddFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ ArgParser::AddFlag方法的具体用法?C++ ArgParser::AddFlag怎么用?C++ ArgParser::AddFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgParser
的用法示例。
在下文中一共展示了ArgParser::AddFlag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
using namespace std;
retVal_t returnvalue = rvOK;
ArgParser AP;
AP.AddFile(".mat"); /* sysmat */
AP.AddFile(".rhs", false); /* rhsvec */
AP.AddFile(".cfg"); /* params */
AP.AddFile(".sol", false); /* solvec */
AP.AddOption("-c"); /* cmpmat */
AP.AddFlag("-h");
if (!AP.Parse(argc, argv))
{
cout << "try " << argv[0] << " -h for help" << endl;
return(rvArgumentError);
}
if (AP.FlagSet("-h"))
{
printUsageMessage(argv[0]);
return(returnvalue);
}
if (!AP.FileSet(".mat") || !AP.FileSet(".rhs"))
{
cout << "system matrix file (.mat) and rhs vector file (.rhs) have to be specified !\n"
<< "try " << argv[0] << " -h for help" << endl;
return(rvArgumentError);
}
cout << "Welcome to mattest4c!\n";
/* Reading system matrix */
/* ===================== */
qqqMCSR<qqqComplex> A;
qqqSolverParameters parms;
qqqError error;
cout << "Reading System Matrix (file \"" << AP.FileStr(".mat") << "\") ... " << flush;
if (!A.readMatrix(AP.FileStr(".mat")))
{
cout << "not ok!" << endl;
return(rvIOError);
}
else cout << "ok!\n";
qqqIndex dimension = A.dimension();
if (dimension < 1)
{
cout << "Error: dimension of system matrix is smaller than 1!" << endl;
return(rvFormatError);
}
cout <<"Backwriting to \"" << (AP.OptionSet("-c") ? AP.OptionStr("-c") : "compare.mat") << "\"... " << flush;
A.writeMatrix(AP.OptionSet("-c") ? AP.OptionStr("-c") : "compare.mat", true, true);
cout << "ok!\n";
/* Reading parameter file */
/* ====================== */
if (AP.FileSet(".cfg"))
{
cout << "Reading solver parameter file (file \"" << AP.FileStr(".cfg") << "\") ... " << flush;
if (!parms.readParameters(AP.FileStr(".cfg")))
{
cout << "not ok (using default)!\n";
parms.setDefaultSolverParameters();
}
else cout << "ok!\n";
}
/* Allocating memory */
/* ================= */
cout << "Allocating memory (dimension = " << qqqIndexToLong(dimension) << ") ... " << flush;
qqqComplex *x = new qqqComplex[parms.nrhs * dimension];
qqqComplex *b = new qqqComplex[parms.nrhs * dimension];
#if 1
qqqComplex **mB;
qqqComplex **mX;
if (parms.nrhs > 1)
{
mB = new qqqComplex*[parms.nrhs];
mX = new qqqComplex*[parms.nrhs];
for (qqqIndex ccirhs = 0; ccirhs < parms.nrhs; ccirhs++)
{
mB[ccirhs] = &b[ccirhs * dimension];
mX[ccirhs] = &x[ccirhs * dimension];
}
}
else
//.........这里部分代码省略.........