Refine Domain1D grids so that profiles satisfy adaptation tolerances.
More...
#include <refine.h>
Refine Domain1D grids so that profiles satisfy adaptation tolerances.
Definition at line 16 of file refine.h.
|
| Refiner (Domain1D &domain) |
|
| Refiner (const Refiner &)=delete |
|
Refiner & | operator= (const Refiner &)=delete |
|
void | setCriteria (double ratio=10.0, double slope=0.8, double curve=0.8, double prune=-0.1) |
| Set grid refinement criteria.
|
|
vector< double > | getCriteria () |
| Get the grid refinement criteria.
|
|
void | setActive (int comp, bool state=true) |
| Set the active state for a component.
|
|
void | setMaxPoints (int npmax) |
| Set the maximum number of points allowed in the domain.
|
|
size_t | maxPoints () const |
| Returns the maximum number of points allowed in the domain.
|
|
void | setGridMin (double gridmin) |
| Set the minimum allowable spacing between adjacent grid points [m].
|
|
double | gridMin () const |
| Returns the the minimum allowable spacing between adjacent grid points [m].
|
|
int | analyze (size_t n, const double *z, const double *x) |
| Determine locations in the grid that need additional grid points and update the internal state of the Refiner with this information.
|
|
int | nNewPoints () |
| Returns the number of new grid points that were needed.
|
|
void | show () |
| Displays the results of the grid refinement analysis.
|
|
bool | newPointNeeded (size_t j) |
| Returns true if a new grid point is needed to the right of grid index j.
|
|
bool | keepPoint (size_t j) |
| Returns true if the grid point at index j should be kept.
|
|
double | value (const double *x, size_t n, size_t j) |
| Returns the value of the solution component, n, at grid point j.
|
|
double | maxRatio () |
| Returns the maximum allowable ratio of grid spacing between adjacent intervals.
|
|
double | maxDelta () |
| Returns the maximum allowable difference in value between adjacent points.
|
|
double | maxSlope () |
| Returns the maximum allowable difference in the derivative between adjacent points.
|
|
double | prune () |
| Returns the threshold for removing unnecessary grid points.
|
|
|
enum | GridPointStatus { UNSET = 0
, KEEP = 1
, REMOVE = -1
} |
|
|
set< size_t > | m_insertPts |
| Indices of grid points that need new grid points added after them.
|
|
map< size_t, GridPointStatus > | m_keep |
| Status of whether each grid point should be kept or removed.
|
|
set< string > | m_componentNames |
| Names of components that require the addition of new grid points.
|
|
vector< bool > | m_active |
| Flags for whether each component should be considered for grid refinement.
|
|
double | m_min_range = 0.01 |
| Threshold for ignoring small changes around a constant during refinement.
|
|
Domain1D * | m_domain |
| Pointer to the domain to be refined.
|
|
size_t | m_nv |
| Number of components in the domain.
|
|
size_t | m_npmax = 1000 |
| Maximum number of grid points.
|
|
double | m_thresh = std::sqrt(std::numeric_limits<double>::epsilon()) |
| Absolute tolerance threshold for solution components in the domain.
|
|
double | m_gridmin = 1e-10 |
| minimum grid spacing [m]
|
|
|
double | m_ratio = 10.0 |
| grid spacing refinement criteria
|
|
double | m_slope = 0.8 |
| function change refinement criteria
|
|
double | m_curve = 0.8 |
| function slope refinement criteria
|
|
double | m_prune = -0.001 |
| pruning refinement criteria
|
|
◆ GridPointStatus
◆ Refiner()
◆ ~Refiner()
◆ setCriteria()
void setCriteria |
( |
double |
ratio = 10.0 , |
|
|
double |
slope = 0.8 , |
|
|
double |
curve = 0.8 , |
|
|
double |
prune = -0.1 |
|
) |
| |
Set grid refinement criteria.
The ratio parameter is the maximum allowed ratio between grid spacing at adjacent intervals. The ratio parameter considers the situation where the left interval is much larger than the right interval, or if the right interval is much larger than the left interval. See ratio.
The slope parameter is the maximum fractional change in the value of each solution component between adjacent grid points. See slope.
The curve parameter is the maximum fractional change in the derivative of each solution component between adjacent grid points. See curve.
The prune parameter is a threshold for removing unnecessary grid points. See prune.
- Parameters
-
ratio | Maximum ratio between grid spacing at adjacent intervals. That is, (x[j+1] - x[j]) / (x[j] - x[j-1]) < ratio |
slope | Maximum fractional change in the value of each solution component between adjacent grid points. |
curve | Maximum fractional change in the derivative of each solution component between adjacent grid points. |
prune | Threshold for removing unnecessary grid points. prune should be smaller than both slope and curve . Set prune <= 0 to disable pruning. |
Definition at line 21 of file refine.cpp.
◆ getCriteria()
vector< double > getCriteria |
( |
| ) |
|
|
inline |
◆ setActive()
void setActive |
( |
int |
comp, |
|
|
bool |
state = true |
|
) |
| |
|
inline |
Set the active state for a component.
- Parameters
-
comp | Component index |
state | True if the component should be considered for grid refinement |
Definition at line 71 of file refine.h.
◆ setMaxPoints()
void setMaxPoints |
( |
int |
npmax | ) |
|
|
inline |
Set the maximum number of points allowed in the domain.
Definition at line 76 of file refine.h.
◆ maxPoints()
size_t maxPoints |
( |
| ) |
const |
|
inline |
Returns the maximum number of points allowed in the domain.
Definition at line 81 of file refine.h.
◆ setGridMin()
void setGridMin |
( |
double |
gridmin | ) |
|
|
inline |
Set the minimum allowable spacing between adjacent grid points [m].
Definition at line 86 of file refine.h.
◆ gridMin()
Returns the the minimum allowable spacing between adjacent grid points [m].
Definition at line 92 of file refine.h.
◆ analyze()
int analyze |
( |
size_t |
n, |
|
|
const double * |
z, |
|
|
const double * |
x |
|
) |
| |
Determine locations in the grid that need additional grid points and update the internal state of the Refiner with this information.
- Parameters
-
[in] | n | Number of grid points |
[in] | z | Point to array of grid points |
[in] | x | Pointer to solution vector |
- Returns
- The number of new grid points needed (size of m_insertPts)
Definition at line 43 of file refine.cpp.
◆ nNewPoints()
Returns the number of new grid points that were needed.
Definition at line 109 of file refine.h.
◆ show()
Displays the results of the grid refinement analysis.
This method logs information about where new grid points have been inserted and the components that required these insertions, if any. If no new points were needed, it logs that the current grid is sufficient.
- Note
- This method should be called after analyze() to report the outcomes of the refinement analysis.
Definition at line 216 of file refine.cpp.
◆ newPointNeeded()
bool newPointNeeded |
( |
size_t |
j | ) |
|
|
inline |
Returns true if a new grid point is needed to the right of grid index j.
- Parameters
-
Definition at line 130 of file refine.h.
◆ keepPoint()
bool keepPoint |
( |
size_t |
j | ) |
|
|
inline |
Returns true if the grid point at index j should be kept.
- Parameters
-
Definition at line 139 of file refine.h.
◆ value()
double value |
( |
const double * |
x, |
|
|
size_t |
n, |
|
|
size_t |
j |
|
) |
| |
Returns the value of the solution component, n, at grid point j.
- Parameters
-
x | Solution vector |
n | Solution component index |
j | Grid point index |
Definition at line 211 of file refine.cpp.
◆ maxRatio()
Returns the maximum allowable ratio of grid spacing between adjacent intervals.
Definition at line 153 of file refine.h.
◆ maxDelta()
Returns the maximum allowable difference in value between adjacent points.
Definition at line 158 of file refine.h.
◆ maxSlope()
Returns the maximum allowable difference in the derivative between adjacent points.
Definition at line 163 of file refine.h.
◆ prune()
Returns the threshold for removing unnecessary grid points.
Definition at line 168 of file refine.h.
◆ m_insertPts
Indices of grid points that need new grid points added after them.
Definition at line 174 of file refine.h.
◆ m_keep
map<size_t, GridPointStatus> m_keep |
|
protected |
Status of whether each grid point should be kept or removed.
Definition at line 184 of file refine.h.
◆ m_componentNames
set<string> m_componentNames |
|
protected |
Names of components that require the addition of new grid points.
Definition at line 187 of file refine.h.
◆ m_active
Flags for whether each component should be considered for grid refinement.
Definition at line 190 of file refine.h.
◆ m_ratio
grid spacing refinement criteria
Definition at line 194 of file refine.h.
◆ m_slope
function change refinement criteria
Definition at line 195 of file refine.h.
◆ m_curve
function slope refinement criteria
Definition at line 196 of file refine.h.
◆ m_prune
pruning refinement criteria
Definition at line 197 of file refine.h.
◆ m_min_range
double m_min_range = 0.01 |
|
protected |
Threshold for ignoring small changes around a constant during refinement.
Definition at line 201 of file refine.h.
◆ m_domain
Pointer to the domain to be refined.
Definition at line 203 of file refine.h.
◆ m_nv
Number of components in the domain.
Definition at line 204 of file refine.h.
◆ m_npmax
Maximum number of grid points.
Definition at line 205 of file refine.h.
◆ m_thresh
double m_thresh = std::sqrt(std::numeric_limits<double>::epsilon()) |
|
protected |
Absolute tolerance threshold for solution components in the domain.
Definition at line 208 of file refine.h.
◆ m_gridmin
minimum grid spacing [m]
Definition at line 209 of file refine.h.
The documentation for this class was generated from the following files: