Files Classes Functions Hierarchy
00001 #include <particleranvd.h> 00002 00003 00004 particleranvd::particleranvd 00005 ( 00006 doublec radius_, 00007 doublec vmax_, 00008 boxcollision const & box_ 00009 ) 00010 { 00011 radius = radius_; 00012 vmax = vmax_; 00013 box = box_; 00014 } 00015 00016 00017 void particleranvd::eval(particle & p) const 00018 { 00019 assert(radius!=0.0); 00020 assert(vmax!=0.0); 00021 00022 doublec t = 2.0*3.141592*r11(); 00023 doublec rad = vmax*r11(); 00024 p.vel[0] = rad*cos(t); 00025 p.vel[1] = rad*sin(t); 00026 00027 p.radius = radius; 00028 00029 randomposition(p); 00030 } 00031 00032 particlev0::particlev0 00033 ( 00034 doublec radius_, 00035 doublec vmax_, 00036 boxcollision const & box_ 00037 ) 00038 { 00039 radius = radius_; 00040 vmax = vmax_; 00041 box = box_; 00042 } 00043 00044 void particlev0::eval(particle & p) const 00045 { 00046 assert(radius!=0.0); 00047 assert(vmax!=0.0); 00048 00049 doublec t = 2.0*3.141592*r11(); 00050 doublec rad = vmax; 00051 p.vel[0] = rad*cos(t); 00052 p.vel[1] = rad*sin(t); 00053 00054 p.radius = radius; 00055 00056 randomposition(p); 00057 } 00058 00059 particlev0theta0::particlev0theta0 00060 ( 00061 doublec radius_, 00062 doublec vmax_, 00063 boxcollision const & box_ 00064 ) 00065 { 00066 radius = radius_; 00067 vmax = vmax_; 00068 box = box_; 00069 } 00070 00071 void particlev0theta0::eval(particle & p) const 00072 { 00073 assert(radius!=0.0); 00074 assert(vmax!=0.0); 00075 00076 doublec t = theta0; 00077 doublec rad = vmax; 00078 p.vel[0] = rad*cos(t); 00079 p.vel[1] = rad*sin(t); 00080 00081 p.radius = radius; 00082 00083 randomposition(p); 00084 } 00085 00086 00087 particlev0spaced::particlev0spaced 00088 ( 00089 doublec radius_, 00090 doublec vmax_, 00091 boxcollision const & box_ 00092 ) 00093 { 00094 radius = radius_; 00095 vmax = vmax_; 00096 box = box_; 00097 } 00098 00099 00100 void particlev0spaced::eval(particle & p) const 00101 { 00102 assert(radius!=0.0); 00103 assert(vmax!=0.0); 00104 00105 00106 double t = 2.0*3.141592*r11(); 00107 doublec rad = vmax; 00108 p.vel[0] = rad*cos(t); 00109 p.vel[1] = rad*sin(t); 00110 00111 p.radius = radius; 00112 00113 00114 // Even spaced algorithm 00115 00116 static uint c=0; 00117 00118 ++c; 00119 00120 uint k; 00121 uint n; 00122 00123 double sx(0.0); 00124 double sy(0.0); 00125 t=0.5; 00126 00127 for ( n=c; n!=0; n/=4 ) 00128 { 00129 k = n % 4; 00130 00131 switch (k) 00132 { 00133 case 0: 00134 break; 00135 case 1: 00136 sx += t; 00137 break; 00138 case 2: 00139 sx += t; 00140 sy += t; 00141 break; 00142 case 3: 00143 sy += t; 00144 } 00145 t *= .5; 00146 } 00147 00148 p.pos[0] = box.x0 + (box.x1-box.x0)*(sx+.1); 00149 p.pos[1] = box.y0 + (box.y1-box.y0)*(sy+.1); 00150 } 00151 00152 00153 00154 00155 00156
1.5.8