本文整理汇总了C++中ConfigReader::GetPositiveDoubleOption方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigReader::GetPositiveDoubleOption方法的具体用法?C++ ConfigReader::GetPositiveDoubleOption怎么用?C++ ConfigReader::GetPositiveDoubleOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigReader
的用法示例。
在下文中一共展示了ConfigReader::GetPositiveDoubleOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
int GeneralGamlConfig::Read(const char* fname, bool isMaster /*=false*/) {
ConfigReader cr;
if (cr.Load(fname) != 0) {
printf("ERROR: GamlConfig::General::Read(%s) failed.\n", fname);
return -1;
}
int errors = 0;
errors += cr.SetSection("general");
if(errors < 0) throw ErrorException("Didn't find [general] section in config file\n (this section heading is required)");
errors += cr.GetUnsignedOption("logevery", logevery);
errors += cr.GetUnsignedOption("saveevery", saveevery);
int found=cr.GetPositiveNonZeroDoubleOption("megsclamemory", megsClaMemory, true);
found += cr.GetPositiveNonZeroDoubleOption("availablememory", availableMemory, true);
if(found == -2) throw ErrorException("Either \"megsclamemory\" or \"availablememory\" must be specified in conf!");
errors += cr.GetStringOption("datafname", datafname);
errors += cr.GetStringOption("ofprefix", ofprefix);
errors += cr.GetStringOption("streefname", streefname);
cr.GetStringOption("constraintfile", constraintfile, true);
errors += cr.GetIntNonZeroOption("randseed", randseed);
errors += cr.GetBoolOption("refinestart", refineStart);
cr.GetBoolOption("refineend", refineEnd, true);
errors += cr.GetBoolOption("outputeachbettertopology", outputTreelog);
errors += cr.GetBoolOption("enforcetermconditions", enforceTermConditions);
errors += cr.GetUnsignedNonZeroOption("genthreshfortopoterm", lastTopoImproveThresh);
errors += cr.GetPositiveNonZeroDoubleOption("scorethreshforterm", improveOverStoredIntervalsThresh);
cr.GetPositiveNonZeroDoubleOption("significanttopochange", significantTopoChange, true);
cr.GetUnsignedNonZeroOption("attachmentspertaxon", attachmentsPerTaxon, true);
cr.GetUnsignedOption("outputsitelikelihoods", outputSitelikelihoods, true);
cr.GetBoolOption("reportrunprogress", reportRunProgress, true);
cr.GetBoolOption("outputmostlyuselessfiles", outputMostlyUselessFiles, true);
cr.GetBoolOption("outputphyliptree", outputPhylipTree, true);
cr.GetBoolOption("collapsebranches", collapseBranches, true);
cr.GetIntOption("genthreshforswapterm", swapTermThreshold, true);
cr.GetStringOption("arbitrarystring", arbitraryString, true);
cr.GetUnsignedOption("windowlength", siteWindowLength, true);
cr.GetUnsignedOption("windowstride", siteWindowStride, true);
cr.GetBoolOption("usepatternmanager", usePatternManager, true);
//changed the wording of this from besttree to besttopology, to match outputeachbettertopology
//still allow besttree, since that is what I told Maddison, and I think has already been incorporated
//into Mesquite
int ret = cr.GetBoolOption("outputcurrentbesttopology", outputCurrentBestTopology, true);
if(ret < 0)
cr.GetBoolOption("outputcurrentbesttree", outputCurrentBestTopology, true);
cr.GetBoolOption("restart", restart, true);
cr.GetBoolOption("writecheckpoints", checkpoint, true);
//after changes to Population, this is now allowed
// if((restart || checkpoint) && collapseBranches)
// throw ErrorException("Sorry, the collapsebranches option can not currently be used with checkpointing");
cr.GetUnsignedNonZeroOption("searchreps", searchReps, true);
cr.GetUnsignedOption("runmode", runmode, true);
cr.GetBoolOption("scoreonly", scoreOnly, true);
//cr.GetBoolOption("useflexrates", useflexrates, true);
//cr.GetBoolOption("dontinferproportioninvariant", dontInferProportionInvariant, true);
cr.GetStringOption("ratehetmodel", rateHetModel, true);
cr.GetUnsignedOption("numratecats", numRateCats, true);
cr.GetStringOption("statefrequencies", stateFrequencies, true);
cr.GetStringOption("ratematrix", rateMatrix, true);
if(cr.GetStringOption("invariantsites", proportionInvariant, true) == -1)
proportionInvariant = "unspecified";
cr.GetStringOption("datatype", datatype, true);
cr.GetStringOption("geneticcode", geneticCode, true);
cr.GetStringOption("outgroup", outgroupString, true);
if(isMaster){
errors += cr.SetSection("master");
if(errors < 0) throw ErrorException("Didn't find [master] section in config file\n (this section heading is required)");
}
else{
errors += cr.SetSection("remote");
if(errors < 0) throw ErrorException("Didn't find [remote] section in config file\n (this section heading is required)");
}
errors += cr.GetUnsignedNonZeroOption("nindivs", nindivs);
errors += cr.GetUnsignedOption("holdover", holdover);
errors += cr.GetPositiveNonZeroDoubleOption("selectionintensity", selectionIntensity);
errors += cr.GetDoubleOption("holdoverpenalty", holdoverPenalty);
errors += cr.GetUnsignedNonZeroOption("stopgen", stopgen);
errors += cr.GetUnsignedNonZeroOption("stoptime", stoptime);
errors += cr.GetPositiveNonZeroDoubleOption("startoptprec", startOptPrec);
errors += cr.GetPositiveNonZeroDoubleOption("minoptprec", minOptPrec);
//changing this to specify either the number of reductions in the precision or the
//multiplier as before. Prefer the number, since it should be easier to specify.
//
found=0;
found=cr.GetIntOption("numberofprecreductions", numPrecReductions, true);
found += cr.GetPositiveNonZeroDoubleOption("precreductionfactor", precReductionFactor, true);
if(found == -2) throw ErrorException("Error: either \"numberofprecreductions\" (preferably) or \"precreductionfactor\" must be specified in conf!");
errors += cr.GetPositiveDoubleOption("topoweight", topoWeight);
//.........这里部分代码省略.........
示例2: Read
//.........这里部分代码省略.........
settingsFound += cr.GetStringOption("geneticcode", configModSet.geneticCode, true);
if(settingsFound == -7)
throw ErrorException("No model descriptions found in config file. Proper setup is either:\n\t1. Model settings found somewhere under [general] heading,\n\t applying to all data subsets\n\t2. Separate model settings for each partition subset\n\t found under different headings [model1], [model2]. etc");
configModelSets.push_back(configModSet);
}
cr.GetBoolOption("linkmodels", linkModels, true);
cr.GetBoolOption("subsetspecificrates", subsetSpecificRates, true);
cr.GetStringOption("outgroup", outgroupString, true);
if(isMaster){
errors += cr.SetSection("master");
if(errors < 0) throw ErrorException("Didn't find [master] section in config file\n (this section heading is required)");
}
else{
errors += cr.SetSection("remote");
if(errors < 0) throw ErrorException("Didn't find [remote] section in config file\n (this section heading is required)");
}
errors += cr.GetUnsignedNonZeroOption("nindivs", nindivs);
errors += cr.GetUnsignedOption("holdover", holdover);
errors += cr.GetPositiveNonZeroDoubleOption("selectionintensity", selectionIntensity);
errors += cr.GetDoubleOption("holdoverpenalty", holdoverPenalty);
errors += cr.GetUnsignedNonZeroOption("stopgen", stopgen);
errors += cr.GetUnsignedNonZeroOption("stoptime", stoptime);
errors += cr.GetPositiveNonZeroDoubleOption("startoptprec", startOptPrec);
errors += cr.GetPositiveNonZeroDoubleOption("minoptprec", minOptPrec);
//changing this to specify either the number of reductions in the precision or the
//multiplier as before. Prefer the number, since it should be easier to specify.
//
found=0;
found=cr.GetIntOption("numberofprecreductions", numPrecReductions, true);
found += cr.GetPositiveNonZeroDoubleOption("precreductionfactor", precReductionFactor, true);
if(found == -2) throw ErrorException("Error: either \"numberofprecreductions\" (preferably) or \"precreductionfactor\" must be specified in conf!");
errors += cr.GetPositiveDoubleOption("topoweight", topoWeight);
errors += cr.GetPositiveDoubleOption("modweight", modWeight);
errors += cr.GetPositiveDoubleOption("brlenweight", brlenWeight);
errors += cr.GetPositiveDoubleOption("randnniweight", randNNIweight);
errors += cr.GetPositiveDoubleOption("randsprweight", randSPRweight);
errors += cr.GetPositiveDoubleOption("limsprweight", limSPRweight);
cr.GetPositiveNonZeroDoubleOption("uniqueswapbias", uniqueSwapBias, true);
cr.GetPositiveNonZeroDoubleOption("distanceswapbias", distanceSwapBias, true);
cr.GetDoubleOption("treerejectionthreshold", treeRejectionThreshold, true);
cr.GetUnsignedOption("bootstrapreps", bootstrapReps, true);
cr.GetPositiveNonZeroDoubleOption("resampleproportion", resampleProportion, true);
cr.GetBoolOption("inferinternalstateprobs", inferInternalStateProbs, true);
#ifdef MPI_VERSION
if(bootstrapReps != 0) throw ErrorException("Sorry, Bootstrap not yet implemented in parallel GARLI!");
#endif
#ifdef MPI_VERSION
if(isMaster==false) errors += cr.GetDoubleOption("sendinterval", sendInterval);
#endif
#ifdef GANESH
errors += cr.GetDoubleOption("randpecrweight", randPECRweight);
#endif
// errors += cr.GetUnsignedOption("gammashapebrlen", gammaShapeBrlen);
// errors += cr.GetUnsignedOption("gammashapemodel", gammaShapeModel);
errors += cr.GetPositiveNonZeroDoubleOption("gammashapebrlen", gammaShapeBrlen);
errors += cr.GetPositiveNonZeroDoubleOption("gammashapemodel", gammaShapeModel);
errors += cr.GetUnsignedNonZeroOption("limsprrange", limSPRrange);
errors += cr.GetUnsignedNonZeroOption("intervallength", intervalLength);
errors += cr.GetUnsignedNonZeroOption("intervalstostore", intervalsToStore);
errors += cr.GetPositiveNonZeroDoubleOption("meanbrlenmuts", meanBrlenMuts);
cr.GetPositiveNonZeroDoubleOption("minbrlen", minBrlen, true);
cr.GetPositiveNonZeroDoubleOption("maxbrlen", maxBrlen, true);
cr.GetPositiveNonZeroDoubleOption("startingbrlen", startingBrlen, true);
#ifdef INCLUDE_PERTURBATION
errors += cr.SetSection("perturbation");
errors += cr.GetIntOption("perttype", pertType);
errors += cr.GetDoubleOption("pertthresh", pertThresh);
errors += cr.GetIntOption("minpertinterval", minPertInterval);
errors += cr.GetIntOption("maxpertsnoimprove", maxPertsNoImprove);
errors += cr.GetBoolOption("restartafterabandon", restartAfterAbandon);
errors += cr.GetIntOption("gensbeforerestart", gensBeforeRestart);
errors += cr.GetDoubleOption("ratchetproportion", ratchetProportion);
errors += cr.GetDoubleOption("ratchetoffthresh", ratchetOffThresh);
errors += cr.GetIntOption("ratchetmaxgen", ratchetMaxGen);
errors += cr.GetIntOption("nnitargetaccepts", nniTargetAccepts);
errors += cr.GetIntOption("nnimaxattempts", nniMaxAttempts);
errors += cr.GetIntOption("numsprcycles", numSprCycles);
errors += cr.GetIntOption("sprpertrange", sprPertRange);
#endif
return errors;
}