Files Classes Functions Hierarchy
00001 00002 00003 #include <iostream> 00004 #include <fstream> 00005 using namespace std; 00006 00007 #include <point.h> 00008 00009 #include <d3func.h> 00010 #include <d3sphere.h> 00011 00012 #include <rand.h> 00013 00014 00015 00016 typedef point3<double> pt3; 00017 00018 typedef unsigned int uint; 00019 typedef unsigned int const uintc; 00020 00021 00022 00023 d3func * p3dfunc = new d3sphere(pt3(),0.6); 00024 00025 00026 void d3writefile(string const name, uintc n) 00027 { 00028 ofstream f1(name.c_str()); 00029 00030 random11<double> r; 00031 00032 f1 << n << endl; 00033 for (uint i=0; i<n; ++i) 00034 { 00035 pt3 x(-1.0+2.0*r(),-1.0+2.0*r(),-1.0+2.0*r()); 00036 f1 << x << " " << p3dfunc->eval(x) << endl; 00037 } 00038 00039 } 00040 00041 void test01() 00042 { 00043 cout << "Utiltiy program: Generating files of data points." << endl; 00044 cout << "Enter the number of points n: "; 00045 uint n; 00046 cin >> n; 00047 cout << "Enter the file name: "; 00048 string name; 00049 cin >> name; 00050 00051 d3writefile(name,n); 00052 } 00053 00054 void test02() 00055 { 00056 cout << "Generating Test files increasing in powers of two." << endl; 00057 00058 d3writefile("data0",50); 00059 d3writefile("data1",100); 00060 d3writefile("data2",200); 00061 d3writefile("data3",400); 00062 d3writefile("data4",800); 00063 d3writefile("data5",1600); 00064 d3writefile("data6",3200); 00065 } 00066 00067 00068 int main(int argc, char** argv) 00069 { 00070 00071 test01(); 00072 00073 return 0; 00074 } 00075
1.5.8