![]() |
|
#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 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(), e(), i, INFO, logger, NO_FLUSH, VERBOSE, and oomph::QuadTreeNames::W.
void HGridOptimiser::calculateDiffWork | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
References BOTTOMUP, cellCheckOverContactCheckRatio_, diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffPdfInt(), diffStartExpectedCellsIntegral(), dimension_, expectedCellsIntegral(), i, INFO, j, k, length_, logger, NO_FLUSH, pdfInt(), Eigen::bfloat16_impl::pow(), 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(), i, INFO, j, length_, logger, NO_FLUSH, pdfInt(), Eigen::bfloat16_impl::pow(), and TOPDOWN.
Referenced by calcDfDx(), getOptimalDistribution(), and goldenSectionSearch().
Computes the right bound of the cell with given ordinal number.
Computes the right bound of the cell with given ordinal number.
References i, numCells_, rMax_, and rMin_.
Referenced by initialise(), and initialisePolyFunc().
double HGridOptimiser::checkLimit | ( | std::vector< double > & | hGridCellSizes, |
std::vector< double > & | dfdx, | ||
int | verbosity | ||
) |
References a, b, Eigen::placeholders::end, expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), i, intCell2Max(), intCell2Min(), intCellN, p, Eigen::bfloat16_impl::pow(), radius2IntCell(), and oomph::CumulativeTimings::start().
Referenced by calculateDiffWork().
References diffHExpectedCellsIntegralCellNumerator(), Eigen::placeholders::end, expectedCellsIntegralCellDenominator(), i, intCell2Max(), intCell2Min(), p, radius2IntCell(), and oomph::CumulativeTimings::start().
Referenced by calculateDiffWork().
double HGridOptimiser::diffHExpectedCellsIntegralCellNumerator | ( | double | start, |
double | end, | ||
unsigned int | i, | ||
int | p, | ||
double | h | ||
) |
References a, b, Eigen::placeholders::end, i, intCell2Max(), intCell2Min(), intCellN, min, p, Eigen::bfloat16_impl::pow(), UniformPSDSelfTest::r, and oomph::CumulativeTimings::start().
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 a, b, i, intCell2Max(), intCell2Min(), intCellN, numCells_, p, pdfIntCell(), Eigen::bfloat16_impl::pow(), radius2IntCell(), and plotDoE::x.
Referenced by calculateDiffWork().
References a, b, Eigen::placeholders::end, expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), i, intCell2Max(), intCell2Min(), intCellN, p, Eigen::bfloat16_impl::pow(), radius2IntCell(), and oomph::CumulativeTimings::start().
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 Eigen::placeholders::end, expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), i, intCell2Max(), intCell2Min(), p, radius2IntCell(), and oomph::CumulativeTimings::start().
Referenced by calculateDiffWork(), and calculateWork().
double HGridOptimiser::expectedCellsIntegralCellDenominator | ( | double | start, |
double | end, | ||
unsigned int | i | ||
) |
References a, b, Eigen::placeholders::end, i, intCell2Max(), intCell2Min(), intCellN, Eigen::bfloat16_impl::pow(), and oomph::CumulativeTimings::start().
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffStartExpectedCellsIntegral(), and expectedCellsIntegral().
double HGridOptimiser::expectedCellsIntegralCellNumerator | ( | double | start, |
double | end, | ||
unsigned int | i, | ||
int | p, | ||
double | h | ||
) |
References a, b, Eigen::placeholders::end, i, intCell2Max(), intCell2Min(), intCellN, min, p, Eigen::bfloat16_impl::pow(), UniformPSDSelfTest::r, and oomph::CumulativeTimings::start().
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(), e(), goldenSectionSearch(), i, INFO, logger, max, NO_FLUSH, rMax_, rMin_, and oomph::QuadTreeNames::W.
double HGridOptimiser::goldenSectionSearch | ( | std::vector< double > & | startHGridCellSizes, |
std::vector< double > & | searchDirection, | ||
double | min, | ||
double | cur, | ||
double | max, | ||
HGridMethod | method, | ||
int | verbosity | ||
) |
References abs(), applyStep(), calculateWork(), e(), INFO, logger, max, min, sqrt(), and plotDoE::x.
Referenced by getOptimalDistribution().
void HGridOptimiser::histNumberParticlesPerCell | ( | std::vector< double > & | hGridCellSizes | ) |
References dimension_, Eigen::bfloat16_impl::exp(), mathsFunc::factorial(), Eigen::bfloat16_impl::floor(), i, INFO, k, length_, logger, NO_FLUSH, pdfInt(), and Eigen::bfloat16_impl::pow().
void HGridOptimiser::initialise | ( | const MercuryBase & | problem, |
unsigned int | numberOfCells, | ||
int | verbosity | ||
) |
References cell2Max(), cell2Min(), cellCheckOverContactCheckRatio_, cellN_, dimension_, i, INFO, intCell2Max(), intCell2Min(), intCellN, length_, logger, max, Eigen::numext::nextafter(), NO_FLUSH, numCells_, Eigen::bfloat16_impl::pow(), problem, radius2Cell(), rMax_, and rMin_.
void HGridOptimiser::initialisePolyFunc | ( | double | omega, |
std::vector< double > & | coeff, | ||
unsigned int | numberOfCells, | ||
int | verbosity | ||
) |
References cell2Max(), cell2Min(), cellCheckOverContactCheckRatio_, cellN_, dimension_, Eigen::placeholders::end, i, INFO, intCell2Max(), intCell2Min(), intCellN, j, length_, logger, max, Eigen::numext::nextafter(), NO_FLUSH, numCells_, Eigen::internal::omega(), Eigen::bfloat16_impl::pow(), rMax_, rMin_, and oomph::CumulativeTimings::start().
References i, numCells_, rMax_, and rMin_.
Referenced by diffEndExpectedCellsIntegral(), diffHExpectedCellsIntegral(), diffHExpectedCellsIntegralCellNumerator(), diffPdfInt(), diffStartExpectedCellsIntegral(), expectedCellsIntegral(), expectedCellsIntegralCellDenominator(), expectedCellsIntegralCellNumerator(), initialise(), initialisePolyFunc(), pdfInt(), and pdfIntCell().
References 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 Eigen::placeholders::end, i, intCell2Max(), intCell2Min(), numCells_, p, pdfIntCell(), radius2IntCell(), and oomph::CumulativeTimings::start().
Referenced by calculateDiffWork(), calculateWork(), and histNumberParticlesPerCell().
References a, b, Eigen::placeholders::end, i, intCell2Max(), intCell2Min(), intCellN, p, Eigen::bfloat16_impl::pow(), and oomph::CumulativeTimings::start().
Referenced by diffPdfInt(), and pdfInt().
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, Eigen::bfloat16_impl::floor(), logger, numCells_, UniformPSDSelfTest::r, rMax_, rMin_, and y.
Referenced by initialise().
References Eigen::bfloat16_impl::floor(), numCells_, UniformPSDSelfTest::r, rMax_, rMin_, and y.
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().
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().
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().