bool ARMarkerTracking::spotted(double younger_than, const ar_track_alvar_msgs::AlvarMarkers& including, const ar_track_alvar_msgs::AlvarMarkers& excluding, ar_track_alvar_msgs::AlvarMarkers& spotted) { if (spotted_markers_.markers.size() == 0) return false; if ((ros::Time::now() - spotted_markers_.markers[0].header.stamp).toSec() >= younger_than) { return false; } spotted.header = spotted_markers_.header; spotted.markers.clear(); for (unsigned int i = 0; i < spotted_markers_.markers.size(); i++) { if ((included(spotted_markers_.markers[i].id, including) == true) && (excluded(spotted_markers_.markers[i].id, excluding) == true)) { spotted.markers.push_back(spotted_markers_.markers[i]); } } return (spotted.markers.size() > 0); }
// Determine if v could be within an interval for which this MdamPoint // is the end endpoint. NABoolean MdamPoint::endContains(const ULng32 keyLen, const char * v) const { Int32 cmpCode = str_cmp(tupp_.getDataPointer(), v, Int32(keyLen)); MdamEnums::MdamOrder tempOrder = MdamEnums::MdamOrder((cmpCode > 0)? 1 : ((cmpCode == 0) ? 0 : -1)); if (tempOrder == MdamEnums::MDAM_LESS) { return FALSE; } else if (tempOrder == MdamEnums::MDAM_GREATER) { return TRUE; } // The two values are equal so consider inclusion. else if (included()) { return TRUE; } else { return FALSE; }; #pragma nowarn(203) // warning elimination return TRUE; // To get rid of compiler warning. #pragma warn(203) // warning elimination }
/* Name column */ void html_namecell(FILE *outf, Outchoices *od, choice rep, char *name, choice source, unsigned int width, logical name1st, logical isfirst, logical rightalign, Alias *aliashead, Include *linkhead, logical ispage, unsigned int spaces, char *baseurl) { extern char *workspace; choice savemultibyte; logical linked; int i; if (name1st != isfirst) return; if (isfirst) matchlengthn(outf, od, width - od->outputter->strlength(name), ' '); savemultibyte = od->multibyte; if (rep == REP_SIZE || rep == REP_PROCTIME) /* Kludge: for these two reports, we know the texts are things like "< 1" and we want to convert > and < */ od->multibyte = FALSE; strcpy(workspace, name); do_aliasx(workspace, aliashead); if (!isfirst) { if (rightalign) i = (int)width - (int)od->outputter->strlength(workspace) - (int)spaces; else i = (int)spaces; matchlengthn(outf, od, i, ' '); } linked = (linkhead != NULL && included(name, ispage, linkhead)); if (linked) { /* We link to the unaliased name, because the OUTPUTALIAS is usually in the nature of an annotation. */ fputs("<a href=\"", outf); if (baseurl != NULL) htmlputs(outf, od, baseurl, IN_HREF); html_escfprintf(outf, name); fputs("\">", outf); } htmlputs(outf, od, workspace, source); if (linked) fputs("</a>", outf); if (isfirst) fputs(": ", outf); od->multibyte = savemultibyte; /* restore multibyte */ }
bool ARMarkerTracking::closest(const ar_track_alvar_msgs::AlvarMarkers& including, const ar_track_alvar_msgs::AlvarMarkers& excluding, ar_track_alvar_msgs::AlvarMarker& closest) { double closest_dist = std::numeric_limits<double>::max(); for (unsigned int i = 0; i < spotted_markers_.markers.size(); i++) { if ((included(spotted_markers_.markers[i].id, including) == true) && (excluded(spotted_markers_.markers[i].id, excluding) == true)) { double d = mtk::distance2D(spotted_markers_.markers[i].pose.pose.position); if (d < closest_dist) { closest_dist = d; closest = spotted_markers_.markers[i]; } } } return (closest_dist < std::numeric_limits<double>::max()); }
void ChunkManager::include(Uint32 from,Uint32 to) { if (from > to) std::swap(from,to); Uint32 i = from; while (i <= to && i < (Uint32)d->chunks.size()) { Chunk* c = d->chunks[i]; c->setExclude(false); excluded_chunks.set(i,false); if (!bitset.get(i)) d->todo.set(i,true); i++; } d->recalc_chunks_left = true; updateStats(); included(from,to); }
/* Name column */ void xml_namecell(FILE *outf, Outchoices *od, choice rep, char *name, choice source, unsigned int width, logical name1st, logical isfirst, logical rightalign, Alias *aliashead, Include *linkhead, logical ispage, unsigned int spaces, char *baseurl) { char *p, *q; int n; XML_TRACE(0); // no output aliasing is done yet. not sure it will be done either. // we don't care, but by testing it we avoid printing the column twice. if ( !isfirst && name ) { XML_OUT( XMLDBG "<col name=\"name\">" ); switch( rep) { case REP_MONTH: case REP_YEAR: case REP_WEEK: case REP_QUARTERLY: case REP_DAYREP: case REP_HOURREP: case REP_QUARTERREP: case REP_FIVEREP: case REP_DAYSUM: case REP_HOURSUM: case REP_QUARTERSUM: case REP_FIVESUM: case REP_WEEKHOUR: // this is split because strtok needs to be called in the right order. XML_OUT( "<timespan from=\"%s\" ", strtok(name," ") ); XML_OUT( "to=\"%s\" ", strtok( NULL," ") ); switch( rep ) { case REP_DAYSUM: XML_OUT( "dayofweek=\"%s\" />", strtok( NULL," ") ); break; case REP_HOURSUM: XML_OUT( "hour=\"%s\" />", strtok( NULL," ") ); break; case REP_QUARTERSUM: XML_OUT( "minute=\"%s\" />", strtok( NULL," ") ); break; case REP_FIVESUM: XML_OUT( "minute=\"%s\" />", strtok( NULL," ") ); break; case REP_WEEKHOUR: XML_OUT( "dayofweek=\"%s\" ", strtok( NULL," ") ); XML_OUT( "hour=\"%s\" />", strtok( NULL," ") ); break; default: XML_OUT( "/>" ); } break; case REP_CODE: strtok(name, " "); // assumption: name = "nnn text" XML_OUT( name ); break; // n=array_index++; // XML_OUT( "%d", (int)(opts->arraydata[rep-FIRST_ARRAYREP][n].threshold) ); // break; case REP_OS: // kludge: the hardcoded OS names from tree.c are turned into i18n // keys - hardly a well thought out interface, but the best we can do // for the moment. p=strtolower(name); // all lowercase while ( (q=strchr(p,' ')) ) *q='-'; // replace ' ' with '-' while ( (q=strchr(p,'/')) ) *q='-'; XML_OUT( "<i18n key=\"os-%s\"/>", p ); break; case REP_SIZE: case REP_PROCTIME: n=array_index++; XML_OUT( "%f", opts->arraydata[rep-FIRST_ARRAYREP][n].threshold ); break; case REP_DOM: case REP_TYPE: // kludge: if the string supplied is delimited by square brackets, // we turn it into an i18n key. if ( *name=='[' && *(name+strlen(name)-1)==']' ) { p=strtolower(name+1); *(p+strlen(p)-1)=0; while ( (q=strchr(p,' ')) ) *q='-'; XML_OUT( "<i18n key=\"%s-%s\"/>", rep==REP_DOM?"domain":"type", p ); break; } // this is a delibrate fall-thru. default: XML_OUT( "<![CDATA[%s]]>", cleanprint(name) ); break; } XML_OUT( "</col>" ); } #if 0 extern char *workspace; choice savemultibyte; logical linked; int i; if (name1st != isfirst) return; if (isfirst) matchlengthn(outf, od, width - od->outputter->strlen(name), ' '); savemultibyte = od->multibyte; if (rep == REP_SIZE || rep == REP_PROCTIME) /* Kludge: for these two reports, we know the texts are things like "< 1" and we want to convert > and < */ od->multibyte = FALSE; strcpy(workspace, name); do_aliasx(workspace, aliashead); if (!isfirst) { if (rightalign) i = (int)width - (int)od->outputter->strlen(workspace) - (int)spaces; else i = (int)spaces; matchlengthn(outf, od, i, ' '); } linked = (linkhead != NULL && included(name, ispage, linkhead)); if (linked) { /* We link to the unaliased name, because the OUTPUTALIAS is usually in the nature of an annotation. */ fputs("<a href=\"", outf); if (baseurl != NULL) htmlputs(outf, od, baseurl, IN_HREF); // xml_escfprintf(outf, name); fputs("\">", outf); } htmlputs(outf, od, workspace, UNTRUSTED); if (linked) fputs("</a>", outf); if (isfirst) fputs(": ", outf); od->multibyte = savemultibyte; /* restore multibyte */ #endif }
void SourceDirTreeNode::invertInclusion() { setIncluded(!included()); }
void leaky::analyze(int thread) { int *countArray = new int[usefulSymbols]; int *flagArray = new int[usefulSymbols]; //Zero our function call counter memset(countArray, 0, sizeof(countArray[0])*usefulSymbols); // reset hit counts for(int i=0; i<usefulSymbols; i++) { externalSymbols[i]->timerHit = 0; externalSymbols[i]->regClear(); } // The flag array is used to prevent counting symbols multiple times // if functions are called recursively. In order to keep from having // to zero it on each pass through the loop, we mark it with the value // of stacks on each trip through the loop. This means we can determine // if we have seen this symbol for this stack trace w/o having to reset // from the prior stacktrace. memset(flagArray, -1, sizeof(flagArray[0])*usefulSymbols); if (cleo) fprintf(outputfd,"m-Start\n"); // This loop walks through all the call stacks we recorded // --last, --start and --end can restrict it, as can excludes/includes stacks = 0; for(malloc_log_entry* lep=firstLogEntry; lep < lastLogEntry; lep = reinterpret_cast<malloc_log_entry*>(&lep->pcs[lep->numpcs])) { if ((thread != 0 && lep->thread != thread) || excluded(lep) || !included(lep)) { continue; } ++stacks; // How many stack frames did we collect u_int n = (lep->numpcs < stackDepth) ? lep->numpcs : stackDepth; char** pcp = &lep->pcs[n-1]; int idx=-1, parrentIdx=-1; // Init idx incase n==0 if (cleo) { // This loop walks through every symbol in the call stack. By walking it // backwards we know who called the function when we get there. char type = 's'; for (int i=n-1; i>=0; --i, --pcp) { idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp)); if(idx>=0) { // Skip over bogus __restore_rt frames that realtime profiling // can introduce. if (i > 0 && !strcmp(externalSymbols[idx]->name, "__restore_rt")) { --pcp; --i; idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp)); if (idx < 0) { continue; } } Symbol **sp=&externalSymbols[idx]; char *symname = htmlify((*sp)->name); fprintf(outputfd,"%c-%s\n",type,symname); delete [] symname; } // else can't find symbol - ignore type = 'c'; } } else { // This loop walks through every symbol in the call stack. By walking it // backwards we know who called the function when we get there. for (int i=n-1; i>=0; --i, --pcp) { idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp)); if(idx>=0) { // Skip over bogus __restore_rt frames that realtime profiling // can introduce. if (i > 0 && !strcmp(externalSymbols[idx]->name, "__restore_rt")) { --pcp; --i; idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp)); if (idx < 0) { continue; } } // If we have not seen this symbol before count it and mark it as seen if(flagArray[idx]!=stacks && ((flagArray[idx]=stacks) || true)) { ++countArray[idx]; } // We know who we are and we know who our parrent is. Count this if(parrentIdx>=0) { externalSymbols[parrentIdx]->regChild(idx); externalSymbols[idx]->regParrent(parrentIdx); } // inside if() so an unknown in the middle of a stack won't break // the link! parrentIdx=idx; } } // idx should be the function that we were in when we received the signal. if(idx>=0) { ++externalSymbols[idx]->timerHit; } } } if (!cleo) generateReportHTML(outputfd, countArray, stacks, thread); }
void leaky::analyze() { int *countArray = new int[usefulSymbols]; int *flagArray = new int[usefulSymbols]; //Zero our function call counter memset(countArray, 0, sizeof(countArray[0])*usefulSymbols); // The flag array is used to prevent counting symbols multiple times // if functions are called recursively. In order to keep from having // to zero it on each pass through the loop, we mark it with the value // of stacks on each trip through the loop. This means we can determine // if we have seen this symbol for this stack trace w/o having to reset // from the prior stacktrace. memset(flagArray, -1, sizeof(flagArray[0])*usefulSymbols); // This loop walks through all the call stacks we recorded stacks = 0; for(malloc_log_entry* lep=firstLogEntry; lep < lastLogEntry; lep = reinterpret_cast<malloc_log_entry*>(&lep->pcs[lep->numpcs])) { if (excluded(lep) || !included(lep)) continue; ++stacks; // How many stack frames did we collect // This loop walks through every symbol in the call stack. By walking it // backwards we know who called the function when we get there. u_int n = (lep->numpcs < stackDepth) ? lep->numpcs : stackDepth; char** pcp = &lep->pcs[n-1]; int idx=-1, parrentIdx=-1; // Init idx incase n==0 for(int i=n-1; i>=0; --i, --pcp, parrentIdx=idx) { idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp)); if(idx>=0) { // Skip over bogus __restore_rt frames that realtime profiling // can introduce. if (i > 0 && !strcmp(externalSymbols[idx].name, "__restore_rt")) { --pcp; --i; idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp)); if (idx < 0) { continue; } } // If we have not seen this symbol before count it and mark it as seen if(flagArray[idx]!=stacks && ((flagArray[idx]=stacks) || true)) { ++countArray[idx]; } // We know who we are and we know who our parrent is. Count this if(parrentIdx>=0) { externalSymbols[parrentIdx].regChild(idx); externalSymbols[idx].regParrent(parrentIdx); } } } // idx should be the function that we were in when we recieved the signal. if(idx>=0) { ++externalSymbols[idx].timerHit; } } generateReportHTML(stdout, countArray, stacks); }
void process_data(Logfile *logfilep, Hashtable **hash, Arraydata **arraydata, choice *count, choice *code2type, choice datacols[ITEM_NUMBER][OUTCOME_NUMBER][DATACOLS_NUMBER][2], choice data2cols[ITEM_NUMBER][DATA_NUMBER], unsigned int *no_cols, Include **wanthead, Include *ispagehead, Alias **aliashead, Include *argshead, Include *refargshead, Dateman *dman, Tree **tree, Derv **derv, choice *alltrees, choice *alldervs, choice *lowmem, logical case_insensitive, logical usercase_insensitive, unsigned char convfloor, logical multibyte, char *dirsuffix, unsigned int dirsufflength, unsigned int granularity) { extern unsigned int year, month, date, hour, minute, code; extern unsigned long unixtime, proctime; extern char am; extern double bytes; extern Memman mm[], mmq, mms, *amemman; extern choice *rep2type; extern Hashentry *unwanted_entry, *blank_entry; extern Hashindex *dummy_item; static Hashindex *gp[ITEM_NUMBER]; unsigned long data[DATA2_NUMBER]; Hashentry *item[ITEM_NUMBER]; logical wanttree[ITEM_NUMBER]; logical isitpage, last7; choice ispage = UNSET; choice wanted = TRUE, rc, outcome; timecode_t timecode = FIRST_TIME; char *name, *namestart, *nameend; size_t len; choice i, j, k; /*** check whether this line is wanted ***/ if (count[INP_CODE] != 0) { if (code == IGNORE_CODE) { for (j = 0; j < ITEM_NUMBER; j++) { /* reset strings */ if (count[j] != 0) mm[j].next_pos = mm[j].curr_pos; } mmq.next_pos = mmq.curr_pos; mms.next_pos = mms.curr_pos; logfilep->data[LOGDATA_UNKNOWN]++; return; } else if (code2type[code] == UNWANTED) wanted = FALSE; } if (wanted && count[INP_DATE] > 0) { if (count[INP_UNIXTIME]) wanted = wantunixtime(&timecode, dman, unixtime, logfilep->tz); else { if (count[INP_AM]) { if (hour > 12) { corrupt_line(logfilep, "Hour greater than 12", -1); return; } else if (hour == 12) hour = 0; if (am == 'p') hour += 12; } wanted = wantdate(&timecode, dman, hour, minute, date, month, year, logfilep->tz); } if (wanted == ERR) { /* corrupt date */ corrupt_line(logfilep, "Corrupt date or time", -1); return; } } /* end count[INP_DATE] > 0 */ for (i = 0; i < ITEM_NUMBER; i++) { wanttree[i] = FALSE; if (!wanted) { for (j = i; j < ITEM_NUMBER; j++) { /* reset not-yet-hashed strings */ if (count[j] != 0) /* NB i is now (unwanted i) + 1 */ mm[j].next_pos = mm[j].curr_pos; } mmq.next_pos = mmq.curr_pos; mms.next_pos = mms.curr_pos; logfilep->data[LOGDATA_UNWANTED]++; return; } if (i == ITEM_HOST) prealiasS(&(mm[ITEM_HOST]), &mms); name = (char *)(mm[i].curr_pos); if (count[i] == 0 || IS_EMPTY_STRING(name) || (name[0] == '-' && name[1] == '\0')) { item[i] = blank_entry; /* or unwanted_; but we get wanted right anyway */ wanted = (wanthead[i] == NULL || included("", FALSE, wanthead[i])); /* wanthead[i] == NULL is tested again in included() but it often saves a call to that function, because blankness is common. */ } else { if (i == ITEM_FILE || i == ITEM_REFERRER) { if ((j = prealias(&(mm[i]), &(mm[ITEM_VHOST]), item[ITEM_VHOST], &mmq, (logical)((i == ITEM_FILE)?case_insensitive:FALSE), (i == ITEM_FILE)?(logfilep->prefix):NULL, logfilep->prefixlen, logfilep->pvpos, (i == ITEM_FILE)?argshead:refargshead)) < 0) { if (j == -1) corrupt_line(logfilep, "%v in file prefix but no VHOST in line", -1); else corrupt_line(logfilep, "Filename too long", -1); return; } } if (lowmem[i] == 0) { if (gp[i] == NULL || !STREQ(name, gp[i]->name)) { gp[i] = hashfind(&mm[i], &(hash[i]), no_cols[i], wanthead[i], UNSET, ispagehead, aliashead[i], dirsuffix, dirsufflength, usercase_insensitive, 0, FALSE, i, FALSE); } /* if name the same as last time, don't need */ else /* to hashfind again, or save the name */ mm[i].next_pos = mm[i].curr_pos; item[i] = (Hashentry *)(gp[i]->other); wanted = (choice)(ENTRY_WANTED(item[i])); } else if (lowmem[i] == 1) { if ((rc = do_alias(name, amemman, aliashead[i], dirsuffix, dirsufflength, usercase_insensitive, 0, FALSE, i)) == FALSE) { item[i] = hashfind(&mm[i], &(hash[i]), no_cols[i], wanthead[i], UNSET, ispagehead, NULL, dirsuffix, dirsufflength, usercase_insensitive, 0, FALSE, i, TRUE)->own; } else if (rc == TRUE) { mm[i].next_pos = mm[i].curr_pos; /* don't save string */ item[i] = hashfind(amemman, &(hash[i]), no_cols[i], wanthead[i], UNSET, ispagehead, NULL, dirsuffix, dirsufflength, usercase_insensitive, 0, FALSE, i, TRUE)->own; } else { /* rc == ERR */ mm[i].next_pos = mm[i].curr_pos; if (included("", FALSE, wanthead[i])) item[i] = blank_entry; else item[i] = unwanted_entry; } wanted = (choice)(ENTRY_WANTED(item[i])); } else { /* lowmem[i] >= 2 */ if ((rc = do_alias(name, amemman, aliashead[i], dirsuffix, dirsufflength, usercase_insensitive, 0, FALSE, i)) == TRUE) { mm[i].next_pos = mm[i].curr_pos; /* don't save old string */ len = strlen((char *)(amemman->curr_pos)); memcpy(submalloc(&(mm[i]), len + 1), amemman->curr_pos, len + 1); name = (char *)(mm[i].curr_pos); /* which might have changed */ amemman->next_pos = amemman->curr_pos; } if (rc == ERR) { if (included("", FALSE, wanthead[i])) { item[i] = blank_entry; if (i == ITEM_FILE) ispage = FALSE; } else wanted = FALSE; mm[i].next_pos = mm[i].curr_pos; } else { isitpage = pageq(name, ispagehead, i); if (i == ITEM_FILE) ispage = (choice)isitpage; if (included(name, isitpage, wanthead[i])) { if (lowmem[i] == 2) { item[i] = hashfind(&(mm[i]), &(hash[i]), no_cols[i], wanthead[i], isitpage, ispagehead, NULL, dirsuffix, dirsufflength, usercase_insensitive, 0, FALSE, i, TRUE)->own; } else { item[i] = blank_entry; wanttree[i] = TRUE; mm[i].next_pos = mm[i].curr_pos; } } else { wanted = FALSE; mm[i].next_pos = mm[i].curr_pos; } } } /* end lowmem[i] >= 2 */ } } /* end for i */ if (!wanted) { logfilep->data[LOGDATA_UNWANTED]++; return; } /*** now add it to the hash tables ***/ /* add to logfile from and to if wanted, whatever status code */ if (timecode != FIRST_TIME) logfilep->from = MIN(logfilep->from, timecode); logfilep->to = MAX(logfilep->to, timecode); last7 = (timecode > dman->last7from && timecode <= dman->last7to); if (ispage == UNSET) /* NB blank_entry has ispage FALSE */ ispage = (choice)(item[ITEM_FILE]->ispage); if (count[INP_BYTES] == 0) bytes = 0; if (count[INP_CODE] == 0) { outcome = SUCCESS; if (count[ITEM_FILE] == 2) { logfilep->data[LOGDATA_SUCC]++; logfilep->data[LOGDATA_SUCC7] += (unsigned long)last7; logfilep->data[LOGDATA_PAGES] += (unsigned long)ispage; logfilep->data[LOGDATA_PAGES7] += (unsigned long)((logical)ispage && last7); } else { logfilep->data[LOGDATA_UNKNOWN]++; logfilep->data[LOGDATA_UNKNOWN7] += (unsigned long)last7; } } else if (code <= 199) { outcome = INFO; logfilep->data[LOGDATA_INFO]++; logfilep->data[LOGDATA_INFO7] += (unsigned long)last7; } else switch (outcome = code2type[code]) { case SUCCESS: logfilep->data[LOGDATA_SUCC]++; logfilep->data[LOGDATA_SUCC7] += (unsigned long)last7; logfilep->data[LOGDATA_PAGES] += (unsigned long)ispage; logfilep->data[LOGDATA_PAGES7] += (unsigned long)((logical)ispage && last7); break; case FAILURE: logfilep->data[LOGDATA_FAIL]++; logfilep->data[LOGDATA_FAIL7] += (unsigned long)last7; break; case REDIRECT: logfilep->data[LOGDATA_REDIR]++; logfilep->data[LOGDATA_REDIR7] += (unsigned long)last7; break; case INFO: logfilep->data[LOGDATA_INFO]++; logfilep->data[LOGDATA_INFO7] += (unsigned long)last7; break; } /* NB any change in what to count when will require corresponding change to end of strtoinfmt() and to fmt munching in correct() */ if (count[INP_CODE] == 2) arrayscore(arraydata[REP_CODE - FIRST_ARRAYREP], code, 1, (unsigned long)last7, 0, 0, 0., 0., timecode); if (outcome != INFO) { if (outcome == SUCCESS) { if (count[INP_DATE] == 2) /* only if file present: see strtoinfmt() */ datehash(timecode, dman, 1, (unsigned long)ispage, bytes, granularity); if (count[INP_BYTES] == 2) { arrayscore(arraydata[REP_SIZE - FIRST_ARRAYREP], bytes, 1, (unsigned long)last7, (unsigned long)ispage, (unsigned long)((logical)ispage && last7), bytes, last7?bytes:0., timecode); logfilep->bytes += bytes; if (last7) logfilep->bytes7 += bytes; } if (count[INP_PROCTIME] == 2) arrayscore(arraydata[REP_PROCTIME - FIRST_ARRAYREP], proctime, 1, (unsigned long)last7, (unsigned long)ispage, (unsigned long)((logical)ispage && last7), bytes, last7?bytes:0., timecode); if (alltrees[0] != REP_NUMBER || alldervs[0] != REP_NUMBER) { /* for LOWMEM 3, run through alltrees then alldervs */ /* NB these (POSSTREE/POSSDERV in init.c) only count successes */ for (k = 0; k <= 1; k++) { for (i = 0; (k?(alldervs[i]):(alltrees[i])) != REP_NUMBER; i++) { j = rep2type[k?(alldervs[i]):(alltrees[i])]; if (wanttree[j]) { dummy_item->name = mm[j].curr_pos; /* mm.curr_pos is marked for deletion, but still intact at present */ dummy_item->own->data[data2cols[j][REQUESTS]] = 1; if (data2cols[j][REQUESTS7] >= 0) /* see comment in genrep() */ dummy_item->own->data[data2cols[j][REQUESTS7]] = (unsigned long)last7; if (data2cols[j][PAGES] >= 0) dummy_item->own->data[data2cols[j][PAGES]] = (unsigned long)ispage; if (data2cols[j][PAGES7] >= 0) dummy_item->own->data[data2cols[j][PAGES7]] = (unsigned long)((logical)ispage && last7); if (data2cols[j][SUCCDATE] >= 0) dummy_item->own->data[data2cols[j][SUCCDATE]] = timecode; if (data2cols[j][SUCCFIRSTD] >= 0) dummy_item->own->data[data2cols[j][SUCCFIRSTD]] = timecode; dummy_item->own->bytes = bytes; dummy_item->own->bytes7 = last7?bytes:0.; if (k) makederived(derv[alldervs[i] - FIRST_DERVREP], dummy_item, NULL, convfloor, multibyte, alldervs[i], datacols[j], no_cols[j]); else { namestart = NULL; tree[G(alltrees[i])]->cutfn(&namestart, &nameend, dummy_item->name, FALSE); (void)treefind(namestart, nameend, &(tree[G(alltrees[i])]->tree), dummy_item, tree[G(alltrees[i])]->cutfn, FALSE, TRUE, FALSE, tree[G(alltrees[i])]->space, datacols[j], no_cols[j]); } } } } } /* there are trees or dervs */ } /* outcome == SUCCESS */ data[REQUESTS2] = 1; data[REQUESTS72] = (unsigned long)last7; data[PAGES2] = (unsigned long)ispage; data[PAGES72] = (unsigned long)((logical)ispage && last7); data[DATE2] = timecode; data[FIRSTD2] = timecode; for (i = 0; i < ITEM_NUMBER; i++) { if (count[i] == 2 && !ENTRY_BLANK(item[i])) hashscore(item[i], data, datacols[i][outcome], outcome, bytes); } } /* end if outcome != INFO */ }
void ATO::Integrator<T>::getSurfaceTris( std::vector< Vector3D >& points, std::vector< Tri >& tris, const Intrepid::FieldContainer<T>& topoVals, const Intrepid::FieldContainer<T>& coordCon, T zeroVal, C compare) //******************************************************************************// { const CellTopologyData& cellData = *(cellTopology->getBaseCellTopologyData()); // find intersections std::vector<Intersection> intersections; uint nEdges = cellData.edge_count; int nDims = coordCon.dimension(1); for(int edge=0; edge<nEdges; edge++){ uint i = cellData.edge[edge].node[0], j = cellData.edge[edge].node[1]; if((topoVals(i)-zeroVal)*(topoVals(j)-zeroVal) < 0.0){ Vector3D newpoint(Intrepid::ZEROS); T factor = fabs(topoVals(i)-zeroVal)/(fabs(topoVals(i)-zeroVal)+fabs(topoVals(j)-zeroVal)); for(uint k=0; k<nDims; k++) newpoint(k) = (1.0-factor)*coordCon(i,k) + factor*coordCon(j,k); std::pair<int,int> newIntx(i,j); if(topoVals(i) > zeroVal){int tmp=newIntx.first; newIntx.first=newIntx.second; newIntx.second=tmp;} intersections.push_back(Intersection(newpoint,newIntx)); } } std::vector<std::pair<Vector3D,Vector3D> > segment; // if there are four intersections, then there are two interfaces: if( intersections.size() == 4 ){ segment.resize(2); int numNodes = basis->getCardinality(); RealType cntrVal = 0.0; for(int node=0; node<numNodes; node++) cntrVal += topoVals(node); cntrVal /= numNodes; // if topoVal at centroid is negative, interssected segments share a positive valued node if( cntrVal < zeroVal ){ int second = intersections[0].connect.second; if( second == intersections[1].connect.second ){ segment[0].first = intersections[0].point; segment[0].second = intersections[1].point; segment[1].first = intersections[2].point; segment[1].second = intersections[3].point; } else if( second == intersections[2].connect.second ){ segment[0].first = intersections[0].point; segment[0].second = intersections[2].point; segment[1].first = intersections[1].point; segment[1].second = intersections[3].point; } else if( second == intersections[3].connect.second ){ segment[0].first = intersections[0].point; segment[0].second = intersections[3].point; segment[1].first = intersections[1].point; segment[1].second = intersections[2].point; } } else { int first = intersections[0].connect.first; if( first == intersections[1].connect.first ){ segment[0].first = intersections[0].point; segment[0].second = intersections[1].point; segment[1].first = intersections[2].point; segment[1].second = intersections[3].point; } else if( first == intersections[2].connect.first ){ segment[0].first = intersections[0].point; segment[0].second = intersections[2].point; segment[1].first = intersections[1].point; segment[1].second = intersections[3].point; } else if( first == intersections[3].connect.first ){ segment[0].first = intersections[0].point; segment[0].second = intersections[3].point; segment[1].first = intersections[1].point; segment[1].second = intersections[2].point; } } } else if( intersections.size() == 2){ segment.resize(1); segment[0].first = intersections[0].point; segment[0].second = intersections[1].point; } std::vector< Teuchos::RCP<MiniPoly> > polys; int npoints = coordCon.dimension(0), ndims = coordCon.dimension(1); Teuchos::RCP<MiniPoly> poly = Teuchos::rcp(new MiniPoly(npoints)); std::vector<Vector3D>& pnts = poly->points; std::vector<int>& map = poly->mapToBase; for(int pt=0; pt<npoints; pt++){ for(int dim=0; dim<ndims; dim++) pnts[pt](dim) = coordCon(pt,dim); map[pt] = pt; } polys.push_back(poly); int nseg = segment.size(); for(int seg=0; seg<nseg; seg++) partitionBySegment(polys, segment[seg]); typename std::vector< Teuchos::RCP<MiniPoly> >::iterator itpoly; for(itpoly=polys.begin(); itpoly!=polys.end(); itpoly++) if( included(*itpoly,topoVals,zeroVal,compare) ) trisFromPoly(points, tris, *itpoly); }