MercuryDPM
Alpha
|
#include <HGridOptimiser.h>
Public Member Functions | |
void | initialise (const MercuryBase &problem, unsigned int numberOfCells, int verbosity) |
void | initialisePolyFunc (double omega, std::vector< double > &coeff, unsigned int numberOfCells, int verbosity) |
unsigned int | radius2Cell (double r) |
Assigns a BaseParticle of given radius to a certain cell. More... | |
unsigned int | radius2IntCell (double r) |
double | intCell2Min (unsigned int i) |
double | intCell2Max (unsigned int i) |
double | cell2Min (unsigned int i) |
Computes the left bound of the cell with given ordinal number. More... | |
double | cell2Max (unsigned int i) |
Computes the right bound of the cell with given ordinal number. More... | |
double | pdfIntCell (double start, double end, unsigned int i, int p) |
double | pdfInt (double start, double end, int power) |
This function calculates: int(f(r)*r^power*dr,r=start..end)/int(f(r)*dr,r=0..omega) with r=a*r+b. More... | |
double | diffPdfInt (double x, int power) |
diff(int(f(r)*r^power*dr,r=s..e)/int(f(r)*dr,r=0..omega),e)=f(e)*e^power/int(f(r)*dr,r=0..omega) More... | |
double | expectedCellsIntegralCellNumerator (double start, double end, unsigned int i, int p, double h) |
double | diffHExpectedCellsIntegralCellNumerator (double start, double end, unsigned int i, int p, double h) |
double | expectedCellsIntegralCellDenominator (double start, double end, unsigned int i) |
double | expectedCellsIntegral (double start, double end, int p, double h) |
This function calculates: int((2*r/h+2)^d f(r) dr,r=s..e)/int(f(r) dr,r=s..e)+ Used to calculated the expected number of cells to check at the level with maximum size h for particle radius between start and end. More... | |
double | diffStartExpectedCellsIntegral (double start, double end, int p, double h) |
double | diffEndExpectedCellsIntegral (double start, double end, int p, double h) |
double | diffHExpectedCellsIntegral (double start, double end, int p, double h) |
double | calculateWork (std::vector< double > &hGridCellSizes, HGridMethod method, int verbosity) |
The amount of work that has to be done to run a simulation using the HGrid, in steps. More... | |
void | calculateDiffWork (std::vector< double > &hGridCellSizes, std::vector< double > &dfdx, HGridMethod method, int verbosity) |
void | calcDfDx (std::vector< double > &hGridCellSizes, std::vector< double > &dfdx, HGridMethod method, int verbosity) |
double | checkLimit (std::vector< double > &hGridCellSizes, std::vector< double > &dfdx, int verbosity) |
void | applyStep (std::vector< double > &hGridCellSizes, std::vector< double > &dfdx, double stepsize, int verbosity) |
double | goldenSectionSearch (std::vector< double > &startHGridCellSizes, std::vector< double > &searchDirection, double min, double cur, double max, HGridMethod method, int verbosity) |
void | getOptimalDistribution (std::vector< double > &hGridCellSizes, unsigned int numberOfLevels, HGridMethod method, int verbosity) |
void | histNumberParticlesPerCell (std::vector< double > &hGridCellSizes) |
Private Attributes | |
unsigned int | numCells_ |
Number of cells, usually called levels in the HGrid. More... | |
double | rMin_ |
Radius of the smallest particle, "rounded" to the largest double that is smaller than the radius of each particle. More... | |
double | rMax_ |
Radius of the largest particle, "rounded" to the smallest double that is larger than the radius of each particle. More... | |
double | length_ |
The weighted length of the domain. More... | |
double | cellCheckOverContactCheckRatio_ |
The ratio of the time required for a single geometric contact detection over the time required to retrieve information from a cell. This seems to be only used for checking the effort required by the HGrid, not to compute the cell sizes. More... | |
unsigned int | dimension_ |
The dimension of the system, usually 3, sometimes 2 or 1. More... | |
std::vector< double > | cellN_ |
std::vector< double > | intCellN |
Definition at line 36 of file HGridOptimiser.h.
void HGridOptimiser::applyStep | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
double | stepsize, | ||
int | verbosity | ||
) |
Definition at line 924 of file HGridOptimiser.cc.
Referenced by getOptimalDistribution(), and goldenSectionSearch().
void HGridOptimiser::calcDfDx | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
Definition at line 838 of file HGridOptimiser.cc.
References calculateWork().
void HGridOptimiser::calculateDiffWork | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
Definition at line 437 of file HGridOptimiser.cc.
References BOTTOMUP, cellCheckOverContactCheckRatio_, diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffPdfInt(), diffStartExpectedCellsIntegral(), dimension_, expectedCellsIntegral(), length_, pdfInt(), and TOPDOWN.
Referenced by getOptimalDistribution().
double HGridOptimiser::calculateWork | ( | std::vector< double > & | hGridCellSizes, |
HGridMethod | method, | ||
int | verbosity | ||
) |
The amount of work that has to be done to run a simulation using the HGrid, in steps.
Definition at line 689 of file HGridOptimiser.cc.
References BOTTOMUP, cellCheckOverContactCheckRatio_, dimension_, expectedCellsIntegral(), length_, pdfInt(), and TOPDOWN.
Referenced by calcDfDx(), getOptimalDistribution(), and goldenSectionSearch().
double HGridOptimiser::cell2Max | ( | unsigned int | i | ) |
Computes the right bound of the cell with given ordinal number.
Computes the right bound of the cell with given ordinal number.
Definition at line 199 of file HGridOptimiser.cc.
References numCells_, rMax_, and rMin_.
Referenced by initialise(), and initialisePolyFunc().
double HGridOptimiser::cell2Min | ( | unsigned int | i | ) |
Computes the left bound of the cell with given ordinal number.
Computes the left bound of the cell with given ordinal number.
Definition at line 191 of file HGridOptimiser.cc.
References numCells_, rMax_, and rMin_.
Referenced by initialise(), and initialisePolyFunc().
double HGridOptimiser::checkLimit | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
int | verbosity | ||
) |
Definition at line 861 of file HGridOptimiser.cc.
Referenced by getOptimalDistribution().
double HGridOptimiser::diffEndExpectedCellsIntegral | ( | double | start, |
double | end, | ||
int | p, | ||
double | h | ||
) |
Definition at line 372 of file HGridOptimiser.cc.
References expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), intCell2Max(), intCell2Min(), intCellN, and radius2IntCell().
Referenced by calculateDiffWork().
double HGridOptimiser::diffHExpectedCellsIntegral | ( | double | start, |
double | end, | ||
int | p, | ||
double | h | ||
) |
Definition at line 409 of file HGridOptimiser.cc.
References diffHExpectedCellsIntegralCellNumerator(), expectedCellsIntegralCellDenominator(), intCell2Max(), intCell2Min(), and radius2IntCell().
Referenced by calculateDiffWork().
double HGridOptimiser::diffHExpectedCellsIntegralCellNumerator | ( | double | start, |
double | end, | ||
unsigned int | i, | ||
int | p, | ||
double | h | ||
) |
Definition at line 276 of file HGridOptimiser.cc.
References intCell2Max(), intCell2Min(), and intCellN.
Referenced by diffHExpectedCellsIntegral().
double HGridOptimiser::diffPdfInt | ( | double | x, |
int | power | ||
) |
diff(int(f(r)*r^power*dr,r=s..e)/int(f(r)*dr,r=0..omega),e)=f(e)*e^power/int(f(r)*dr,r=0..omega)
Definition at line 251 of file HGridOptimiser.cc.
References intCell2Max(), intCell2Min(), intCellN, numCells_, pdfIntCell(), and radius2IntCell().
Referenced by calculateDiffWork().
double HGridOptimiser::diffStartExpectedCellsIntegral | ( | double | start, |
double | end, | ||
int | p, | ||
double | h | ||
) |
Definition at line 335 of file HGridOptimiser.cc.
References expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), intCell2Max(), intCell2Min(), intCellN, and radius2IntCell().
Referenced by calculateDiffWork().
double HGridOptimiser::expectedCellsIntegral | ( | double | start, |
double | end, | ||
int | p, | ||
double | h | ||
) |
This function calculates: int((2*r/h+2)^d f(r) dr,r=s..e)/int(f(r) dr,r=s..e)+ Used to calculated the expected number of cells to check at the level with maximum size h for particle radius between start and end.
Definition at line 305 of file HGridOptimiser.cc.
References expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), intCell2Max(), intCell2Min(), and radius2IntCell().
Referenced by calculateDiffWork(), and calculateWork().
double HGridOptimiser::expectedCellsIntegralCellDenominator | ( | double | start, |
double | end, | ||
unsigned int | i | ||
) |
Definition at line 294 of file HGridOptimiser.cc.
References intCell2Max(), intCell2Min(), and intCellN.
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffStartExpectedCellsIntegral(), and expectedCellsIntegral().
double HGridOptimiser::expectedCellsIntegralCellNumerator | ( | double | start, |
double | end, | ||
unsigned int | i, | ||
int | p, | ||
double | h | ||
) |
Definition at line 264 of file HGridOptimiser.cc.
References intCell2Max(), intCell2Min(), and intCellN.
Referenced by diffEndExpectedCellsIntegral(), diffStartExpectedCellsIntegral(), and expectedCellsIntegral().
void HGridOptimiser::getOptimalDistribution | ( | std::vector< double > & | hGridCellSizes, |
unsigned int | numberOfLevels, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
Definition at line 998 of file HGridOptimiser.cc.
References applyStep(), calculateDiffWork(), calculateWork(), checkLimit(), goldenSectionSearch(), rMax_, and rMin_.
double HGridOptimiser::goldenSectionSearch | ( | std::vector< double > & | startHGridCellSizes, |
std::vector< double > & | searchDirection, | ||
double | min, | ||
double | cur, | ||
double | max, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
Definition at line 940 of file HGridOptimiser.cc.
References applyStep(), and calculateWork().
Referenced by getOptimalDistribution().
void HGridOptimiser::histNumberParticlesPerCell | ( | std::vector< double > & | hGridCellSizes | ) |
Definition at line 1050 of file HGridOptimiser.cc.
References dimension_, mathsFunc::exp(), mathsFunc::factorial(), length_, and pdfInt().
void HGridOptimiser::initialise | ( | const MercuryBase & | problem, |
unsigned int | numberOfCells, | ||
int | verbosity | ||
) |
Definition at line 33 of file HGridOptimiser.cc.
References BaseHandler< T >::begin(), cell2Max(), cell2Min(), cellCheckOverContactCheckRatio_, cellN_, dimension_, BaseHandler< T >::end(), BaseParticle::getInteractionRadius(), ParticleHandler::getLargestParticle(), BaseHandler< T >::getNumberOfObjects(), ParticleHandler::getSmallestParticle(), DPMBase::getSystemDimensions(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getYMin(), DPMBase::getZMax(), DPMBase::getZMin(), intCell2Max(), intCell2Min(), intCellN, length_, numCells_, DPMBase::particleHandler, radius2Cell(), rMax_, and rMin_.
void HGridOptimiser::initialisePolyFunc | ( | double | omega, |
std::vector< double > & | coeff, | ||
unsigned int | numberOfCells, | ||
int | verbosity | ||
) |
Definition at line 102 of file HGridOptimiser.cc.
References cell2Max(), cell2Min(), cellCheckOverContactCheckRatio_, cellN_, dimension_, intCell2Max(), intCell2Min(), intCellN, length_, numCells_, rMax_, and rMin_.
double HGridOptimiser::intCell2Max | ( | unsigned int | i | ) |
Definition at line 180 of file HGridOptimiser.cc.
References numCells_, rMax_, and rMin_.
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffHExpectedCellsIntegralCellNumerator(), diffPdfInt(), diffStartExpectedCellsIntegral(), expectedCellsIntegral(), expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), initialise(), initialisePolyFunc(), pdfInt(), and pdfIntCell().
double HGridOptimiser::intCell2Min | ( | unsigned int | i | ) |
Definition at line 172 of file HGridOptimiser.cc.
References numCells_, rMax_, and rMin_.
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffHExpectedCellsIntegralCellNumerator(), diffPdfInt(), diffStartExpectedCellsIntegral(), expectedCellsIntegral(), expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), initialise(), initialisePolyFunc(), pdfInt(), and pdfIntCell().
double HGridOptimiser::pdfInt | ( | double | start, |
double | end, | ||
int | power | ||
) |
This function calculates: int(f(r)*r^power*dr,r=start..end)/int(f(r)*dr,r=0..omega) with r=a*r+b.
Definition at line 214 of file HGridOptimiser.cc.
References intCell2Max(), intCell2Min(), numCells_, pdfIntCell(), and radius2IntCell().
Referenced by calculateDiffWork(), calculateWork(), and histNumberParticlesPerCell().
double HGridOptimiser::pdfIntCell | ( | double | start, |
double | end, | ||
unsigned int | i, | ||
int | p | ||
) |
Definition at line 204 of file HGridOptimiser.cc.
References intCell2Max(), intCell2Min(), and intCellN.
Referenced by diffPdfInt(), and pdfInt().
unsigned int HGridOptimiser::radius2Cell | ( | double | r | ) |
Assigns a BaseParticle of given radius to a certain cell.
Assigns a cell to a BaseParticle with the given radius. Note that the index of the cells are linear in the radius of a particle. For example, if numCells_ = 10 and we are looking in the radius range [0,10], than the cell number of the particle with radius r is the number r rounded down to an integer.
Definition at line 156 of file HGridOptimiser.cc.
References ERROR, logger, numCells_, rMax_, and rMin_.
Referenced by initialise().
unsigned int HGridOptimiser::radius2IntCell | ( | double | r | ) |
Definition at line 164 of file HGridOptimiser.cc.
References numCells_, rMax_, and rMin_.
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffPdfInt(), diffStartExpectedCellsIntegral(), expectedCellsIntegral(), and pdfInt().
|
private |
The ratio of the time required for a single geometric contact detection over the time required to retrieve information from a cell. This seems to be only used for checking the effort required by the HGrid, not to compute the cell sizes.
Definition at line 198 of file HGridOptimiser.h.
Referenced by calculateDiffWork(), calculateWork(), initialise(), and initialisePolyFunc().
|
private |
Definition at line 207 of file HGridOptimiser.h.
Referenced by initialise(), and initialisePolyFunc().
|
private |
The dimension of the system, usually 3, sometimes 2 or 1.
Definition at line 202 of file HGridOptimiser.h.
Referenced by calculateDiffWork(), calculateWork(), histNumberParticlesPerCell(), initialise(), and initialisePolyFunc().
|
private |
Definition at line 208 of file HGridOptimiser.h.
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegralCellNumerator(), diffPdfInt(), diffStartExpectedCellsIntegral(), expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), initialise(), initialisePolyFunc(), and pdfIntCell().
|
private |
The weighted length of the domain.
The weighted length is computed by multiplying the lengths of all directions with each other, and then taking the appropriate type of root so that the unit is the same as that of a length (square root for 2D, cube root for 3D).
Definition at line 191 of file HGridOptimiser.h.
Referenced by calculateDiffWork(), calculateWork(), histNumberParticlesPerCell(), initialise(), and initialisePolyFunc().
|
private |
Number of cells, usually called levels in the HGrid.
Definition at line 173 of file HGridOptimiser.h.
Referenced by cell2Max(), cell2Min(), diffPdfInt(), initialise(), initialisePolyFunc(), intCell2Max(), intCell2Min(), pdfInt(), radius2Cell(), and radius2IntCell().
|
private |
Radius of the largest particle, "rounded" to the smallest double that is larger than the radius of each particle.
Definition at line 183 of file HGridOptimiser.h.
Referenced by cell2Max(), cell2Min(), getOptimalDistribution(), initialise(), initialisePolyFunc(), intCell2Max(), intCell2Min(), radius2Cell(), and radius2IntCell().
|
private |
Radius of the smallest particle, "rounded" to the largest double that is smaller than the radius of each particle.
Definition at line 178 of file HGridOptimiser.h.
Referenced by cell2Max(), cell2Min(), getOptimalDistribution(), initialise(), initialisePolyFunc(), intCell2Max(), intCell2Min(), radius2Cell(), and radius2IntCell().