pgsOperand pgsNumber::pgs_not() const { return pnew pgsNumber(num(m_data) == 0 ? wxT("1") : wxT("0")); }
bool pgsNumber::pgs_is_true() const { return (num(m_data) != 0 ? true : false); }
void encodeToCNF() { #define clause2(a,b) \ ({add_lit(a); add_lit(b); add_lit(0);}) #define clause3(a,b,c) \ ({add_lit(a); add_lit(b); add_lit(c); add_lit(0);}) #define implies(a,b) clause2(-a, b); #define implies_or(a,b,c) clause3(-a, b, c); int f, d, l, t, e, c, r; for (f = 0; f < S2; f++) { clause3(white(f), black(f), nblack(f)); implies(white(f), -black(f)); implies(white(f), -nblack(f)); implies(nblack(f), -black(f)); implies(nblack(f), -white(f)); implies(black(f), -white(f)); implies(black(f), -nblack(f)); implies(white(f), numfield(f)); implies(nblack(f), xblack(f)); implies(nblack(f), numfield(f)); implies(black(f), xblack(f)); implies(white(f), -xblack(f)); implies(black(f), -numfield(f)); implies(xblack(f), -white(f)); implies(numfield(f), -black(f)); implies_or(numfield(f), white(f), nblack(f)); implies_or(xblack(f), black(f), nblack(f)); for (d = 0; d < S; d++) { implies(num(f,d), numfield(f)); for (e = 0; e < S; e++) { // each digit at most once in each row t = same_row_but(f, e); if (t != f) implies(num(f, d), -num(t, d)); // each digit at most once in each column t = same_col_but(f, e); if (t != f) implies(num(f, d), -num(t, d)); // only one digit at most in each cell if (d != e) implies(num(f, d), -num(f, e)); } } // numfield(f) => exists d . num(f,d) add_lit(-numfield(f)); for (d = 0; d < S; d++) add_lit(num(f, d)); add_lit(0); // no single white fields int c = field_col(f); int r = field_row(f); add_lit(-white(f)); if (c >= 1) add_lit(-xblack(field(c-1, r))); if (c < S-1) add_lit(-xblack(field(c+1, r))); if (r >= 1) add_lit(-xblack(field(c, r-1))); if (r < S-1) add_lit(-xblack(field(c, r+1))); add_lit(0); } // Encoding the straights: // A constellation like B W W W B is a straight of len 3, // when there are no blacks in between. // The two B's can also be the border. // Only straights of a length >= 2 are interesting. // The implications are encoded into clauses like this: // a&b => x // -(a&b) | x // -a | -b | x for (f = 0; f < S2; f++) { int col = field_col(f); int row = field_row(f); for (c = col+1; c < S; c++) { // col is the first column // c is the last column (inclusively) int len = c-col+1; if (col > 0) add_lit(-xblack(same_row_but(f, col-1))); if (c <= S-2) add_lit(-xblack(same_row_but(f, c+1))); for (int s = 0; s < len; s++) add_lit(-white(same_row_but(f, col+s))); add_lit(hstr(f, len)); add_lit(0); if (col > 0) implies(hstr(f,len), xblack(same_row_but(f, col-1))); if (c <= S-2) implies(hstr(f,len), xblack(same_row_but(f, c+1))); for (int s = 0; s < len; s++) implies(hstr(f,len), white(same_row_but(f, col+s))); // hstr(f,len) => hstrd(f,len,0) | hstrd(f,len,1) ... add_lit(-hstr(f, len)); int largest_mind = S-len; for (int mind = 0; mind <= largest_mind; mind++) add_lit(hstrd(f, len, mind)); add_lit(0); // hstrd(f,len,d) => num(f,d) | num(f,d+1) ... // for all the num()'s in the straight for (int sc = col; sc <= c; sc++) { int ff = same_row_but(f, sc); for (int mind = 0; mind <= largest_mind; mind++) { add_lit(-hstrd(f, len, mind)); for (int dig = 0; dig < len; dig++) add_lit(num(ff, mind+dig)); add_lit(0); } } } for (r = row+1; r < S; r++) { int len = r-row+1; if (row > 0) add_lit(-xblack(same_col_but(f, row-1))); if (r <= S-2) add_lit(-xblack(same_col_but(f, r+1))); for (int s = 0; s < len; s++) add_lit(-white(same_col_but(f, row+s))); add_lit(vstr(f, len)); add_lit(0); if (row > 0) implies(vstr(f,len), xblack(same_col_but(f, row-1))); if (r <= S-2) implies(vstr(f,len), xblack(same_col_but(f, r+1))); for (int s = 0; s < len; s++) implies(vstr(f,len), white(same_col_but(f, row+s))); // and the vstr(f,len) def add_lit(-vstr(f, len)); int largest_mind = S-len; for (int mind = 0; mind <= largest_mind; mind++) add_lit(vstrd(f, len, mind)); add_lit(0); // vstrd(f,len,d) => num(f,d) | num(f,d+1) ... // for all the num()'s in the straight for (int sc = row; sc <= r; sc++) { int ff = same_col_but(f, sc); for (int mind = 0; mind <= largest_mind; mind++) { add_lit(-vstrd(f, len, mind)); for (int dig = 0; dig < len; dig++) add_lit(num(ff, mind+dig)); add_lit(0); } } } } printf("encoded into %i clauses\n", clausesptr); }
void TeXFontDefinition::read_VF_index() { #ifdef DEBUG_FONTS qCDebug(OkularDviDebug) << "font::read_VF_index()"; #endif FILE *VF_file = file; unsigned char cmnd; // available space for macros unsigned char *avail, *availend; flags |= FONT_VIRTUAL; set_char_p = &dviRenderer::set_vf_char; #ifdef DEBUG_FONTS qCDebug(OkularDviDebug) << "TeXFontDefinition::read_VF_index: reading VF pixel file " << filename; #endif // Read preamble. fseek(VF_file, (long) one(VF_file), 1); /* skip comment */ quint32 const file_checksum = four(VF_file); if (file_checksum && checksum && file_checksum != checksum) qCCritical(OkularDviDebug) << "Checksum mismatch dvi = " << checksum << "u, vf = " << file_checksum << "u) in font file" << filename << endl; (void) four(VF_file); /* skip design size */ // Read the fonts. first_font = NULL; while ((cmnd = one(VF_file)) >= FNTDEF1 && cmnd <= FNTDEF4) { int TeXnumber = num(VF_file, (int) cmnd - FNTDEF1 + 1); quint32 checksum = four(VF_file); quint32 scale = four(VF_file); quint32 design = four(VF_file); Q_UNUSED(design); quint16 len = one(VF_file) + one(VF_file); /* sequence point in the middle */ char *fontname = new char[len + 1]; fread(fontname, sizeof(char), len, VF_file); fontname[len] = '\0'; #ifdef DEBUG_FONTS qCDebug(OkularDviDebug) << "Virtual font defines subfont \"" << fontname << "\" scale=" << scale << " design=" << design; #endif // According to Knuth's documentation found in the web source code // of the "vftovp" program (which seems to be the standard // definition of virtual fonts), the "scale" is a fixed point // number which describes extra enlargement that the virtual font // imposes. One obtains the enlargement by dividing 2^20. double enlargement_factor = double(scale)/(1<<20) * enlargement; // TeXFontDefinition *newfontp = font_pool->appendx(fontname, checksum, (quint32)(scaled_size_in_DVI_units*enlargement_factor), enlargement_factor); TeXFontDefinition *newfontp = font_pool->appendx(QString::fromLocal8Bit(fontname), checksum, (quint32)((double(scale)/(1<<20))*scaled_size_in_DVI_units), enlargement_factor); // Insert font in dictionary and make sure the dictionary is big // enough. if (vf_table.capacity()-2 <= vf_table.count()) // Not quite optimal. The size of the dictionary should be a // prime. I don't care. vf_table.reserve(vf_table.capacity()*2); vf_table.insert(TeXnumber, newfontp); if (first_font == NULL) first_font = newfontp; } // Prepare macro array. macrotable = new macro[max_num_of_chars_in_font]; if (macrotable == 0) { qCCritical(OkularDviDebug) << "Could not allocate memory for a macro table."; exit(0); } // Read macros. avail = availend = NULL; for (; cmnd <= LONG_CHAR; cmnd = one(VF_file)) { macro *m; int len; unsigned long cc; long width; if (cmnd == LONG_CHAR) { /* long form packet */ len = four(VF_file); cc = four(VF_file); width = four(VF_file); if (cc >= 256) { qCCritical(OkularDviDebug) << "Virtual character" << cc << "in font" << fontname << "ignored."; fseek(VF_file, (long) len, 1); continue; } } else { /* short form packet */ len = cmnd; cc = one(VF_file); width = num(VF_file, 3); } m = ¯otable[cc]; m->dvi_advance_in_units_of_design_size_by_2e20 = width; if (len > 0) { if (len <= availend - avail) { m->pos = avail; avail += len; } else { m->free_me = true; if (len <= VF_PARM_1) { m->pos = avail = new unsigned char [VF_PARM_2]; availend = avail + VF_PARM_2; avail += len; } else m->pos = new unsigned char[len]; } fread((char *) m->pos, 1, len, VF_file); m->end = m->pos + len; } } if (cmnd != POST) oops(i18n("Wrong command byte found in VF macro list: %1", cmnd)); fclose (VF_file); file = NULL; }
int ucbmain(int argc, char **argv) { psinfo_t info; /* process information structure from /proc */ char *psargs = NULL; /* pointer to buffer for -w and -ww options */ char *svpsargs = NULL; struct psent *psent; int entsize; int nent; pid_t maxpid; struct tty *ttyp = tty; char *tmp; char *p; int c; pid_t pid; /* pid: process id */ pid_t ppid; /* ppid: parent process id */ int i, found; size_t size; DIR *dirp; struct dirent *dentp; char psname[100]; char asname[100]; int pdlen; size_t len; (void) setlocale(LC_ALL, ""); my_uid = getuid(); /* * This program needs the proc_owner privilege */ (void) __init_suid_priv(PU_CLEARLIMITSET, PRIV_PROC_OWNER, (char *)NULL); /* * calculate width of pid fields based on configured MAXPID * (must be at least 5 to retain output format compatibility) */ maxpid = (pid_t)sysconf(_SC_MAXPID); pidwidth = 1; while ((maxpid /= 10) > 0) ++pidwidth; pidwidth = pidwidth < 5 ? 5 : pidwidth; if (ioctl(1, TIOCGWINSZ, &win) == -1) twidth = 80; else twidth = (win.ws_col == 0 ? 80 : win.ws_col); /* add the '-' for BSD compatibility */ if (argc > 1) { if (argv[1][0] != '-' && !isdigit(argv[1][0])) { len = strlen(argv[1]) + 2; tmp = malloc(len); if (tmp != NULL) { (void) snprintf(tmp, len, "%s%s", "-", argv[1]); argv[1] = tmp; } } } setbuf(stdout, stdbuf); while ((c = getopt(argc, argv, "lcaengrSt:xuvwU")) != EOF) switch (c) { case 'g': gflg++; /* include process group leaders */ break; case 'c': /* display internal command name */ cflg++; break; case 'r': /* restrict output to running processes */ rflg++; break; case 'S': /* display time by process and all reaped children */ Sflg++; break; case 'x': /* process w/o controlling tty */ xflg++; break; case 'l': /* long listing */ lflg++; uflg = vflg = 0; break; case 'u': /* user-oriented output */ uflg++; lflg = vflg = 0; break; case 'U': /* update private database ups_data */ Uflg++; break; case 'w': /* increase display width */ if (twidth < 132) twidth = 132; else /* second w option */ twidth = NCARGS; break; case 'v': /* display virtual memory format */ vflg++; lflg = uflg = 0; break; case 'a': /* * display all processes except process group * leaders and processes w/o controlling tty */ aflg++; gflg++; break; case 'e': /* Display environment along with aguments. */ eflg++; break; case 'n': /* Display numerical output */ nflg++; break; case 't': /* restrict output to named terminal */ #define TSZ 30 tflg++; gflg++; xflg = 0; p1 = optarg; do { /* only loop through once (NTTYS = 2) */ parg = argbuf; if (ntty >= NTTYS-1) break; getarg(); if ((p = malloc(TSZ+1)) == NULL) { (void) fprintf(stderr, "ps: no memory\n"); exit(1); } p[0] = '\0'; size = TSZ; if (isdigit(*parg)) { (void) strcpy(p, "tty"); size -= 3; } (void) strncat(p, parg, size); ttyp->tdev = PRNODEV; if (parg && *parg == '?') xflg++; else { char nambuf[TSZ+6]; /* for /dev/+\0 */ struct stat64 s; (void) strcpy(nambuf, "/dev/"); (void) strcat(nambuf, p); if (stat64(nambuf, &s) == 0) ttyp->tdev = s.st_rdev; } ttyp++->tname = p; ntty++; } while (*p1); break; default: /* error on ? */ errflg++; break; } if (errflg) usage(); if (optind + 1 < argc) { /* more than one additional argument */ (void) fprintf(stderr, "ps: too many arguments\n"); usage(); } /* * The -U option is obsolete. Attempts to use it cause ps to exit * without printing anything. */ if (Uflg) exit(0); if (optind < argc) { /* user specified a specific proc id */ pflg++; p1 = argv[optind]; parg = argbuf; getarg(); if (!num(parg)) { (void) fprintf(stderr, "ps: %s is an invalid non-numeric argument for a process id\n", parg); usage(); } pidsave = (pid_t)atol(parg); aflg = rflg = xflg = 0; gflg++; } if (tflg) ttyp->tname = NULL; /* allocate an initial guess for the number of processes */ entsize = 1024; psent = malloc(entsize * sizeof (struct psent)); if (psent == NULL) { (void) fprintf(stderr, "ps: no memory\n"); exit(1); } nent = 0; /* no active entries yet */ if (lflg) { (void) sprintf(hdr, " F UID%*s%*s %%C PRI NI SZ RSS " "WCHAN S TT TIME COMMAND", pidwidth + 1, "PID", pidwidth + 1, "PPID"); } else if (uflg) { if (nflg) (void) sprintf(hdr, " UID%*s %%CPU %%MEM SZ RSS " "TT S START TIME COMMAND", pidwidth + 1, "PID"); else (void) sprintf(hdr, "USER %*s %%CPU %%MEM SZ RSS " "TT S START TIME COMMAND", pidwidth + 1, "PID"); } else if (vflg) { (void) sprintf(hdr, "%*s TT S TIME SIZE RSS %%CPU %%MEM " "COMMAND", pidwidth + 1, "PID"); } else (void) sprintf(hdr, "%*s TT S TIME COMMAND", pidwidth + 1, "PID"); twidth = twidth - strlen(hdr) + 6; (void) printf("%s\n", hdr); if (twidth > PRARGSZ && (psargs = malloc(twidth)) == NULL) { (void) fprintf(stderr, "ps: no memory\n"); exit(1); } svpsargs = psargs; /* * Determine which processes to print info about by searching * the /proc directory and looking at each process. */ if ((dirp = opendir(procdir)) == NULL) { (void) fprintf(stderr, "ps: cannot open PROC directory %s\n", procdir); exit(1); } (void) strcpy(psname, procdir); pdlen = strlen(psname); psname[pdlen++] = '/'; /* for each active process --- */ while (dentp = readdir(dirp)) { int psfd; /* file descriptor for /proc/nnnnn/psinfo */ int asfd; /* file descriptor for /proc/nnnnn/as */ if (dentp->d_name[0] == '.') /* skip . and .. */ continue; (void) strcpy(psname + pdlen, dentp->d_name); (void) strcpy(asname, psname); (void) strcat(psname, "/psinfo"); (void) strcat(asname, "/as"); retry: if ((psfd = open(psname, O_RDONLY)) == -1) continue; asfd = -1; if (psargs != NULL || eflg) { /* now we need the proc_owner privilege */ (void) __priv_bracket(PRIV_ON); asfd = open(asname, O_RDONLY); /* drop proc_owner privilege after open */ (void) __priv_bracket(PRIV_OFF); } /* * Get the info structure for the process */ if (read(psfd, &info, sizeof (info)) != sizeof (info)) { int saverr = errno; (void) close(psfd); if (asfd > 0) (void) close(asfd); if (saverr == EAGAIN) goto retry; if (saverr != ENOENT) (void) fprintf(stderr, "ps: read() on %s: %s\n", psname, err_string(saverr)); continue; } (void) close(psfd); found = 0; if (info.pr_lwp.pr_state == 0) /* can't happen? */ goto closeit; pid = info.pr_pid; ppid = info.pr_ppid; /* Display only process from command line */ if (pflg) { /* pid in arg list */ if (pidsave == pid) found++; else goto closeit; } /* * Omit "uninteresting" processes unless 'g' option. */ if ((ppid == 1) && !(gflg)) goto closeit; /* * Omit non-running processes for 'r' option */ if (rflg && !(info.pr_lwp.pr_sname == 'O' || info.pr_lwp.pr_sname == 'R')) goto closeit; if (!found && !tflg && !aflg && info.pr_euid != my_uid) goto closeit; /* * Read the args for the -w and -ww cases */ if (asfd > 0) { if ((psargs != NULL && preadargs(asfd, &info, psargs) == -1) || (eflg && preadenvs(asfd, &info, psargs) == -1)) { int saverr = errno; (void) close(asfd); if (saverr == EAGAIN) goto retry; if (saverr != ENOENT) (void) fprintf(stderr, "ps: read() on %s: %s\n", asname, err_string(saverr)); continue; } } else { psargs = info.pr_psargs; } if (nent >= entsize) { entsize *= 2; psent = (struct psent *)realloc((char *)psent, entsize * sizeof (struct psent)); if (psent == NULL) { (void) fprintf(stderr, "ps: no memory\n"); exit(1); } } if ((psent[nent].psinfo = malloc(sizeof (psinfo_t))) == NULL) { (void) fprintf(stderr, "ps: no memory\n"); exit(1); } *psent[nent].psinfo = info; if (psargs == NULL) psent[nent].psargs = NULL; else { if ((psent[nent].psargs = malloc(strlen(psargs)+1)) == NULL) { (void) fprintf(stderr, "ps: no memory\n"); exit(1); } (void) strcpy(psent[nent].psargs, psargs); } psent[nent].found = found; nent++; closeit: if (asfd > 0) (void) close(asfd); psargs = svpsargs; } /* revert to non-privileged user */ (void) __priv_relinquish(); (void) closedir(dirp); qsort((char *)psent, nent, sizeof (psent[0]), pscompare); for (i = 0; i < nent; i++) { struct psent *pp = &psent[i]; if (prcom(pp->found, pp->psinfo, pp->psargs)) { (void) printf("\n"); retcode = 0; } } return (retcode); }
void printResults(PicoSAT *p, int* fields) { int verbose = 0; int y, x, d; for (y = 0; y < S; y++) { for (x = 0; x < S; x++) { int f = field(x, y); if (picosat_deref(p, black(f)) == 1) printf("B"); else if (picosat_deref(p, nblack(f)) == 1) printf("N"); /* else if (verbose && picosat_deref(p, numfield(f)) == 1) */ /* printf("#"); */ else if (verbose && picosat_deref(p, white(f)) == 1) printf("w"); else printf(" "); if (fields) printf("%c", fields[f] ? '.' : ' '); if (verbose) { if (picosat_deref(p, xblack(f)) == 1) printf("x"); else printf(" ");} int fo = 0; for (d = 0; d < S; d++) { if (picosat_deref(p, num(f, d)) == 1) { printf("%i", 1+d); fo++;}} if (fo == 0) { printf("_"); fo+=1;} while (fo < 2) { printf(" "); fo++;} printf(" "); } printf("\n"); } return; for (int row = 0; row < S; row++) { for (int col = 0; col < S; col++) { for (int len = 2; len < S-col; len++) { if (picosat_deref(p, hstr(field(col, row), len))) printf("hstr(field(%i,%i), %i) -> 1\n", col, row, len); } } } printf("\n"); for (int row = 0; row < S; row++) { for (int col = 0; col < S; col++) { for (int len = 2; len < S-row; len++) { if (picosat_deref(p, vstr(field(col, row), len))) printf("vstr(field(%i,%i), %i) -> 1\n", col, row, len); } } } }
void String::Splice(int index, int remove_num, const char * insert_chars, int insert_num){ ICK_ASSERT_A(allocator(), 0 <= index && index <= num()); ICK_ASSERT_A(allocator(), 0 <= remove_num); ICK_ASSERT_A(allocator(), index + remove_num <= num()); chars_.Splice(index, remove_num, insert_chars, insert_num); }
char & String::operator [] (int index){ ICK_ASSERT_A(allocator(), 0 <= index && index < num()); return chars_[index]; }
void String::Append(const String & str){ Splice(num(), 0, str); }
void ZcrossPath::start_sil(Bface *f ) { /* * * the face class accessor to vertices, edges, etc * f->v() , f->e(), etc. all take a point from 1 to 3 * this is a huge pain when you are trying to move around * the triangle, so i store my values , - g , ex1, ex2, * in the 0 to 2 range * */ /* the call to has_sil returns if mesh has been looked at * and ALWAYS marks it as such. be careful.. * * this should really be called sil_marked(); or something */ if (!has_sil(f)) return; //f has been zx_checked this frame double g[3]; // int ex1, ex2 , nex1, nex2; //indices of cross edges, in 0-2; //ex1 is vertex 1 of edge 1 ( and index to edge ) //nex1 is vertex 2 of edge 1 bool bgrad; get_g(f, g, ex1, ex2 ); //calculates g values, and where Bface *f1; Bface *f2; Bface *iter_f; //iterator for mesh traversal; nex1 = (ex1+1)%3; nex2 = (ex2+1)%3; // new iterators for mesh traversal Bvert * svrt[3]; double sg[3]; //never check across a crease boundary () //it's a discontinuity in the isosurface f1 = ( f->e(ex1+1)->is_crease()) ? NULL : f->nbr(ex1+1); f2 = ( f->e(ex2+1)->is_crease()) ? NULL : f->nbr(ex2+1); //case 1 - we search and close the loop //case 2 - we do not close loop -> so search backward, fix double alph1 = -g[ex1] / (g[nex1] - g[ex1]); Wpt pt1 = interp ( f->v(ex1+1)->loc(), f->v(nex1+1)->loc(), alph1); double alph2 = -g[ex2] / (g[nex2] - g[ex2]); Wpt pt2 = interp ( f->v(ex2+1)->loc(), f->v(nex2+1)->loc(), alph2); // gradient test; int gmax = ( g[0] > g[1] ) ? 0 : 1; gmax = ( g[2] > g[gmax] ) ? 2 : gmax; Wvec v_iso = pt1 - pt2; Wvec v_max = f->v(gmax+1)->loc() - pt2; Wvec v_grad = v_max.orthogonalized(v_iso); bgrad = ( ( _eye - pt2 ) * v_grad > 0 ) ; //we always move clockwise // more specifically, if gradient is up, we always // check in the same direction // you only have to check once if ( cross( v_grad , f->norm()) * v_iso > 0 ) { swap ( pt1, pt2); swap ( alph1, alph2); swap ( f1, f2); swap ( ex1, ex2 ); swap ( nex1, nex2); } //if everything switches, so does bgrad! //vert is the front ( according to gradient ) vertex on the list //we were going to use it for visibility, but at the moment it's //useless. // store our own barycentric coordinate Wvec bc; bc[ex2] = 1.0-alph2; bc[nex2] = alph2; //start search on f1 int cstart = num(); // index start of this chain (for case 2 ); iter_f = f; add_seg ( f , pt2, f->v(ex2+1), bgrad, f); if (f1) { svrt [0] = f->v(ex2+1) ; //initialize cache values sg [0] = g[ex2]; //for sil_search svrt [1] = f->v(nex2+1); //skee-daddle sg [1] = g[nex2]; //we start at f, having already added the previous point while ( iter_f ) { iter_f = sil_walk_search(iter_f, svrt, sg); if ( iter_f == f ) { //closed loop if ( !( _segs[cstart].p() == _segs.last().p() ) ) { //cerr << "XXX ZcrossPath::start_sil():: points are not equal" << endl; // Wpt a = _segs[cstart].p(); // Wpt b = _segs.last().p(); //cerr << "diff:" << (a-b).length() << endl; _segs.last().p() = _segs[cstart].p() ; } _segs.last().setf( NULL ); _segs.last().set_end(); _segs.last().set_bary(f2); return; } } } else { add_seg ( NULL , pt1, f->v(ex1+1), bgrad, f); } //if we are this far, we have a section of //silhouette in the forward direction, ( it may only cross one triangle tho ) //which ran across a discontinuity //now check for the stretch in the opposite direction int chain2start = num(); // index of start of next chain if ( !f2 ) return; // first face in reverse direction is NULL, we are done. //find second chain, which needs to be reversed //starts at pt2; iter_f = f2; add_seg ( f2 , pt2, f->v(ex2+1), bgrad, f2); svrt[0] = f->v(ex2+1) ; //initialize cached values sg[0] = g[ex2]; //for sil_search svrt[1] = f->v(nex2+1); sg[1] = g[nex2]; while ( iter_f ) { iter_f = sil_walk_search ( iter_f, svrt, sg ); } int chain2end = num(); // second chain is found in wrong order, so we flip it // reversal code int chain2num = (chain2end - chain2start) -1 ; if ( chain2num < 0 ) return; _segs.insert(cstart, chain2num); int last_ind = num()-1; int j=0; for ( ; j < chain2num ; j++ ) { _segs[last_ind-j].setf( _segs[last_ind-(j+1)].f() ); //shift the faces over by one //AND any per-face values _segs[last_ind-j].setg(_segs[last_ind-(j+1)].g()); //grad associates with face _segs[last_ind-j].set_bary(_segs[last_ind-j].f()); //recalc barycentric } for ( j=0; j < chain2num ; j++) { _segs[cstart+j] = _segs.pop(); } _segs.pop(); //last point was the duplicate return; }
void LPRowSet::clear() { SVSet::clear(); left.reDim (num()); right.reDim(num()); }