sandbox/magfield/src
--- sandbox/magfield/src/OneDimOneComponentMagneticFieldMap_t.cpp 2014-04-04 21:13:31 UTC (rev 3085)
+++ sandbox/magfield/src/OneDimOneComponentMagneticFieldMap_t.cpp 2014-04-04 21:16:00 UTC (rev 3086)
@@ -8,25 +8,25 @@
int main ()
{
-
- // read in the field and find how many entries we have
- ifstream inFile( "C:/work/svn/sandbox/magfield/src/HPS_b18d36_By_0_0_z.dat" ); // Open the file for reading.
- const int dim = count(istreambuf_iterator<char>(inFile),
- istreambuf_iterator<char>(), '\n');
- inFile.seekg(0);
-
- double* z = new double[dim];
- double* By = new double[dim];
- for(int i=0; i<dim; ++i)
- {
- inFile >> z[i] >> By[i];
- }
- double zmin = z[0];
- double zmax = z[dim-1];
-
+ // read in the field and find how many entries we have
+ ifstream inFile( "C:/work/svn/sandbox/magfield/src/HPS_b18d36_By_0_0_z.dat" ); // Open the file for reading.
+ const int dim = count(istreambuf_iterator<char>(inFile),
+ istreambuf_iterator<char>(), '\n');
+ inFile.seekg(0);
+ double* z = new double[dim];
+ double* By = new double[dim];
+ for(int i=0; i<dim; ++i)
+ {
+ inFile >> z[i] >> By[i];
+ }
+ double zmin = z[0];
+ double zmax = z[dim-1];
+
+
+
OneDimOneComponentMagneticFieldMap::BVAL val = OneDimOneComponentMagneticFieldMap::BVAL::BX;
OneDimOneComponentMagneticFieldMap::COORDINATE coord = OneDimOneComponentMagneticFieldMap::COORDINATE::Z;
@@ -47,113 +47,9 @@
if(abs(B[val]-By[i]) >= epsilon ) cout << B[val] << " " << By[i] << endl;
assert( abs(B[val]-By[i]) < epsilon );
}
- //
- // // read in the field and find how many entries we have
- // ifstream inFile( "C:/work/svn/sandbox/magfield/src/HPS_b18d36_By_0_0_z.dat" ); // Open the file for reading.
- // const int dim = count(istreambuf_iterator<char>(inFile),
- // istreambuf_iterator<char>(), '\n');
- // inFile.seekg(0);
- //
- // double* z = new double[dim];
- // double* By = new double[dim];
- // double zmin = 0;
- // double zmax = 0;
- // for(int i=0; i<dim; ++i)
- // {
- // inFile >> z[i] >> By[i];
- // }
- //
- // int i;
- // int j;
- // int jhi;
- // char mark;
- // int nsample = 10;
- // double pi = 3.141592653589793;
- // double* tdata = new double[dim];
- //
- // double thi;
- // double tlo;
- // double tval;
- // double* ydata = new double[dim];
- // double yval;
- //
- // cout << "\n";
- // cout << "TEST13\n";
- // cout << " SPLINE_B_VAL evaluates the\n";
- // cout << " B spline.\n";
- // cout << "\n";
- // cout << " TDATA YDATA\n";
- // cout << "\n";
- //
- // for ( i = 0; i < dim; i++ )
- // {
- // tdata[i] = z[i];
- // ydata[i] = By[i];
- // cout << setw(12) << tdata[i] << " "
- // << setw(12) << ydata[i] << "\n";
- // }
- //
- // cout << "\n" ;
- // cout << " T, Spline(T)\n";
- // cout << "\n";
- //
- // for ( i = 0; i <= dim; i++ )
- // {
- // if ( i == 0 )
- // {
- // tlo = tdata[1] - 0.5 * ( tdata[1] - tdata[0] );
- // thi = tdata[0];
- // }
- // else if ( i < dim )
- // {
- // tlo = tdata[i-1];
- // thi = tdata[i];
- // }
- // else if ( dim <= i )
- // {
- // tlo = tdata[dim-1];
- // thi = tdata[dim-1] + 0.5 * ( tdata[dim-1] - tdata[dim-2] );
- // }
- //
- // if ( i < dim )
- // {
- // jhi = nsample - 1;
- // }
- // else
- // {
- // jhi = nsample;
- // }
- //
- // for ( j = 0; j <= jhi; j++ )
- // {
- // tval = ( ( double ) ( nsample - j ) * tlo
- // + ( double ) ( j ) * thi )
- // / ( double ) ( nsample );
- //
- // yval = spline_b_val ( dim, tdata, ydata, tval );
- //
- // //if ( 0 < i && j == 0 )
- // //{
- // // mark = '*';
- // //}
- // //else
- // //{
- // mark = ' ';
- // //}
- //
- // cout << " "
- // << mark << " "
- // << setw(12) << tval << " "
- // << setw(12) << yval << "\n";
- //
- // }
- //
- // }
- //
- //
- ////%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ////clean up
- // delete[] z;
- // delete[] By;
+
+ //clean up
+ delete[] z;
+ delete[] By;
return 0;
}