Created
August 29, 2011 17:55
-
-
Save hdclark/1178953 to your computer and use it in GitHub Desktop.
My Einspline test program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cmath> | |
| #include "einspline/bspline.h" | |
| // | |
| //Compiled with: g++ -L/usr/local/include -leinspline Spline_test.cc -o spline | |
| // | |
| // NOTE: if using a 32-bit computer, compile with the '-malign-double' flag. | |
| // | |
| int main(){ | |
| BCtype_d x_BC, y_BC, z_BC; //Boundary conditions. | |
| x_BC.lCode = y_BC.lCode = z_BC.lCode = NATURAL; | |
| x_BC.rCode = y_BC.rCode = z_BC.rCode = NATURAL; | |
| // Do I need to set the lVal and rVal ? It is not done ((I think)) in qmcpack source. | |
| // x_Boundary_Cond.lVal = SINGLE_REAL; //'s'; | |
| // x_Boundary_Cond.rVal = SINGLE_REAL; //'s'; | |
| /* DEFINITION: | |
| typedef struct | |
| { | |
| double start, end; | |
| int num; | |
| // private | |
| double delta, delta_inv; | |
| } Ugrid; | |
| */ | |
| Ugrid x_mi, y_mi, z_mi; //Meta info about the data we are sending in. | |
| x_mi.num = 10; y_mi.num = 10; z_mi.num = 10; | |
| x_mi.start = 0.0; y_mi.start = 0.0; z_mi.start = 0.0; | |
| x_mi.end = 1.0; y_mi.end = 1.0; z_mi.end = 1.0; | |
| // Do I need to set the 'delta' and 'delta_inv' values? | |
| // meta_info.delta = 1.0; | |
| // meta_info.delta_inv = 1.0; | |
| double data[100*100*100]; | |
| size_t i; | |
| for(i=0; i<100*100*100; ++i) data[i] = 0.0; //sin( fmod( static_cast<double>(i), 2.0*M_PI ) ); | |
| UBspline_3d_d *Spline = create_UBspline_3d_d( x_mi, y_mi, z_mi, x_BC, y_BC, z_BC, data); | |
| // Others methods: | |
| // UBspline_1d_s *My_Spline = create_UBspline_1d_s( meta_info, x_Boundary_Cond, data); //, z_grid, xBC, yBC, zBC, realData.data()); | |
| // UBspline_1d_s *My_Spline = create_UBspline_1d_s( meta_info, x_Boundary_Cond, &data[0]); | |
| // BsplineClass_3d_d *Bspline; | |
| // Bspline = new UBsplineClass_3d_d( x_mi, y_mi, z_mi, x_BC, y_BC, z_BC, &data); //uMin, uMax, xBC, yBC, zBC, realData); | |
| // Bspline = new NUBsplineClass_3d_d (uMin, uMax, clusterfactor, xBC, yBC, zBC, realData); | |
| // UBspline_1d_s * create_UBspline_1d_s (Ugrid x_grid, BCtype_s xBC, float *data); | |
| std::cout << "Made it past the BSpline creation." << std::endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment