|
#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) |
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) |
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 |
void HGridOptimiser::applyStep | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
double | stepsize, | ||
int | verbosity | ||
) |
References constants::i, INFO, logger, NO_FLUSH, and VERBOSE.
Referenced by getOptimalDistribution(), and goldenSectionSearch().
void HGridOptimiser::calcDfDx | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
References calculateWork(), constants::i, INFO, logger, NO_FLUSH, and VERBOSE.
void HGridOptimiser::calculateDiffWork | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
References BOTTOMUP, cellCheckOverContactCheckRatio_, diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffPdfInt(), diffStartExpectedCellsIntegral(), dimension_, expectedCellsIntegral(), constants::i, INFO, length_, logger, NO_FLUSH, 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.
References BOTTOMUP, cellCheckOverContactCheckRatio_, dimension_, expectedCellsIntegral(), constants::i, INFO, length_, logger, NO_FLUSH, 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.
References constants::i, 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.
References constants::i, numCells_, rMax_, and rMin_.
Referenced by initialise(), and initialisePolyFunc().
double HGridOptimiser::checkLimit | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
int | verbosity | ||
) |
References constants::i, INFO, logger, NO_FLUSH, and VERBOSE.
Referenced by getOptimalDistribution().
References expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), constants::i, intCell2Max(), intCell2Min(), intCellN, and radius2IntCell().
Referenced by calculateDiffWork().
References diffHExpectedCellsIntegralCellNumerator(), expectedCellsIntegralCellDenominator(), constants::i, intCell2Max(), intCell2Min(), and radius2IntCell().
Referenced by calculateDiffWork().
double HGridOptimiser::diffHExpectedCellsIntegralCellNumerator | ( | double | start, |
double | end, | ||
unsigned int | i, | ||
int | p, | ||
double | h | ||
) |
References constants::i, intCell2Max(), intCell2Min(), and intCellN.
Referenced by diffHExpectedCellsIntegral().
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)
References constants::i, intCell2Max(), intCell2Min(), intCellN, numCells_, pdfIntCell(), and radius2IntCell().
Referenced by calculateDiffWork().
References expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), constants::i, intCell2Max(), intCell2Min(), intCellN, and radius2IntCell().
Referenced by calculateDiffWork().
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
References expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), constants::i, intCell2Max(), intCell2Min(), and radius2IntCell().
Referenced by calculateDiffWork(), and calculateWork().
double HGridOptimiser::expectedCellsIntegralCellDenominator | ( | double | start, |
double | end, | ||
unsigned int | i | ||
) |
References constants::i, 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 | ||
) |
References constants::i, intCell2Max(), intCell2Min(), and intCellN.
Referenced by diffEndExpectedCellsIntegral(), diffStartExpectedCellsIntegral(), and expectedCellsIntegral().
void HGridOptimiser::getOptimalDistribution | ( | std::vector< double > & | hGridCellSizes, |
unsigned int | numberOfLevels, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
References applyStep(), calculateDiffWork(), calculateWork(), checkLimit(), goldenSectionSearch(), constants::i, INFO, logger, NO_FLUSH, rMax_, and rMin_.
double HGridOptimiser::goldenSectionSearch | ( | std::vector< double > & | startHGridCellSizes, |
std::vector< double > & | searchDirection, | ||
double | min, | ||
double | cur, | ||
double | max, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
References applyStep(), calculateWork(), INFO, and logger.
Referenced by getOptimalDistribution().
void HGridOptimiser::histNumberParticlesPerCell | ( | std::vector< double > & | hGridCellSizes | ) |
References dimension_, mathsFunc::exp(), mathsFunc::factorial(), constants::i, INFO, length_, logger, NO_FLUSH, and pdfInt().
void HGridOptimiser::initialise | ( | const MercuryBase & | problem, |
unsigned int | numberOfCells, | ||
int | verbosity | ||
) |
References BaseHandler< T >::begin(), cell2Max(), cell2Min(), cellCheckOverContactCheckRatio_, cellN_, dimension_, BaseHandler< T >::end(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), BaseHandler< T >::getSize(), ParticleHandler::getSmallestParticle(), DPMBase::getSystemDimensions(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getYMin(), DPMBase::getZMax(), DPMBase::getZMin(), constants::i, INFO, intCell2Max(), intCell2Min(), intCellN, length_, logger, NO_FLUSH, numCells_, DPMBase::particleHandler, radius2Cell(), rMax_, and rMin_.
void HGridOptimiser::initialisePolyFunc | ( | double | omega, |
std::vector< double > & | coeff, | ||
unsigned int | numberOfCells, | ||
int | verbosity | ||
) |
References cell2Max(), cell2Min(), cellCheckOverContactCheckRatio_, cellN_, dimension_, constants::i, INFO, intCell2Max(), intCell2Min(), intCellN, length_, logger, NO_FLUSH, numCells_, rMax_, and rMin_.
double HGridOptimiser::intCell2Max | ( | unsigned int | i | ) |
References constants::i, 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 | ) |
References constants::i, numCells_, rMax_, and rMin_.
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffHExpectedCellsIntegralCellNumerator(), diffPdfInt(), diffStartExpectedCellsIntegral(), expectedCellsIntegral(), expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), initialise(), initialisePolyFunc(), pdfInt(), and pdfIntCell().
This function calculates: int(f(r)*r^power*dr,r=start..end)/int(f(r)*dr,r=0..omega) with r=a*r+b
References constants::i, intCell2Max(), intCell2Min(), numCells_, pdfIntCell(), and radius2IntCell().
Referenced by calculateDiffWork(), calculateWork(), and histNumberParticlesPerCell().
References constants::i, 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.
References ERROR, logger, numCells_, rMax_, and rMin_.
Referenced by initialise().
unsigned int HGridOptimiser::radius2IntCell | ( | double | r | ) |
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.
Referenced by calculateDiffWork(), calculateWork(), initialise(), and initialisePolyFunc().
|
private |
Referenced by initialise(), and initialisePolyFunc().
|
private |
The dimension of the system, usually 3, sometimes 2 or 1.
Referenced by calculateDiffWork(), calculateWork(), histNumberParticlesPerCell(), initialise(), and initialisePolyFunc().
|
private |
|
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).
Referenced by calculateDiffWork(), calculateWork(), histNumberParticlesPerCell(), initialise(), and initialisePolyFunc().
|
private |
Number of cells, usually called levels in the HGrid.
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.
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.
Referenced by cell2Max(), cell2Min(), getOptimalDistribution(), initialise(), initialisePolyFunc(), intCell2Max(), intCell2Min(), radius2Cell(), and radius2IntCell().