本文整理汇总了C++中SelectionList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ SelectionList::size方法的具体用法?C++ SelectionList::size怎么用?C++ SelectionList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectionList
的用法示例。
在下文中一共展示了SelectionList::size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
void
AnalysisTemplate::writeOutput()
{
// We print out the average of the mean distances for each group.
for (size_t g = 0; g < sel_.size(); ++g)
{
fprintf(stderr, "Average mean distance for '%s': %.3f nm\n",
sel_[g].name(), avem_->average(0, g));
}
}
示例2: fprintf
void
SelectionTester::printSelections()
{
fprintf(stderr, "\nSelections:\n");
for (size_t g = 0; g < selections_.size(); ++g)
{
selections_[g].printDebugInfo(stderr, nmaxind_);
}
fprintf(stderr, "\n");
}
示例3: overLapNamesFinished
void AbstractTwoLevelAgreement::overLapNamesFinished(const SelectionList & tagWords, const SelectionList & outputWords,int &numWords) {
if (tagWords.size()==0 && outputWords.size()==0 )
return;
bool underComputation=(&numWords==&underNumWords);
int countCommon=commonWords(text,tagWords,outputWords); //not working correctly on maximal boundaries
int countCorrect=countWords(text,tagWords);
int countDetected=countWords(text,outputWords);
assert (countCorrect!=0);
assert (countDetected!=0);
numWords+=countCorrect;
double recall=(double)countCommon/countCorrect * countCorrect,
precision=(double)countCommon/countDetected *countCorrect;
if (countDetected==0)
precision=0;
if (underComputation) {
underBoundaryRecallList.append(recall);
underBoundaryPrecisionList.append(precision);
} else {
boundaryRecallList.append(recall);
boundaryPrecisionList.append(precision);
}
}
示例4:
SelectionList
TrajectoryAnalysisModuleData::parallelSelections(const SelectionList &selections)
{
// TODO: Consider an implementation that does not allocate memory every time.
SelectionList newSelections;
newSelections.reserve(selections.size());
SelectionList::const_iterator i = selections.begin();
for (; i != selections.end(); ++i)
{
newSelections.push_back(parallelSelection(*i));
}
return newSelections;
}
示例5:
void
Angle::checkSelections(const SelectionList &sel1,
const SelectionList &sel2) const
{
if (natoms2_ > 0 && sel1.size() != sel2.size())
{
GMX_THROW(InconsistentInputError(
"-group1 and -group2 should specify the same number of selections"));
}
for (size_t g = 0; g < sel1.size(); ++g)
{
int na1 = sel1[g].posCount();
int na2 = (natoms2_ > 0) ? sel2[g].posCount() : 0;
if (natoms1_ > 1 && na1 % natoms1_ != 0)
{
GMX_THROW(InconsistentInputError(formatString(
"Number of positions in selection %d in the first group not divisible by %d",
static_cast<int>(g + 1), natoms1_)));
}
if (natoms2_ > 1 && na2 % natoms2_ != 0)
{
GMX_THROW(InconsistentInputError(formatString(
"Number of positions in selection %d in the second group not divisible by %d",
static_cast<int>(g + 1), natoms2_)));
}
if (natoms1_ > 0 && natoms2_ > 1 && na1 / natoms1_ != na2 / natoms2_)
{
GMX_THROW(InconsistentInputError(
"Number of vectors defined by the two groups are not the same"));
}
if (g2type_[0] == 's' && sel2[g].posCount() != 1)
{
GMX_THROW(InconsistentInputError(
"The second group should contain a single position with -g2 sphnorm"));
}
}
}
示例6: unTag_action
void TimeTaggerDialog::unTag_action() {
if (this==NULL)
return;
SelectionList listForRemoval;
int i=findSelection(0,SELECTION_OUTSIDE);
if (i>=0) {
while (i>=0) {
listForRemoval.append(Selection(tags[i].first,tags[i].second));
tags.removeAt(i);
i--;
i=findSelection(i+1,SELECTION_OUTSIDE);
}
} else {
QTextCursor c=text->textCursor();
int start=c.selectionStart();
int end=c.selectionEnd();
int i=findSelection(0,SELECTION_OUTSIDEOVERLAP);
if (i>=0) {
listForRemoval.append(Selection(start,end-1));
}
while (i>=0) {
if (tags[i].first>=start) {
tags[i].first=end;
} else {
tags[i].second=start-1;
}
if (tags[i].first==tags[i].second) {
tags.removeAt(i);
i--;
}
i=findSelection(i+1,SELECTION_OUTSIDEOVERLAP);
}
}
QTextCursor c=text->textCursor();
for (int i=0;i<listForRemoval.size();i++) {
c.setPosition(listForRemoval[i].first,QTextCursor::MoveAnchor);
c.setPosition(listForRemoval[i].second+1,QTextCursor::KeepAnchor);
text->setTextCursor(c);
text->setTextBackgroundColor(Qt::white);
text->setTextColor(Qt::black);
text->setTextCursor(c);
}
c.clearSelection();
text->setTextCursor(c);
}
示例7: plotm
void
AnalysisTemplate::initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation & /*top*/)
{
nb_.setCutoff(cutoff_);
data_.setColumnCount(0, sel_.size());
avem_.reset(new AnalysisDataAverageModule());
data_.addModule(avem_);
if (!fnDist_.empty())
{
AnalysisDataPlotModulePointer plotm(
new AnalysisDataPlotModule(settings.plotSettings()));
plotm->setFileName(fnDist_);
plotm->setTitle("Average distance");
plotm->setXAxisIsTime();
plotm->setYLabel("Distance (nm)");
data_.addModule(plotm);
}
}
示例8:
void
AnalysisTemplate::analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc,
TrajectoryAnalysisModuleData *pdata)
{
AnalysisDataHandle dh = pdata->dataHandle(data_);
const Selection &refsel = pdata->parallelSelection(refsel_);
AnalysisNeighborhoodSearch nbsearch = nb_.initSearch(pbc, refsel);
dh.startFrame(frnr, fr.time);
for (size_t g = 0; g < sel_.size(); ++g)
{
const Selection &sel = pdata->parallelSelection(sel_[g]);
int nr = sel.posCount();
real frave = 0.0;
for (int i = 0; i < nr; ++i)
{
SelectionPosition p = sel.position(i);
frave += nbsearch.minimumDistance(p.x());
}
frave /= nr;
dh.setPoint(g, frave);
}
dh.finishFrame();
}
示例9: overLapMainFinished
void AbstractTwoLevelAgreement::overLapMainFinished(int i,int j,const SelectionList & tagNames, const SelectionList & outputNames,int &numNames) {
bool underComputation=(&numNames==&underNumNames);
assert(underComputation || (i<0 && j<0 )); //if in max-boundary, i and j have no significance
QSet<int> visitedTags;
int allCommonCount;
int countCommon=commonNames(tagNames,outputNames,visitedTags,allCommonCount);
int countCorrect=tagNames.size();
int countDetected=outputNames.size();
assert (countCommon<=countDetected);
if (countCorrect>0) {
numNames+=countCorrect;
double recall=(double)countCommon/countCorrect * countCorrect,
precision=(double)countCommon/countDetected *countCorrect;
if (countDetected==0)
precision=0;
if (underComputation) {
underNameRecallList.append(recall);
underNamePrecisionList.append(precision);
} else {
nameRecallList.append(recall);
namePrecisionList.append(precision);
}
int k=0,h=0;
QList<int> common_k,common_h;
SelectionList tagWords, outputWords;
while (k<tagNames.size() && h<outputNames.size()) {
int start1=tagNames[k].first,end1=tagNames[k].second,
start2=outputNames[h].first,end2=outputNames[h].second;
if (overLaps(start1,end1,start2,end2) && start1!=end2) {
bool foundK=common_k.contains(k), foundH=common_h.contains(h);
if (underComputation)
startNamesOverLap(i,j,k,h,countCommon);
if (!foundK /*&& !foundJ*/) {//so that merged parts will not be double counted
common_k.append(k);
tagWords.append(tagNames[k]);
if (foundH) { //new correctnode that matches detected
if (underComputation)
anotherTagOverLapPreviousOutputName(i,j,k,h);
}
}
if (!foundH) {//common_i and common_j now are not same size, bc recall and precision need different treatment for overlap
common_h.append(h);
outputWords.append(outputNames[h]);
if (foundK) { //new detectednode that matches correct
if (underComputation)
anotherOutputOverLapPreviousTagName(i,j,k,h);
}
}
if (!foundK && !foundH) {
if (underComputation)
firstNameOverLap(i,j,k,h);
}
//[underboundary computations
SelectionList singleTagWords, singleOutputWords;
singleTagWords.append(tagNames[k]);
singleOutputWords.append(outputNames[h]);
overLapNamesFinished(singleTagWords,singleOutputWords,underNumWords);
//]
int process=0;
if (end1<=end2 ) {
k++;
process++;
}
if (end2<=end1) {
h++;
process++;
}
if (process==2) {
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
}
} else if (before(start1,end1,start2,end2)) {
if (underComputation)
beforeMovingToNextTagName(i,j,k,h);
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
k++;
} else if (after(start1,end1,start2,end2) ) {
if (underComputation)
beforeMovingToNextOutputName(i,j,k,h);
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
h++;
}
}
if (tagWords.size()>0 || outputWords.size()>0) {
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
//.........这里部分代码省略.........