void PredictorStepQ () { real cr[] = {19.,-10.,3.}, cv[] = {27.,-22.,7.}, div = 24., wr, wv; int n; wr = Sqr (deltaT) / div; wv = deltaT / div; DO_MOL { mol[n].qo = mol[n].q; mol[n].qvo = mol[n].qv; PQ (u1); PQV (u1); PQ (u2); PQV (u2); PQ (u3); PQV (u3); PQ (u4); PQV (u4); mol[n].qa2 = mol[n].qa1; mol[n].qa1 = mol[n].qa; } }
int picdrawchunk(ob *xch, int gox, int goy, ns *xns) { int ik; int i; ob* u; printf("%s: oid %d x,y %d,%d\n", __func__, xch->oid, gox, goy); printf("%s: oid %d wxh %dx%d o %d,%d\n", __func__, xch->oid, xch->wd, xch->ht, xch->ox, xch->oy); printf("%s: b oid %d - %d,%d s %d,%d e %d,%d o %d,%d\n", __func__, xch->oid, xch->cx, xch->cy, xch->csx, xch->csy, xch->cex, xch->cey, xch->ox, xch->coy); printf("+ ##### oid %d START\n", xch->oid); cha_reset(&xch->cch); PB(xch); #if 0 #endif PQ(xch); #if 1 printf("%p (%d,%d)->(%d,%d) (%d,%d) (%d,%d)-(%d,%d)\n", xch, xch->csx, xch->csy, xch->cex, xch->cey, xch->cx, xch->cy, xch->clx, xch->cby, xch->crx, xch->cty); printf("%p+(%d,%d) (%d,%d)->(%d,%d) (%d,%d) (%d,%d)-(%d,%d)\n", xch, gox, goy, gox+xch->csx, goy+xch->csy, gox+xch->cex, goy+xch->cey, gox+xch->cx, goy+xch->cy, gox+xch->clx, goy+xch->cby, gox+xch->crx, goy+xch->cty); #endif #if 0 printf("+ arrow from (%d,%d) to (%d,%d)\n", gox+xch->csx, goy+xch->csy, gox+xch->cex, goy+xch->cey); printf("+ circle at (%d,%d) rad %d dashed\n", gox+xch->cx, goy+xch->cy, xch->cmr); printf("+ line from (%d,%d) to (%d,%d) to (%d,%d) to (%d,%d) to (%d,%d) dashed\n", gox+xch->clx, gox+xch->cby, gox+xch->clx, gox+xch->cty, gox+xch->crx, gox+xch->cty, gox+xch->crx, gox+xch->cby, gox+xch->clx, gox+xch->cby); #endif #if 0 printf("+ box at (%d,%d) width 5 height 5 thick 2\n", xch->cox, xch->coy); #endif #if 0 PC(xch->cox, xch->coy); #endif PC(xch->cx, xch->cy); printf("+ circle at (%d,%d) rad 2 fill 1\n", xch->csx, xch->csy); printf("+ circle at (%d,%d) rad 2 fill 0\n", xch->cex, xch->cey); #if 0 #endif #if 0 printf("+ circle at (%d,%d) rad %d dashed\n", gox+xch->cox+xch->cx, xch->coy+goy+xch->cy, xch->cmr); printf("+ circle at (%d,%d) rad %d dashed\n", xch->cox+xch->cx, xch->coy+xch->cy, xch->cmr); #endif for(i=0;i<xch->cch.nch;i++) { u = (ob*)xch->cch.ch[i]; if(u->type==CMD_CHUNK) { #if 0 ik = picdrawchunk(u, xch->x+xch->ox, xch->y+xch->oy, xns); #endif ik = picdrawchunk(u, xch->x+xch->ox+u->ox, xch->y+xch->oy+u->oy, xns); } else { ik = picdrawobj(u, &xch->cch.dir, xch->x+xch->ox, xch->y+xch->oy, xns); } } printf("+ ##### oid %d DONE\n", xch->oid); printf("%s: a oid %d - %d,%d s %d,%d e %d,%d o %d,%d\n", __func__, xch->oid, xch->cx, xch->cy, xch->csx, xch->csy, xch->cex, xch->cey, xch->ox, xch->coy); return 0; }
int Graph::Member_only( int Snode,int *Dnodes,int Mem_number)//muticast routing algorithm { int V,U, W; BinaryHeap<link> PQ(link(Snode, 0)); link Pnext; // Stores the result of a DeleteMin list<Edge> ::iterator P; ClearTable(0); Table[Snode].Dist = 0; //PQ.Insert(link(Snode, 0)); int Tree_number=0 int Mem_included=0; while (Mem_included<Mem_number) { do { if( PQ.IsEmpty( ) ) { Tree_number=Tree_number+1; ClearTable(1); Table[Snode].Dist = 0; PQ.Insert(link(Snode, 0)); // return 1; } PQ.DeleteMin(Pnext); } while(Table[Pnext.Dest].Mark); V = Pnext.Dest; Table[V].Mark = 1; // Mark vertex as being seen if (Dnodes[V]==0) // V is not a Member for (P = Gmap[V].Adj.begin(); P != Gmap[V].Adj.end(); ++P) { W = (*P).Dest; float Cvw =(*P).Cost; if( Cvw < 0 ) { std::cerr << "Graph has negative edges" << endl; return 0; } // update the dist of v's neighbour v if( Table[W].Dist > Table[V].Dist + Cvw ) { Table[W].Dist = Table[V].Dist + Cvw; Table[W].Prev = V; PQ.Insert( link( W, Table[W].Dist ) ); } } else //V is not a Member { Mem_included=Mem_included+1; U=V; PQ.MakeEmpty( ); do { Table[U].Ontree=1; Table[U].Onforest=1; Table[U].degree=Table[U].degree-1;//u->v then u--; U=Table[U].Prev; Table[U].degree=Table[U].degree-1;//U<-u; then v-- }while(U!=Snode); for( int i = 0; i < N_node; i++ ) { if (Table[i].Ontree==0) { Table[i].Dist = Inf; Table[i].Prev = -1; Table[i].Mark = 0; } else if (Table[i].degree>0) for (P = Gmap[i].Adj.begin(); P != Gmap[i].Adj.end(); ++P) { W = (*P).Dest; float Cvw =(*P).Cost; if (Table[W].Ontree==0) { if( Cvw < 0 ) { std::cerr << "Graph has negative edges" << endl; return 0; } if( Table[W].Ontree) PQ.Insert(link(W, Cvw)); } } } } } return 1; }
} #define FQ(_name, _query_type, _type, _result_type) \ _Q(_name, FD_QUERY_ ## _query_type, _type, _result_type) #define PQ(_name, _query_type, _type, _result_type) \ _Q(_name, PIPE_QUERY_ ## _query_type, _type, _result_type) static const struct pipe_driver_query_info sw_query_list[] = { FQ("draw-calls", DRAW_CALLS, UINT64, AVERAGE), FQ("batches", BATCH_TOTAL, UINT64, AVERAGE), FQ("batches-sysmem", BATCH_SYSMEM, UINT64, AVERAGE), FQ("batches-gmem", BATCH_GMEM, UINT64, AVERAGE), FQ("batches-nondraw", BATCH_NONDRAW, UINT64, AVERAGE), FQ("restores", BATCH_RESTORE, UINT64, AVERAGE), PQ("prims-emitted", PRIMITIVES_EMITTED, UINT64, AVERAGE), FQ("staging", STAGING_UPLOADS, UINT64, AVERAGE), FQ("shadow", SHADOW_UPLOADS, UINT64, AVERAGE), FQ("vsregs", VS_REGS, FLOAT, AVERAGE), FQ("fsregs", FS_REGS, FLOAT, AVERAGE), }; static int fd_get_driver_query_info(struct pipe_screen *pscreen, unsigned index, struct pipe_driver_query_info *info) { struct fd_screen *screen = fd_screen(pscreen); if (!info) return ARRAY_SIZE(sw_query_list) + screen->num_perfcntr_queries;
//***************************************************************************** // METHOD: ossimPolygon::clipLineSegment(p1, p2) // // Implements Cyrus-Beck clipping algorithm as described in: // http://www.daimi.au.dk/~mbl/cgcourse/wiki/cyrus-beck_line-clipping_.html // // Clips the line segment defined by the two endpoints provided. The // endpoints are modified as needed to represent the clipped line. Returns // true if intersection present. // //***************************************************************************** bool ossimPolygon::clipLineSegment(ossimDpt& P, ossimDpt& Q) const { ossimDpt PQ (Q - P); double tE = 0.0; double tL = 1.0; ossimLine edge, edgeE, edgeL; bool intersected=false; double num, denom, t; ossim_uint32 npol = (ossim_uint32)theVertexList.size(); checkOrdering(); //*** // clip the segment against each edge of the polygon //*** ossim_uint32 i = 0; ossim_uint32 j = 0; for(i = 0, j = 1; i < npol;) { edge = ossimLine(theVertexList[i], theVertexList[j]); ossimDpt normal = edge.normal(); // Fix from [email protected] for counter clockwise polygons. (drb) if (theOrderingType == OSSIM_COUNTERCLOCKWISE_ORDER) { normal.x = -normal.x; normal.y = -normal.y; } denom = normal.x*PQ.x + normal.y*PQ.y; num = normal.x*(edge.theP1.x - P.x) + normal.y*(edge.theP1.y - P.y); if (denom < 0) { //*** // Appears to be entering: //*** t = num / denom; if (t > tE) { tE = t; //+ FLT_EPSILON; edgeE = edge; } } else if (denom > 0) { //*** // Appears to be leaving: //*** t = num / denom; if (t < tL) { tL = t;// - FLT_EPSILON; edgeL = edge; } } ++i; ++j; j%=npol; } //*** // Compute clipped end points: //*** if(tL >= tE) { Q.x = P.x + tL*PQ.x; Q.y = P.y + tL*PQ.y; P.x += tE*PQ.x; P.y += tE*PQ.y; intersected = true; } return intersected; }