#include using namespace std; #include #include "DMaterialMap.h" //----------------- // DMaterialMap (Constructor) //----------------- DMaterialMap::DMaterialMap(string namepath, JCalibration *jcalib) { /// Read the specified material map in from the calibration database. /// This will read in the map and figure out the number of grid /// points in each direction (r, and z) and the range in each. this->namepath = namepath; // Read in map from calibration database. This should really be // built into a run-dependent geometry framework, but for now // we do it this way. this->jcalib = jcalib; if(!jcalib)return; cout<<"Reading "< > Mmap; jcalib->Get(namepath, Mmap); cout<<(int)Mmap.size()<<" entries ("; if(Mmap.size()<1){ cout<<")"< to make a // histogram of the entries by using the key to hold the extent // so that the number of entries will be equal to the number of // different values. map rvals; map zvals; double rmin, zmin, rmax, zmax; rmin = zmin = 1.0E6; rmax = zmax = -1.0E6; for(unsigned int i=0; i &a = Mmap[i]; float &r = a[0]; float &z = a[1]; rvals[r] = 1; zvals[z] = 1; if(rrmax)rmax=r; if(z>zmax)zmax=z; } Nr = rvals.size(); Nz = zvals.size(); r0 = rmin; z0 = zmin; dr = (rmax-rmin)/(double)(Nr-1); dz = (zmax-zmin)/(double)(Nz-1); cout<<"Nr="<rmin = rmin-dr/2.0; this->rmax = rmax+dr/2.0; this->zmin = zmin-dz/2.0; this->zmax = zmax+dz/2.0; // Set sizes of nested vectors to hold node data nodes.resize(Nr); for(int ir=0; ir &a = Mmap[i]; float &r = a[0]; float &z = a[1]; int ir = floor((r-this->rmin)/dr); int iz = floor((z-this->zmin)/dz); if(ir<0 || ir>=Nr){_DBG_<<"ir out of range: ir="<