/*----------------------------------------------*/ void initparms_sis() { #ifndef NVPSG recon(); #endif }
void wfm::dslash(Float *chi, Float *u, Float *psi, int cb, int dag) { /* * To a first approximation, we simply * remap the arguments into a form acceptable * to the assembler, then call it */ /* *Pull in the first Psi to cache early */ cache_touch(psi); cache_touch(psi+4); cache_touch(psi+8); cache_touch(psi+12); cache_touch(psi+16); cache_touch(psi+20); decom(psi,u,cb,dag); #ifdef DEBUG_BENCHMARK_COMMS double ndata = 2*2*allbound * 12 * TwoSpinSize() * 1.0E-6 * 100; struct timeval start,stop,delta; gettimeofday(&start,NULL); for(int i=0;i<100;i++) { #endif comm_start(cb); /* * Hackers: you could split here and do something else... * Such as DWF fith dimension, or a clover term etc... * Might as well pull in a few sites worth of pointer table * while we're waiting for the comms */ comm_complete(cb); #ifdef DEBUG_BENCHMARK_COMMS } gettimeofday(&stop,NULL); timersub(&stop,&start,&delta); double seconds = delta.tv_usec * 1.0E-6 + delta.tv_sec; if ( isBoss() ) printf("Comms %le MB in %le seconds = %le MB/s\n",ndata,seconds,ndata/seconds); ndata = 2*2*allbound * 12 * TwoSpinSize() ; if ( isBoss() ) printf("ndata = %d \n",ndata); #endif #ifdef DEBUG_OUTPUT_VECTORS static int file_cnt; { char buf[256]; sprintf(buf,"2spin.%d.%d",UniqueID(),file_cnt); FILE *fp = fopen(buf,"w"); for(int i=0;i<vol;i++) { for(int pm=0;pm<2;pm++){ for(int mu=0;mu<4;mu++){ int offset = interleave_site(pm,mu,i); for(int s=0;s<2;s++){ for(int c=0;c<3;c++){ for(int r=0;r<2;r++){ int scri; if ( WFM_BGL ) scri = r + s*6+c*2; else scri = r + s*2+c*4; int gbl[4]; site_to_global(cb, i, gbl, local_latt ); if ( SloppyPrecision ) { float * pointer = (float *) two_spinor; fprintf(fp,"%d %d %d %d %d %d %d %d %d %e\n",gbl[0],gbl[1],gbl[2],gbl[3], pm,mu,s,c,r,pointer[PAD_HALF_SPINOR_SIZE*offset+scri]); } else { Float * pointer = (Float *) two_spinor; fprintf(fp,"%d %d %d %d %d %d %d %d %d %e\n",gbl[0],gbl[1],gbl[2],gbl[3], pm,mu,s,c,r,pointer[PAD_HALF_SPINOR_SIZE*offset+scri]); } }}} } } } fclose(fp);} #endif cache_touch(two_spinor); cache_touch(two_spinor+4); cache_touch(two_spinor+8); recon(chi,u,cb,dag); #ifdef DEBUG_OUTPUT_VECTORS { char buf[256]; sprintf(buf,"recon.%d.%d",UniqueID(),file_cnt++); FILE *fp = fopen(buf,"w"); for(int i=0;i<vol;i++) { for(int pm=0;pm<2;pm++){ for(int mu=0;mu<4;mu++){ int offset = interleave_site(pm,mu,i); for(int s=0;s<4;s++){ for(int c=0;c<3;c++){ for(int r=0;r<2;r++){ int scri; scri = r + s*6+c*2; Float * pointer = (Float *) chi; int gbl[4]; site_to_global(cb, i, gbl, local_latt ); fprintf(fp,"%d %d %d %d %d %d %d %d %d %d %e\n",gbl[0],gbl[1],gbl[2],gbl[3], i,pm,mu,s,c,r,pointer[SPINOR_SIZE*offset+scri]); }}} } } } fclose(fp);} exit(0); #endif return; }
VolMagick::Volume signedDistanceFunction(const boost::shared_ptr<Geometry>& geom, const VolMagick::Dimension& dim, const VolMagick::BoundingBox& bbox) { int dimx = dim[0], dimy = dim[1], dimz = dim[2]; // read the annotated input file and Mesh mesh; cerr << "Reading input mesh "; read_labeled_mesh(mesh, geom); cerr << "done." << endl; // build a bounding box around the input and store the // origin, span etc. // vector<double> bbox; // construct_bbox(mesh, bbox); VolMagick::BoundingBox box(bbox); if(box.isNull()) { geom->GetReadyToDrawWire(); //make sure we have calculated extents for this geometry already box[0] = geom->m_Min[0]; box[1] = geom->m_Min[1]; box[2] = geom->m_Min[2]; box[3] = geom->m_Max[0]; box[4] = geom->m_Max[1]; box[5] = geom->m_Max[2]; } // construct a kd-tree of all the non-isolated mesh_vertices. vector<VECTOR3> points; vector<Point> pts; for(int i = 0; i < mesh.get_nv(); i ++) { if( mesh.vert_list[i].iso() ) continue; Point p = mesh.vert_list[i].point(); pts.push_back(p); points.push_back(VECTOR3(CGAL::to_double(p.x()), CGAL::to_double(p.y()), CGAL::to_double(p.z()))); } KdTree kd_tree(points, 20); kd_tree.setNOfNeighbours(1); // Now perform a reconstruction to build a tetrahedralized solid // with in-out marked. Triangulation triang; recon(pts, triang); // assign weight to each triangle. vector<double> weights; // assign_sdf_weight(mesh, weights); // comment out for uniform weight. VolMagick::Volume vol; cerr << "SDF " << endl; try { vol.dimension(VolMagick::Dimension(dimx,dimy,dimz)); vol.voxelType(VolMagick::Float); vol.boundingBox(box); for(unsigned int k=0; k<vol.ZDim(); k++) { for(unsigned int j=0; j<vol.YDim(); j++) { for(unsigned int i=0; i<vol.XDim(); i++) { double x = vol.XMin() + i*vol.XSpan(); double y = vol.YMin() + j*vol.YSpan(); double z = vol.ZMin() + k*vol.ZSpan(); double fn_val = sdf(Point(x,y,z), mesh, weights, kd_tree, triang); vol(i,j,k, fn_val); } } fprintf(stderr, "%5.2f %%\r", (float(k)/float(vol.ZDim()-1))*100.0); } vol.desc("multi_sdf"); } catch(VolMagick::Exception &e) { cerr << e.what() << endl; } catch(std::exception &e) { cerr << e.what() << endl; } cerr << endl << "done." << endl; return vol; }
/*------------------------------------------------------------------ | | initHSlines() | initialize the acquisitions High Speed Lines to their | initial safe state. This state is also store in the structure | acqparams section of code for the acquisition CPU | Note: HSlines is passed to acquisition in EVENT1 & EVENT2 | Acodes, only then are the lines actually set | Author Greg Brissey 6/26/86 | | Modified Author Purpose | -------- ------ ------- | 6/15/89 Greg B. 1. Use new global parameters to calc acode offsets +-----------------------------------------------------------------*/ initHSlines() { codeint *ptr; /* pointer for Codes array */ extern void init_pgd_hslines(); extern void reset_decstatus(); /* --- initialize quiescent states --- */ /* --- establish start and current quiescent HSline states --- */ init_pgd_hslines(&HSlines); /* init to status A conditions, but leave decoupler on only for dm='a' */ setPostExpDecState(A,0.0); statusindx = A; sync_flag=0; reset_decstatus(); if (newacq) { recon(); /* receiver on for safe state at end. */ putcode(INITHSL); putcode( ((HSlines >> 16) & 0xffff) ); /* high order word */ putcode( (HSlines & 0xffff) ); /* low order word */ putcode(ISAFEHSL); putcode( ((HSlines >> 16) & 0xffff) ); /* high order word */ putcode( (HSlines & 0xffff) ); /* low order word */ } /*------------------------------------------------------------------*/ /* if inova, turn receiver off. Yes, the receiver gate is active */ /* low. The default state of the receiver is on which means the */ /* gate is off. The current exception is for 4T & 3T systems. */ /*------------------------------------------------------------------*/ if (newacq) { double tmpshimset; if ( P_getreal(GLOBAL,"shimset",&tmpshimset,1) < 0 ) { tmpshimset = 1.0; } if ((int)(tmpshimset) == WHOLEBODY_SHIMSET) { /*---------------------------------------------------*/ /* default receiver on in order for WHOLEBODY T/R */ /* switch to work correctly. Currently the only way */ /* to determine a wholebody system is the shimset. */ /*---------------------------------------------------*/ recon(); } else { recoff(); /* default receiver Off for all other systems */ } } /* start quiencent state contain dm,dmm and dhp HS settings */ set_lacqvar(HSlines_ptr, HSlines); if (newacq) init_acqvar(HSlines_ptr, HSlines); if (bgflag) fprintf(stderr, "initHSlines(): HSlines: 0x%x \n", HSlines); }