|
void | centerPeriodicValueAroundZero (double *x, double period) |
| Modify x so that it is periodic in [-period/2, +period/2). More...
|
|
int | indexWithinPeriod (int x, int period) |
| If period>0, retrun x so that it is periodic in [0, period), else return x. More...
|
|
double | getIntervalLengthPeriodic (double origin, double end, double period) |
| Get the length of the interval (origin, end). More...
|
|
double | getDeviationPeriodic (double x, double x0, double period) |
| Get the deviation x - x0. More...
|
|
int | multiDimGridIndexToLinear (const std::vector< GridAxis > &axis, const awh_ivec indexMulti) |
| Convert a multidimensional grid point index to a linear one. More...
|
|
bool | stepInMultiDimArray (int numDim, const awh_ivec numPoints, awh_ivec indexDim) |
| Take a step in a multidimensional array. More...
|
|
void | gridToSubgridIndex (const Grid &grid, const awh_ivec subgridOrigin, const awh_ivec subgridNpoints, int point, awh_ivec subgridIndex) |
| Transforms a grid point index to to the multidimensional index of a subgrid. More...
|
|
bool | subgridToGridIndex (const Grid &grid, const awh_ivec subgridOrigin, const awh_ivec subgridIndex, int *gridIndex) |
| Transform a multidimensional subgrid index to a grid point index. More...
|
|
void | setNeighborsOfGridPoint (int pointIndex, const Grid &grid, std::vector< int > *neighborIndexArray) |
| Find and set the neighbors of a grid point. More...
|
|
double gmx::anonymous_namespace{grid.cpp}::getDeviationPeriodic |
( |
double |
x, |
|
|
double |
x0, |
|
|
double |
period |
|
) |
| |
Get the deviation x - x0.
For period > 0, the deviation with minimum absolute value is returned, i.e. with a value in the interval [-period/2, +period/2). Also for period > 0, it is assumed that |x - x0| < period.
- Parameters
-
[in] | x | From value. |
[in] | x0 | To value. |
[in] | period | The period, or 0 if not periodic. |
- Returns
- the deviation from x to x0.
double gmx::anonymous_namespace{grid.cpp}::getIntervalLengthPeriodic |
( |
double |
origin, |
|
|
double |
end, |
|
|
double |
period |
|
) |
| |
Get the length of the interval (origin, end).
This returns the distance obtained by connecting the origin point to the end point in the positive direction. Note that this is generally not the shortest distance. For period > 0, both origin and end are expected to take values in the same periodic interval, ie. |origin - end| < period.
- Parameters
-
[in] | origin | Start value of the interval. |
[in] | end | End value of the interval. |
[in] | period | The period, or 0 if not periodic. |
- Returns
- the interval length from origin to end.
void gmx::anonymous_namespace{grid.cpp}::gridToSubgridIndex |
( |
const Grid & |
grid, |
|
|
const awh_ivec |
subgridOrigin, |
|
|
const awh_ivec |
subgridNpoints, |
|
|
int |
point, |
|
|
awh_ivec |
subgridIndex |
|
) |
| |
Transforms a grid point index to to the multidimensional index of a subgrid.
The subgrid is defined by the location of its origin and the number of points along each dimension. The index transformation thus consists of a projection of the linear index onto each dimension, followed by a translation of the origin. The subgrid may have parts that don't overlap with the grid. E.g. the origin vector can have negative components meaning the origin lies outside of the grid. However, the given point needs to be both a grid and subgrid point.
Periodic boundaries are taken care of by wrapping the subgrid around the grid. Thus, for periodic dimensions the number of subgrid points need to be less than the number of points in a period to prevent problems of wrapping around.
- Parameters
-
[in] | grid | The grid. |
[in] | subgridOrigin | Vector locating the subgrid origin relative to the grid origin. |
[in] | subgridNpoints | The number of subgrid points in each dimension. |
[in] | point | Grid point to get subgrid index for. |
[in,out] | subgridIndex | Subgrid multidimensional index. |
int gmx::anonymous_namespace{grid.cpp}::indexWithinPeriod |
( |
int |
x, |
|
|
int |
period |
|
) |
| |
If period>0, retrun x so that it is periodic in [0, period), else return x.
Return x is shifted its value by a +/- a period, if needed. Thus, it is assumed that x is at most one period away from this interval. For this domain and period > 0 this is equivalent to x = x % period. For period = 0, x is not modified.
- Parameters
-
[in,out] | x | Pointer to the value to modify, should be >= 0. |
[in] | period | The period, or 0 if not periodic. |
- Returns
- for period>0: index value witin [0, period), otherwise:
x
.