Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F83471555
brownian_movement_offlattice.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 17, 07:58
Size
1 KB
Mime Type
text/x-c++
Expires
Thu, Sep 19, 07:58 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20843936
Attached To
rDLMA Diffusion limited mixed aggregation
brownian_movement_offlattice.cpp
View Options
#include <brownian_movement_offlattice.hh>
namespace simulation{
template <typename type>
brownian_movement_offlattice<type>::brownian_movement_offlattice(int dim, int rng_seed){
D = dim;
dr = (type*)malloc(sizeof(type) * D);
for (int axis = 0; axis < D; axis++)
dr[axis] = 0;
generator.seed(rng_seed);
dis.param(std::uniform_real_distribution<double>::param_type(0.0, 1.0));
}
template <typename type>
type* brownian_movement_offlattice<type>::delta_x()
{
r2 = 0.;
for (int axis = 0; axis < D; axis++){
temp = -1. + 2. * dis(generator);
dr[axis] = temp;
r2 += temp * temp;
}
r2 = sqrt(r2);
for (int axis = 0; axis < D; axis++)
dr[axis] = dr[axis]/(1. * r2);
return dr;
}
template <typename type>
double brownian_movement_offlattice<type>::get_rand()
{ return dis(generator); }
template <typename type>
brownian_movement_offlattice<type>::~brownian_movement_offlattice()
{ free(dr); }
template class brownian_movement_offlattice<int>;
template class brownian_movement_offlattice<double>;
}
Event Timeline
Log In to Comment