SpherePackingScenarioGenerator
|
#include <Simulation.h>
Public Member Functions | |
void | AssignCells () |
double | CalculateCollision (int i, int j, tarch::la::Vector< DIM, double > pboffset) |
void | ChangeNgrids (int newngrids) |
int | CheckSphereDiameters () |
void | Collision (Event e) |
void | CollisionChecker (Event c) |
void | CreateSphere (int Ncurrent) |
void | CreateSpheres (double temp) |
double | Energy () |
void | findAllNeighbour (int i) |
void | findNearestNeighbor (int i, double *criteria) |
Event | FindNextCollision (int i) |
Event | FindNextEvent (int i) |
Event | FindNextTransfer (int i) |
void | ForAllNeighbors (int, tarch::la::Vector< DIM, int >, tarch::la::Vector< DIM, int >, Collisions &) |
double | getCollisionrate () const |
double | getEnergyChance () const |
double | getFraction () const |
void | GetInfo () |
int | getNumberGrids () const |
double | getPressure () const |
double | getRadius () const |
void | getSpheres (std::vector< algorithms::geometries::SphereGeometry > &spheres) const |
double | getTotalEvents () const |
void | growSphere () |
double | oneDimensionDistance (double r1, double r2) |
int | Optimalngrids () |
int | Optimalngrids2 (double maxr) |
void | OutputCells () |
void | OutputEvents () |
double | PackingFraction () |
void | PredictCollision (int i, int j, tarch::la::Vector< DIM, int > pboffset, double &ctime, int &cpartner, tarch::la::Vector< DIM, int > &cpartnerpboffset) |
void | PrintStatistics () |
void | Process (int n) |
void | ProcessEvent () |
double | QuadraticFormula (double a, double b, double c) |
void | ReadPositions (const char *filename) |
void | RecreateSpheres (const char *filename, double temp) |
void | RunTime () |
void | SetInitialEvents () |
Simulation (double Size_i, int N_i, double r_i, double growthrate_i, double maxpf_i, double various_i, std::vector< double > &array) | |
void | Synchronize (bool rescale) |
void | TrackPositions () |
void | Transfer (Event e) |
void | UpdateCell (int i, tarch::la::Vector< DIM, int > &celli) |
double | Velocity (double temp) |
void | VelocityGiver (double temp) |
void | WriteConfiguration (const char *wconfigfile) |
~Simulation () | |
Private Attributes | |
std::vector< double > & | _array |
double | _SIZE |
int * | binlist |
Cells< DIM, int > | cells |
double | collisionrate |
time_t | end |
double | energy |
double | energychange |
time_t | error |
double | growthrate |
double | gtime |
Heap | h |
double | maxpf |
const int | N |
int | nchecks |
int | ncollisions |
int | ncycles |
std::vector< Sphere > | neighbor |
int | nEventstot |
int | ngrids |
int | ntransfers |
double | pf |
double | pressure |
double | r |
double | rtime |
Sphere * | s |
time_t | start |
double | various_radius |
tarch::la::Vector< DIM, double > * | x |
double | xmomentum |
Class Simulation Fills Box with hardSpheres to given packing fraction and evolves Spheres using molecular dynamics!
algorithms::ls2::Simulation::Simulation | ( | double | Size_i, |
int | N_i, | ||
double | r_i, | ||
double | growthrate_i, | ||
double | maxpf_i, | ||
double | various_i, | ||
std::vector< double > & | array | ||
) |
Constructor
Destructor
Assign cells to Spheres read in from existing configuration
double algorithms::ls2::Simulation::CalculateCollision | ( | int | i, |
int | j, | ||
tarch::la::Vector< DIM, double > | pboffset | ||
) |
Calculates collision time between i and image of j using quadratic formula
void algorithms::ls2::Simulation::ChangeNgrids | ( | int | newngrids | ) |
Change ngrids
void algorithms::ls2::Simulation::Collision | ( | Event | e | ) |
Processes a collision
Checks Events of predicted collision partner to keep collisions symmetric
void algorithms::ls2::Simulation::CreateSphere | ( | int | Ncurrent | ) |
Creates a Sphere of radius r at a random unoccupied position
void algorithms::ls2::Simulation::CreateSpheres | ( | double | temp | ) |
Creates all N Spheres at random positions
double algorithms::ls2::Simulation::Energy | ( | ) |
Computes the total energy
void algorithms::ls2::Simulation::findAllNeighbour | ( | int | i | ) |
void algorithms::ls2::Simulation::findNearestNeighbor | ( | int | i, |
double * | criteria | ||
) |
Find next collision
Find next collision for Sphere i
void algorithms::ls2::Simulation::ForAllNeighbors | ( | int | i, |
tarch::la::Vector< DIM, int > | vl, | ||
tarch::la::Vector< DIM, int > | vr, | ||
Collisions & | operation | ||
) |
Find next collision for Sphere i
double algorithms::ls2::Simulation::getCollisionrate | ( | ) | const |
double algorithms::ls2::Simulation::getEnergyChance | ( | ) | const |
double algorithms::ls2::Simulation::getFraction | ( | ) | const |
void algorithms::ls2::Simulation::GetInfo | ( | ) |
Get information
int algorithms::ls2::Simulation::getNumberGrids | ( | ) | const |
double algorithms::ls2::Simulation::getPressure | ( | ) | const |
double algorithms::ls2::Simulation::getRadius | ( | ) | const |
void algorithms::ls2::Simulation::getSpheres | ( | std::vector< algorithms::geometries::SphereGeometry > & | spheres | ) | const |
Functions written by M. Lieb
double algorithms::ls2::Simulation::getTotalEvents | ( | ) | const |
Functions written by Tan
double algorithms::ls2::Simulation::oneDimensionDistance | ( | double | r1, |
double | r2 | ||
) |
Calculates the optimal ngrids
int algorithms::ls2::Simulation::Optimalngrids2 | ( | double | maxr | ) |
Calculates the optimal ngrids for the initial configuration and assumes that ngrids gets updated (reduced) as the packing proceeds
Output positions of Spheres and their cells...purely used for debugging
double algorithms::ls2::Simulation::PackingFraction | ( | ) |
Calculates the packing fraction
void algorithms::ls2::Simulation::PredictCollision | ( | int | i, |
int | j, | ||
tarch::la::Vector< DIM, int > | pboffset, | ||
double & | ctime, | ||
int & | cpartner, | ||
tarch::la::Vector< DIM, int > & | cpartnerpboffset | ||
) |
Find next collision for Sphere i
Prints statistics for n Events
void algorithms::ls2::Simulation::Process | ( | int | n | ) |
Processes n Events
Processes n Events
double algorithms::ls2::Simulation::QuadraticFormula | ( | double | a, |
double | b, | ||
double | c | ||
) |
Quadratic Formula ax^2 + bx + c = 0
void algorithms::ls2::Simulation::ReadPositions | ( | const char * | filename | ) |
ReadFile
void algorithms::ls2::Simulation::RecreateSpheres | ( | const char * | filename, |
double | temp | ||
) |
Recreates all N Spheres at random positions
void algorithms::ls2::Simulation::RunTime | ( | ) |
Run time
Finds next Events for all Spheres..do this once at beginning
void algorithms::ls2::Simulation::Synchronize | ( | bool | rescale | ) |
Updates Spheres to gtime, synchronizes, and can change growth rate
Update positions...purely for graphical display
void algorithms::ls2::Simulation::Transfer | ( | Event | e | ) |
Transfer, takes care of boundary Events too
void algorithms::ls2::Simulation::UpdateCell | ( | int | i, |
tarch::la::Vector< DIM, int > & | celli | ||
) |
Updates cell of a Sphere to time
double algorithms::ls2::Simulation::Velocity | ( | double | temp | ) |
Velocity, gives a single velocity from Max/Boltz dist.
void algorithms::ls2::Simulation::VelocityGiver | ( | double | temp | ) |
Velocity Giver, assigns initial velocities from Max/Boltz dist.
void algorithms::ls2::Simulation::WriteConfiguration | ( | const char * | wconfigfile | ) |
Write configuration
std::vector<double>& algorithms::ls2::Simulation::_array [private] |
double algorithms::ls2::Simulation::_SIZE [private] |
int* algorithms::ls2::Simulation::binlist [private] |
linked-list for cells array
Cells<DIM, int> algorithms::ls2::Simulation::cells [private] |
array that keeps track of spheres in each cell
double algorithms::ls2::Simulation::collisionrate [private] |
average rate of collision between spheres
time_t algorithms::ls2::Simulation::end [private] |
double algorithms::ls2::Simulation::energy [private] |
kinetic energy
double algorithms::ls2::Simulation::energychange [private] |
kinetic energy change
time_t algorithms::ls2::Simulation::error [private] |
double algorithms::ls2::Simulation::growthrate [private] |
growthrate of the spheres
double algorithms::ls2::Simulation::gtime [private] |
this is global clock
Heap algorithms::ls2::Simulation::h [private] |
Event heap
double algorithms::ls2::Simulation::maxpf [private] |
const int algorithms::ls2::Simulation::N [private] |
number of spheres
int algorithms::ls2::Simulation::nchecks [private] |
number of checks
int algorithms::ls2::Simulation::ncollisions [private] |
number of collisions
int algorithms::ls2::Simulation::ncycles [private] |
counts # cycles for output
std::vector<Sphere> algorithms::ls2::Simulation::neighbor [private] |
int algorithms::ls2::Simulation::nEventstot [private] |
total number of Events
int algorithms::ls2::Simulation::ngrids [private] |
number of cells in one direction
int algorithms::ls2::Simulation::ntransfers [private] |
number of transfers
double algorithms::ls2::Simulation::pf [private] |
packing fraction
double algorithms::ls2::Simulation::pressure [private] |
pressure
double algorithms::ls2::Simulation::r [private] |
radius, defined at gtime = 0
double algorithms::ls2::Simulation::rtime [private] |
reset time, total time = rtime + gtime
Sphere* algorithms::ls2::Simulation::s [private] |
array of spheres
time_t algorithms::ls2::Simulation::start [private] |
run time of program
double algorithms::ls2::Simulation::various_radius [private] |
tarch::la::Vector<DIM,double>* algorithms::ls2::Simulation::x [private] |
positions of spheres.used for graphics
double algorithms::ls2::Simulation::xmomentum [private] |
exchanged momentum