MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HGridOptimiser.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef HGRIDOptimiser_H
27 #define HGRIDOptimiser_H
28 
29 #include <vector>
30 #include "HGRID_base.h"
31 
33 {
34  public:
35  void Initialise(HGRID_base& problem, int verbosity);
36  int radius2Cell(double r);
37  double cell2Min(int i);
38  double cell2Max(int i);
39  double pdfInt(double start, double end, int power);
40  double diffPdfInt(double x, int power);
41  double expectedCellsIntegral(double start, double end, int p, double h);
42  double diffStartExpectedCellsIntegral(double start, double end, int p, double h);
43  double diffEndExpectedCellsIntegral(double start, double end, int p, double h);
44  double diffHExpectedCellsIntegral(double start, double end, int p, double h);
45  double calculateWork(std::vector<double>& hGridCellSizes, HGridMethod method, int verbosity);
46  void calculateDiffWork(std::vector<double>& hGridCellSizes, std::vector<double>& dfdx, HGridMethod method, int verbosity);
47  void calcDfDx(std::vector<double>& hGridCellSizes, std::vector<double>& dfdx, HGridMethod method, int verbosity);
48  double checkLimit(std::vector<double>& hGridCellSizes, std::vector<double>& dfdx, int verbosity);
49  void applyStep(std::vector<double>& hGridCellSizes, std::vector<double>& dfdx, double stepsize, int verbosity);
50  double goldenSectionSearch(std::vector<double>& startHGridCellSizes, std::vector<double>& searchDirection, double min, double cur, double max, HGridMethod method, int verbosity);
51  void getOptimalDistribution(std::vector<double>& hGridCellSizes, int numberOfLevels, HGridMethod method, int verbosity);
52 
53 
54  private:
56  double rMin;
57  double rMax;
58  double length;
59  double k;
60  int dimension;
61  std::vector<int> CellN;
62 };
63 
64 #endif
65 
double goldenSectionSearch(std::vector< double > &startHGridCellSizes, std::vector< double > &searchDirection, double min, double cur, double max, HGridMethod method, int verbosity)
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)
This is the base class for both HGRID_2D and HGRID_3D.
Definition: HGRID_base.h:43
void Initialise(HGRID_base &problem, int verbosity)
std::vector< int > CellN
double calculateWork(std::vector< double > &hGridCellSizes, HGridMethod method, int verbosity)
double diffStartExpectedCellsIntegral(double start, double end, int p, double h)
double cell2Max(int i)
void getOptimalDistribution(std::vector< double > &hGridCellSizes, int numberOfLevels, HGridMethod method, int verbosity)
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...
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 cell2Min(int i)
HGridMethod
Definition: HGRID_base.h:36
int radius2Cell(double r)
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 diffHExpectedCellsIntegral(double start, double end, int p, double h)
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) ...
double diffEndExpectedCellsIntegral(double start, double end, int p, double h)